android.test.suitebuilder.annotation.LargeTest Java Examples

The following examples show how to use android.test.suitebuilder.annotation.LargeTest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AccessTokenTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testCreateFromExistingToken() {
    final String token = "A token of my esteem";
    final List<String> permissions = Arrays.asList("walk", "chew gum");
    final Date expires = new Date(2025, 5, 3);
    final Date lastRefresh = new Date(2023, 8, 15);
    final AccessTokenSource source = AccessTokenSource.WEB_VIEW;

    AccessToken accessToken = AccessToken
            .createFromExistingAccessToken(token, expires, lastRefresh, source, permissions);

    assertEquals(token, accessToken.getToken());
    assertEquals(expires, accessToken.getExpires());
    assertEquals(lastRefresh, accessToken.getLastRefresh());
    assertEquals(source, accessToken.getSource());
    assertEquals(permissions, accessToken.getPermissions());
}
 
Example #2
Source File: CameraTest.java    From Camera2 with Apache License 2.0 6 votes vote down vote up
@LargeTest
public void testVideoCaptureIntentFdLeak() throws Exception
{
    Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
    intent.setClass(getInstrumentation().getTargetContext(), CameraActivity.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.parse("file://"
            + Environment.getExternalStorageDirectory().toString()
            + "test_fd_leak.3gp"));
    getInstrumentation().startActivitySync(intent).finish();
    // Test if the fd is closed.
    for (File f : new File("/proc/" + Process.myPid() + "/fd").listFiles())
    {
        assertEquals(-1, f.getCanonicalPath().indexOf("test_fd_leak.3gp"));
    }
}
 
Example #3
Source File: FileLruCacheTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest @MediumTest @LargeTest
public void testCacheClearMidBuffer() throws Exception {
    int dataSize = 1024;
    byte[] data = generateBytes(dataSize);
    String key = "a";
    String key2 = "b";

    // Limit to 2x to allow for extra header data
    FileLruCache cache = new FileLruCache(getContext(), "testCacheClear", limitCacheSize(2*dataSize));
    TestUtils.clearFileLruCache(cache);

    put(cache, key, data);
    checkValue(cache, key, data);
    OutputStream stream = cache.openPutStream(key2);
    Thread.sleep(1000);

    TestUtils.clearFileLruCache(cache);

    stream.write(data);
    stream.close();

    assertEquals(false, hasValue(cache, key));
    assertEquals(false, hasValue(cache, key2));
    assertEquals(0, cache.sizeInBytesForTest());
}
 
Example #4
Source File: GraphObjectFactoryTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testSetNestedObject() {
    ObjectWithNestedObject object = GraphObject.Factory.create(ObjectWithNestedObject.class);
    object.setNestedObjectById("77");

    NestedObject nestedObject = object.getNestedObject();
    assertNotNull(nestedObject);
    assertEquals("77", nestedObject.getId());

    object.setNestedObjectByUrl("http://www.example.com");

    nestedObject = object.getNestedObject();
    assertNotNull(nestedObject);
    assertEquals("http://www.example.com", nestedObject.getUrl());

    // Overloaded method
    object.setNestedObject("77");

    nestedObject = object.getNestedObject();
    assertNotNull(nestedObject);
    assertEquals("77", nestedObject.getId());
}
 
Example #5
Source File: GraphObjectFactoryTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testMapKeySet() throws JSONException {
    JSONObject jsonObject = new JSONObject();
    jsonObject.put("hello", "world");
    jsonObject.put("hocus", "pocus");

    GraphObject graphObject = GraphObject.Factory.create(jsonObject);

    Set<String> keySet = graphObject.asMap().keySet();
    assertEquals(2, keySet.size());
    assertTrue(keySet.contains("hello"));
    assertTrue(keySet.contains("hocus"));
    assertFalse(keySet.contains("world"));
}
 
Example #6
Source File: RequestTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@LargeTest
public void testUpdateOpenGraphObjectRequest() {
    String id = executePostOpenGraphRequest();

    GraphObject data = GraphObject.Factory.create();
    data.setProperty("a_property", "goodbye");

    TestSession session = openTestSessionWithSharedUser();
    Request request = Request.newUpdateOpenGraphObjectRequest(session, id, "another title", null,
            "http://www.facebook.com/aaaaaaaaaaaaaaaaa", "another description", data, null);
    Response response = request.executeAndWait();
    assertNotNull(response);

    assertNull(response.getError());

    GraphObject result = response.getGraphObject();
    assertNotNull(result);
    assertNotNull(response.getRawResponse());
}
 
Example #7
Source File: AccessTokenTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testCacheRoundtrip() {
    ArrayList<String> permissions = Utility.arrayList("stream_publish", "go_outside_and_play");
    String token = "AnImaginaryTokenValue";
    Date later = TestUtils.nowPlusSeconds(60);
    Date earlier = TestUtils.nowPlusSeconds(-60);

    Bundle bundle = new Bundle();
    TokenCachingStrategy.putToken(bundle, token);
    TokenCachingStrategy.putExpirationDate(bundle, later);
    TokenCachingStrategy.putSource(bundle, AccessTokenSource.FACEBOOK_APPLICATION_WEB);
    TokenCachingStrategy.putLastRefreshDate(bundle, earlier);
    TokenCachingStrategy.putPermissions(bundle, permissions);

    AccessToken accessToken = AccessToken.createFromCache(bundle);
    TestUtils.assertSamePermissions(permissions, accessToken);
    assertEquals(token, accessToken.getToken());
    assertEquals(AccessTokenSource.FACEBOOK_APPLICATION_WEB, accessToken.getSource());
    assertTrue(!accessToken.isInvalid());

    Bundle cache = accessToken.toCacheBundle();
    TestUtils.assertEqualContents(bundle, cache);
}
 
Example #8
Source File: GraphObjectFactoryTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testObjectEquals() {
    GraphObject graphObject = GraphObject.Factory.create();
    graphObject.setProperty("aKey", "aValue");

    assertTrue(graphObject.equals(graphObject));

    GraphPlace graphPlace = graphObject.cast(GraphPlace.class);
    assertTrue(graphObject.equals(graphPlace));
    assertTrue(graphPlace.equals(graphObject));

    GraphObject aDifferentGraphObject = GraphObject.Factory.create();
    aDifferentGraphObject.setProperty("aKey", "aDifferentValue");
    assertFalse(graphObject.equals(aDifferentGraphObject));
}
 
Example #9
Source File: GraphObjectFactoryTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testCollectionWrapsJSONObject() throws JSONException {
    JSONObject jsonLocation = new JSONObject();
    jsonLocation.put("city", "Seattle");

    JSONArray jsonArray = new JSONArray();
    jsonArray.put(jsonLocation);
    Collection<GraphLocation> locationsGraphObjectCollection = GraphObject.Factory
            .createList(jsonArray,
                    GraphLocation.class);
    assertTrue(locationsGraphObjectCollection != null);

    GraphLocation graphLocation = locationsGraphObjectCollection.iterator().next();
    assertTrue(graphLocation != null);
    assertEquals("Seattle", graphLocation.getCity());
}
 
Example #10
Source File: VideoCaptureIntentTest.java    From Camera2 with Apache License 2.0 6 votes vote down vote up
@LargeTest
public void testExtraSizeLimit() throws Exception
{
    mFile = new File(Environment.getExternalStorageDirectory(), "video.tmp");
    final long sizeLimit = 500000;  // bytes

    Uri uri = Uri.fromFile(mFile);
    mIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
    mIntent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, sizeLimit);
    mIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 0);  // use low quality to speed up
    setActivityIntent(mIntent);
    getActivity();

    recordVideo(5000);
    pressDone();

    verify(getActivity(), uri);
    long length = mFile.length();
    Log.v(TAG, "Video size is " + length + " bytes.");
    assertTrue(length > 0);
    assertTrue("Actual size=" + length, length <= sizeLimit);
}
 
Example #11
Source File: GraphObjectFactoryTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testCanOverrideGraphPropertyNames() {
    GoodPropertyOverrideInterfaceGraphObject graphObject =
            GraphObject.Factory.create(GoodPropertyOverrideInterfaceGraphObject.class);

    String testValue = "flu-blah";
    graphObject.setDefaultName(testValue);
    Assert.assertEquals(testValue, graphObject.retrieveSomething());

    testValue = testValue + "1";
    graphObject.putSomething(testValue);
    Assert.assertEquals(testValue, graphObject.getAnotherDefaultName());

    testValue = testValue + "2";
    graphObject.setMixedCase(testValue);
    Assert.assertEquals(testValue, graphObject.getMixedCase());
}
 
Example #12
Source File: SessionTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@LargeTest
public void testBasicSerialization() throws IOException, ClassNotFoundException {
    // Try to test the happy path, that there are no unserializable fields
    // in the session.
    Session session0 = new Session.Builder(getActivity()).setApplicationId("fakeID").build();
    Session session1 = TestUtils.serializeAndUnserialize(session0);

    // do some basic assertions
    assertNotNull(session0.getAccessToken());
    assertEquals(session0, session1);

    Session.AuthorizationRequest authRequest0 =
            new Session.OpenRequest(getActivity()).
                    setRequestCode(123).
                    setLoginBehavior(SessionLoginBehavior.SSO_ONLY);
    Session.AuthorizationRequest authRequest1 = TestUtils.serializeAndUnserialize(authRequest0);

    assertEquals(authRequest0.getLoginBehavior(), authRequest1.getLoginBehavior());
    assertEquals(authRequest0.getRequestCode(), authRequest1.getRequestCode());
}
 
Example #13
Source File: GraphObjectFactoryTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testMapPutOfWrapperPutsJSONObject() throws JSONException {
    JSONObject jsonObject = new JSONObject();

    GraphObject graphObject = GraphObject.Factory.create(jsonObject);
    graphObject.setProperty("hello", "world");
    graphObject.setProperty("hocus", "pocus");

    GraphObject parentObject = GraphObject.Factory.create();
    parentObject.setProperty("key", graphObject);

    JSONObject jsonParent = parentObject.getInnerJSONObject();
    Object obj = jsonParent.opt("key");

    assertNotNull(obj);
    assertEquals(jsonObject, obj);
}
 
Example #14
Source File: RequestTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@MediumTest
@LargeTest
public void testFacebookErrorResponseCreatesError() {
    Request request = new Request(null, "somestringthatshouldneverbeavalidfobjectid");
    Response response = request.executeAndWait();

    assertTrue(response != null);

    FacebookRequestError error = response.getError();
    assertNotNull(error);
    FacebookException exception = error.getException();
    assertNotNull(exception);

    assertTrue(exception instanceof FacebookServiceException);
    assertNotNull(error.getErrorType());
    assertTrue(error.getErrorCode() != FacebookRequestError.INVALID_ERROR_CODE);
    assertNotNull(error.getRequestResultBody());
}
 
Example #15
Source File: BatchRequestTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@MediumTest
@LargeTest
public void testExecuteBatchRequestsPathEncoding() throws IOException {
    // ensures that paths passed to batch requests are encoded properly before
    // we send it up to the server

    TestSession session = openTestSessionWithSharedUser();

    Request request1 = new Request(session, "TourEiffel");
    request1.setBatchEntryName("eiffel");
    request1.setBatchEntryOmitResultOnSuccess(false);
    Request request2 = new Request(session, "{result=eiffel:$.id}");

    List<Response> responses = Request.executeBatchAndWait(request1, request2);
    assertEquals(2, responses.size());
    assertTrue(responses.get(0).getError() == null);
    assertTrue(responses.get(1).getError() == null);

    GraphPlace eiffelTower1 = responses.get(0).getGraphObjectAs(GraphPlace.class);
    GraphPlace eiffelTower2 = responses.get(1).getGraphObjectAs(GraphPlace.class);
    assertTrue(eiffelTower1 != null);
    assertTrue(eiffelTower2 != null);

    assertEquals("Paris", eiffelTower1.getLocation().getCity());
    assertEquals("Paris", eiffelTower2.getLocation().getCity());
}
 
Example #16
Source File: RequestTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@LargeTest
public void testFacebookSuccessResponseWithErrorCodeCreatesError() {
    TestSession session = openTestSessionWithSharedUser();

    Request request = Request.newRestRequest(session, "auth.extendSSOAccessToken", null, null);
    assertNotNull(request);

    // Because TestSession access tokens were not created via SSO, we expect to get an error from the service,
    // but with a 200 (success) code.
    Response response = request.executeAndWait();

    assertTrue(response != null);

    FacebookRequestError error = response.getError();
    assertNotNull(error);

    assertTrue(error.getException() instanceof FacebookServiceException);
    assertTrue(error.getErrorCode() != FacebookRequestError.INVALID_ERROR_CODE);
    assertNotNull(error.getRequestResultBody());
}
 
Example #17
Source File: BatchRequestTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@MediumTest
@LargeTest
public void testFacebookErrorResponsesCreateErrors() {
    setBatchApplicationIdForTestApp();

    Request request1 = new Request(null, "somestringthatshouldneverbeavalidfobjectid");
    Request request2 = new Request(null, "someotherstringthatshouldneverbeavalidfobjectid");
    List<Response> responses = Request.executeBatchAndWait(request1, request2);

    assertEquals(2, responses.size());
    assertTrue(responses.get(0).getError() != null);
    assertTrue(responses.get(1).getError() != null);

    FacebookRequestError error = responses.get(0).getError();
    assertTrue(error.getException() instanceof FacebookServiceException);
    assertTrue(error.getErrorType() != null);
    assertTrue(error.getErrorCode() != FacebookRequestError.INVALID_ERROR_CODE);
}
 
Example #18
Source File: SessionTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testOpeningSessionWithPendingRequestResultsInExceptionCallback() {
    MockTokenCachingStrategy cache = new MockTokenCachingStrategy(null, 0);
    SessionStatusCallbackRecorder statusRecorder = new SessionStatusCallbackRecorder();
    ScriptedSession session = createScriptedSessionOnBlockerThread(cache);

    // Verify state with no token in cache
    assertEquals(SessionState.CREATED, session.getState());
    session.addPendingAuthorizeResult();

    session.openForRead(new Session.OpenRequest(getActivity()).setCallback(statusRecorder));
    session.openForRead(new Session.OpenRequest(getActivity()).setCallback(statusRecorder));
    statusRecorder.waitForCall(session, SessionState.OPENING, null);
    statusRecorder.waitForCall(session, SessionState.OPENING, new UnsupportedOperationException());

    stall(STRAY_CALLBACK_WAIT_MILLISECONDS);
    statusRecorder.close();
}
 
Example #19
Source File: BatchRequestTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@LargeTest
public void testTwoDifferentAccessTokens() {
    TestSession session1 = openTestSessionWithSharedUser();
    TestSession session2 = openTestSessionWithSharedUser(SECOND_TEST_USER_TAG);

    Request request1 = Request.newMeRequest(session1, null);
    Request request2 = Request.newMeRequest(session2, null);

    List<Response> responses = Request.executeBatchAndWait(request1, request2);
    assertNotNull(responses);
    assertEquals(2, responses.size());

    GraphUser user1 = responses.get(0).getGraphObjectAs(GraphUser.class);
    GraphUser user2 = responses.get(1).getGraphObjectAs(GraphUser.class);

    assertNotNull(user1);
    assertNotNull(user2);

    assertFalse(user1.getId().equals(user2.getId()));
    assertEquals(session1.getTestUserId(), user1.getId());
    assertEquals(session2.getTestUserId(), user2.getId());
}
 
Example #20
Source File: FileLruCacheTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest @MediumTest @LargeTest
public void testCacheClear() throws Exception {
    int dataSize = 1024;
    byte[] data = generateBytes(dataSize);
    String key = "a";

    // Limit to 2x to allow for extra header data
    FileLruCache cache = new FileLruCache(getContext(), "testCacheClear", limitCacheSize(2*dataSize));
    TestUtils.clearFileLruCache(cache);

    put(cache, key, data);
    checkValue(cache, key, data);

    TestUtils.clearFileLruCache(cache);
    assertEquals(false, hasValue(cache, key));
    assertEquals(0, cache.sizeInBytesForTest());
}
 
Example #21
Source File: GraphObjectFactoryTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testMapPutOfWrapperPutsJSONArray() throws JSONException {
    JSONArray jsonArray = new JSONArray();

    GraphObjectList<String> graphObjectList = GraphObject.Factory
            .createList(jsonArray, String.class);
    graphObjectList.add("hello");
    graphObjectList.add("world");

    GraphObject parentObject = GraphObject.Factory.create();
    parentObject.setProperty("key", graphObjectList);

    JSONObject jsonParent = parentObject.getInnerJSONObject();
    Object obj = jsonParent.opt("key");

    assertNotNull(obj);
    assertEquals(jsonArray, obj);
}
 
Example #22
Source File: BatchRequestTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@LargeTest
public void testBatchWithTwoSessionlessRequestsAndDefaultAppID() {
    TestSession session = getTestSessionWithSharedUser(null);
    String appId = session.getApplicationId();
    Request.setDefaultBatchApplicationId(appId);

    Request request1 = new Request(null, "me");
    Request request2 = new Request(null, "me");

    List<Response> responses = Request.executeBatchAndWait(request1, request2);
    assertNotNull(responses);
    assertEquals(2, responses.size());

    GraphUser user1 = responses.get(0).getGraphObjectAs(GraphUser.class);
    GraphUser user2 = responses.get(1).getGraphObjectAs(GraphUser.class);

    assertNull(user1);
    assertNull(user2);
}
 
Example #23
Source File: GraphObjectFactoryTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testCollectionIterator() throws JSONException {
    JSONArray array = new JSONArray();
    array.put(5);
    array.put(-1);

    Collection<Integer> collection = GraphObject.Factory.createList(array, Integer.class);
    Iterator<Integer> iter = collection.iterator();
    assertTrue(iter.hasNext());
    assertTrue(iter.next() == 5);
    assertTrue(iter.hasNext());
    assertTrue(iter.next() == -1);
    assertFalse(iter.hasNext());

    for (Integer i : collection) {
        assertNotSame(0, i);
    }
}
 
Example #24
Source File: RequestTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@MediumTest
@LargeTest
public void testExecutePlaceRequestWithLocationAndSearchText() {
    TestSession session = openTestSessionWithSharedUser();

    Location location = new Location("");
    location.setLatitude(47.6204);
    location.setLongitude(-122.3491);

    Request request = Request.newPlacesSearchRequest(session, location, 1000, 5, "Starbucks", null);
    Response response = request.executeAndWait();
    assertNotNull(response);

    assertNull(response.getError());

    GraphMultiResult graphResult = response.getGraphObjectAs(GraphMultiResult.class);
    assertNotNull(graphResult);

    List<GraphObject> results = graphResult.getData();
    assertNotNull(results);

    assertNotNull(response.getRawResponse());
}
 
Example #25
Source File: GraphObjectFactoryTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testCanTreatAsGraphUser() {
    GraphUser graphUser = GraphObject.Factory.create(GraphUser.class);

    graphUser.setFirstName("Michael");
    assertEquals("Michael", graphUser.getFirstName());
    assertEquals("Michael", graphUser.getProperty("first_name"));
    assertEquals("Michael", graphUser.asMap().get("first_name"));

    graphUser.setProperty("last_name", "Scott");
    assertEquals("Scott", graphUser.getProperty("last_name"));
    assertEquals("Scott", graphUser.getLastName());
    assertEquals("Scott", graphUser.asMap().get("last_name"));
}
 
Example #26
Source File: GraphObjectFactoryTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testCanCastCollectionOfGraphObjects() throws JSONException {
    JSONObject jsonSeattle = new JSONObject();
    jsonSeattle.put("city", "Seattle");

    JSONArray jsonArray = new JSONArray();
    jsonArray.put(jsonSeattle);

    GraphObjectList<GraphObject> collection = GraphObject.Factory
            .createList(jsonArray, GraphObject.class);

    GraphObjectList<GraphLocation> locationCollection = collection.castToListOf(GraphLocation.class);
    assertTrue(locationCollection != null);

    GraphLocation seattle = locationCollection.iterator().next();
    assertTrue(seattle != null);
    assertEquals("Seattle", seattle.getCity());
}
 
Example #27
Source File: BatchRequestTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@MediumTest
@LargeTest
public void testExplicitDependencyCanIncludeFirstResponse() {
    TestSession session = openTestSessionWithSharedUser();

    Request requestMe = Request.newMeRequest(session, null);
    requestMe.setBatchEntryName("me_request");
    requestMe.setBatchEntryOmitResultOnSuccess(false);

    Request requestMyFriends = Request.newMyFriendsRequest(session, null);
    requestMyFriends.setBatchEntryDependsOn("me_request");

    List<Response> responses = Request.executeBatchAndWait(requestMe, requestMyFriends);

    Response meResponse = responses.get(0);
    Response myFriendsResponse = responses.get(1);

    assertNotNull(meResponse.getGraphObject());
    assertNotNull(myFriendsResponse.getGraphObject());
}
 
Example #28
Source File: AuthorizationClientTests.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testProxyAuthHandlesCancelErrorMessage() {
    Bundle bundle = new Bundle();
    bundle.putString("error", "access_denied");

    Intent intent = new Intent();
    intent.putExtras(bundle);

    MockAuthorizationClient client = new MockAuthorizationClient();
    AuthorizationClient.KatanaProxyAuthHandler handler = client.new KatanaProxyAuthHandler();

    AuthorizationClient.AuthorizationRequest request = createRequest();
    client.setRequest(request);
    handler.onActivityResult(0, Activity.RESULT_CANCELED, intent);

    assertNotNull(client.result);
    assertEquals(AuthorizationClient.Result.Code.CANCEL, client.result.code);

    assertNull(client.result.token);
}
 
Example #29
Source File: RequestTests.java    From FacebookImageShareIntent with MIT License 5 votes vote down vote up
@MediumTest
@LargeTest
public void testCantSetBothGraphPathAndRestMethod() {
    Request request = new Request();
    request.setGraphPath("me");
    request.setRestMethod("amethod");
    request.setCallback(new ExpectFailureCallback());

    TestRequestAsyncTask task = new TestRequestAsyncTask(request);
    task.executeOnBlockerThread();

    waitAndAssertSuccess(1);
}
 
Example #30
Source File: RequestTests.java    From FacebookImageShareIntent with MIT License 5 votes vote down vote up
@SmallTest
@MediumTest
@LargeTest
public void testNewPostOpenGraphActionRequestRequiresAction() {
    try {
        Request.newPostOpenGraphActionRequest(null, null, null);
        fail("expected exception");
    } catch (FacebookException exception) {
        // Success
    }
}