Java 类com.facebook.sdk.tests.R 实例源码

项目:LostAndFound    文件:FacebookRequestErrorTests.java   
public void testSinglePermissionError() throws JSONException {
    JSONObject originalResponse = new JSONObject(ERROR_SINGLE_RESPONSE_PERMISSION);
    JSONObject withStatusCodeAndBody = new JSONObject();
    withStatusCodeAndBody.put("code", 400);
    withStatusCodeAndBody.put("body", originalResponse);
    FacebookRequestError error =
            FacebookRequestError.checkResponseAndCreateError(withStatusCodeAndBody, originalResponse, null);
    assertNotNull(error);
    assertEquals(400, error.getRequestStatusCode());
    assertEquals("(#200) Requires extended permission: publish_actions", error.getErrorMessage());
    assertEquals("OAuthException", error.getErrorType());
    assertEquals(200, error.getErrorCode());
    assertEquals(FacebookRequestError.INVALID_ERROR_CODE, error.getSubErrorCode());
    assertTrue(error.getBatchRequestResult() instanceof JSONObject);
    assertEquals(FacebookRequestError.Category.PERMISSION, error.getCategory());
    assertEquals(R.string.com_facebook_requesterror_permissions, error.getUserActionMessageId());
}
项目:LostAndFound    文件:FacebookRequestErrorTests.java   
public void testSingleWebLoginError() throws JSONException {
    JSONObject originalResponse = new JSONObject(ERROR_SINGLE_RESPONSE_WEB_LOGIN);
    JSONObject withStatusCodeAndBody = new JSONObject();
    withStatusCodeAndBody.put("code", 400);
    withStatusCodeAndBody.put("body", originalResponse);
    FacebookRequestError error =
            FacebookRequestError.checkResponseAndCreateError(withStatusCodeAndBody, originalResponse, null);
    assertNotNull(error);
    assertEquals(400, error.getRequestStatusCode());
    assertEquals("User need to login", error.getErrorMessage());
    assertEquals("OAuthException", error.getErrorType());
    assertEquals(102, error.getErrorCode());
    assertEquals(459, error.getSubErrorCode());
    assertTrue(error.getBatchRequestResult() instanceof JSONObject);
    assertEquals(FacebookRequestError.Category.AUTHENTICATION_RETRY, error.getCategory());
    assertEquals(R.string.com_facebook_requesterror_web_login, error.getUserActionMessageId());
}
项目:LostAndFound    文件:FacebookRequestErrorTests.java   
public void testSingleReloginError() throws JSONException {
    JSONObject originalResponse = new JSONObject(ERROR_SINGLE_RESPONSE_RELOGIN);
    JSONObject withStatusCodeAndBody = new JSONObject();
    withStatusCodeAndBody.put("code", 400);
    withStatusCodeAndBody.put("body", originalResponse);
    FacebookRequestError error =
            FacebookRequestError.checkResponseAndCreateError(withStatusCodeAndBody, originalResponse, null);
    assertNotNull(error);
    assertEquals(400, error.getRequestStatusCode());
    assertEquals("User need to relogin", error.getErrorMessage());
    assertEquals("OAuthException", error.getErrorType());
    assertEquals(102, error.getErrorCode());
    assertEquals(FacebookRequestError.INVALID_ERROR_CODE, error.getSubErrorCode());
    assertTrue(error.getBatchRequestResult() instanceof JSONObject);
    assertEquals(FacebookRequestError.Category.AUTHENTICATION_REOPEN_SESSION, error.getCategory());
    assertEquals(R.string.com_facebook_requesterror_reconnect, error.getUserActionMessageId());
}
项目:LostAndFound    文件:FacebookRequestErrorTests.java   
public void testSingleReloginDeletedAppError() throws JSONException {
    JSONObject originalResponse = new JSONObject(ERROR_SINGLE_RESPONSE_RELOGIN_DELETED_APP);
    JSONObject withStatusCodeAndBody = new JSONObject();
    withStatusCodeAndBody.put("code", 400);
    withStatusCodeAndBody.put("body", originalResponse);
    FacebookRequestError error =
            FacebookRequestError.checkResponseAndCreateError(withStatusCodeAndBody, originalResponse, null);
    assertNotNull(error);
    assertEquals(400, error.getRequestStatusCode());
    assertEquals("User need to relogin", error.getErrorMessage());
    assertEquals("OAuthException", error.getErrorType());
    assertEquals(190, error.getErrorCode());
    assertEquals(458, error.getSubErrorCode());
    assertTrue(error.getBatchRequestResult() instanceof JSONObject);
    assertEquals(FacebookRequestError.Category.AUTHENTICATION_REOPEN_SESSION, error.getCategory());
    assertEquals(R.string.com_facebook_requesterror_relogin, error.getUserActionMessageId());
}
项目:LostAndFound    文件:PlacePickerFragmentTests.java   
@MediumTest
@LargeTest
public void testCanSetParametersViaLayout() throws Throwable {
    TestActivity activity = getActivity();
    assertNotNull(activity);

    runAndBlockOnUiThread(0, new Runnable() {
        @Override
        public void run() {
            getActivity().setContentToLayout(R.layout.place_picker_test_layout_1, R.id.place_picker_fragment);
        }
    });

    final PlacePickerFragment fragment = activity.getFragment();
    assertNotNull(fragment);

    assertEquals(false, fragment.getShowPictures());
    assertEquals(75, fragment.getRadiusInMeters());
    assertEquals(5, fragment.getResultsLimit());
    assertEquals("coffee", fragment.getSearchText());
    Collection<String> extraFields = fragment.getExtraFields();
    assertTrue(extraFields.contains("checkins"));
    assertTrue(extraFields.contains("general_info"));
    // It doesn't make sense to specify location via layout, so we don't support it.
}
项目:LostAndFound    文件:FriendPickerFragmentTests.java   
@MediumTest
@LargeTest
public void testCanSetParametersViaLayout() throws Throwable {
    TestActivity activity = getActivity();
    assertNotNull(activity);

    runAndBlockOnUiThread(0, new Runnable() {
        @Override
        public void run() {
            getActivity().setContentToLayout(R.layout.friend_picker_test_layout_1, R.id.friend_picker_fragment);
        }
    });

    final FriendPickerFragment fragment = activity.getFragment();
    assertNotNull(fragment);

    assertEquals(false, fragment.getShowPictures());
    assertEquals(false, fragment.getMultiSelect());
    Collection<String> extraFields = fragment.getExtraFields();
    assertTrue(extraFields.contains("middle_name"));
    assertTrue(extraFields.contains("link"));
    // It doesn't make sense to specify user id via layout, so we don't support it.
}
项目:FacebookImageShareIntent    文件:FacebookRequestErrorTests.java   
public void testSinglePermissionError() throws JSONException {
    JSONObject originalResponse = new JSONObject(ERROR_SINGLE_RESPONSE_PERMISSION);
    JSONObject withStatusCodeAndBody = new JSONObject();
    withStatusCodeAndBody.put("code", 400);
    withStatusCodeAndBody.put("body", originalResponse);
    FacebookRequestError error =
            FacebookRequestError.checkResponseAndCreateError(withStatusCodeAndBody, originalResponse, null);
    assertNotNull(error);
    assertEquals(400, error.getRequestStatusCode());
    assertEquals("(#200) Requires extended permission: publish_actions", error.getErrorMessage());
    assertEquals("OAuthException", error.getErrorType());
    assertEquals(200, error.getErrorCode());
    assertEquals(FacebookRequestError.INVALID_ERROR_CODE, error.getSubErrorCode());
    assertTrue(error.getBatchRequestResult() instanceof JSONObject);
    assertEquals(FacebookRequestError.Category.PERMISSION, error.getCategory());
    assertEquals(R.string.com_facebook_requesterror_permissions, error.getUserActionMessageId());
}
项目:FacebookImageShareIntent    文件:FacebookRequestErrorTests.java   
public void testSingleWebLoginError() throws JSONException {
    JSONObject originalResponse = new JSONObject(ERROR_SINGLE_RESPONSE_WEB_LOGIN);
    JSONObject withStatusCodeAndBody = new JSONObject();
    withStatusCodeAndBody.put("code", 400);
    withStatusCodeAndBody.put("body", originalResponse);
    FacebookRequestError error =
            FacebookRequestError.checkResponseAndCreateError(withStatusCodeAndBody, originalResponse, null);
    assertNotNull(error);
    assertEquals(400, error.getRequestStatusCode());
    assertEquals("User need to login", error.getErrorMessage());
    assertEquals("OAuthException", error.getErrorType());
    assertEquals(102, error.getErrorCode());
    assertEquals(459, error.getSubErrorCode());
    assertTrue(error.getBatchRequestResult() instanceof JSONObject);
    assertEquals(FacebookRequestError.Category.AUTHENTICATION_RETRY, error.getCategory());
    assertEquals(R.string.com_facebook_requesterror_web_login, error.getUserActionMessageId());
}
项目:FacebookImageShareIntent    文件:FacebookRequestErrorTests.java   
public void testSingleReloginError() throws JSONException {
    JSONObject originalResponse = new JSONObject(ERROR_SINGLE_RESPONSE_RELOGIN);
    JSONObject withStatusCodeAndBody = new JSONObject();
    withStatusCodeAndBody.put("code", 400);
    withStatusCodeAndBody.put("body", originalResponse);
    FacebookRequestError error =
            FacebookRequestError.checkResponseAndCreateError(withStatusCodeAndBody, originalResponse, null);
    assertNotNull(error);
    assertEquals(400, error.getRequestStatusCode());
    assertEquals("User need to relogin", error.getErrorMessage());
    assertEquals("OAuthException", error.getErrorType());
    assertEquals(102, error.getErrorCode());
    assertEquals(FacebookRequestError.INVALID_ERROR_CODE, error.getSubErrorCode());
    assertTrue(error.getBatchRequestResult() instanceof JSONObject);
    assertEquals(FacebookRequestError.Category.AUTHENTICATION_REOPEN_SESSION, error.getCategory());
    assertEquals(R.string.com_facebook_requesterror_reconnect, error.getUserActionMessageId());
}
项目:FacebookImageShareIntent    文件:FacebookRequestErrorTests.java   
public void testSingleReloginDeletedAppError() throws JSONException {
    JSONObject originalResponse = new JSONObject(ERROR_SINGLE_RESPONSE_RELOGIN_DELETED_APP);
    JSONObject withStatusCodeAndBody = new JSONObject();
    withStatusCodeAndBody.put("code", 400);
    withStatusCodeAndBody.put("body", originalResponse);
    FacebookRequestError error =
            FacebookRequestError.checkResponseAndCreateError(withStatusCodeAndBody, originalResponse, null);
    assertNotNull(error);
    assertEquals(400, error.getRequestStatusCode());
    assertEquals("User need to relogin", error.getErrorMessage());
    assertEquals("OAuthException", error.getErrorType());
    assertEquals(190, error.getErrorCode());
    assertEquals(458, error.getSubErrorCode());
    assertTrue(error.getBatchRequestResult() instanceof JSONObject);
    assertEquals(FacebookRequestError.Category.AUTHENTICATION_REOPEN_SESSION, error.getCategory());
    assertEquals(R.string.com_facebook_requesterror_relogin, error.getUserActionMessageId());
}
项目:FacebookImageShareIntent    文件:PlacePickerFragmentTests.java   
@MediumTest
@LargeTest
public void testCanSetParametersViaLayout() throws Throwable {
    TestActivity activity = getActivity();
    assertNotNull(activity);

    runAndBlockOnUiThread(0, new Runnable() {
        @Override
        public void run() {
            getActivity().setContentToLayout(R.layout.place_picker_test_layout_1, R.id.place_picker_fragment);
        }
    });

    final PlacePickerFragment fragment = activity.getFragment();
    assertNotNull(fragment);

    assertEquals(false, fragment.getShowPictures());
    assertEquals(75, fragment.getRadiusInMeters());
    assertEquals(5, fragment.getResultsLimit());
    assertEquals("coffee", fragment.getSearchText());
    Collection<String> extraFields = fragment.getExtraFields();
    assertTrue(extraFields.contains("checkins"));
    assertTrue(extraFields.contains("general_info"));
    // It doesn't make sense to specify location via layout, so we don't support it.
}
项目:FacebookImageShareIntent    文件:FriendPickerFragmentTests.java   
@MediumTest
@LargeTest
public void testCanSetParametersViaLayout() throws Throwable {
    TestActivity activity = getActivity();
    assertNotNull(activity);

    runAndBlockOnUiThread(0, new Runnable() {
        @Override
        public void run() {
            getActivity().setContentToLayout(R.layout.friend_picker_test_layout_1, R.id.friend_picker_fragment);
        }
    });

    final FriendPickerFragment fragment = activity.getFragment();
    assertNotNull(fragment);

    assertEquals(false, fragment.getShowPictures());
    assertEquals(false, fragment.getMultiSelect());
    Collection<String> extraFields = fragment.getExtraFields();
    assertTrue(extraFields.contains("middle_name"));
    assertTrue(extraFields.contains("link"));
    // It doesn't make sense to specify user id via layout, so we don't support it.
}
项目:facebook-android-sdk    文件:FacebookRequestErrorTests.java   
public void testSinglePermissionError() throws JSONException {
    JSONObject originalResponse = new JSONObject(ERROR_SINGLE_RESPONSE_PERMISSION);
    JSONObject withStatusCodeAndBody = new JSONObject();
    withStatusCodeAndBody.put("code", 400);
    withStatusCodeAndBody.put("body", originalResponse);
    FacebookRequestError error =
            FacebookRequestError.checkResponseAndCreateError(withStatusCodeAndBody, originalResponse, null);
    assertNotNull(error);
    assertEquals(400, error.getRequestStatusCode());
    assertEquals("(#200) Requires extended permission: publish_actions", error.getErrorMessage());
    assertEquals("OAuthException", error.getErrorType());
    assertEquals(200, error.getErrorCode());
    assertEquals(FacebookRequestError.INVALID_ERROR_CODE, error.getSubErrorCode());
    assertTrue(error.getBatchRequestResult() instanceof JSONObject);
    assertEquals(FacebookRequestError.Category.PERMISSION, error.getCategory());
    assertEquals(R.string.com_facebook_requesterror_permissions, error.getUserActionMessageId());
}
项目:facebook-android-sdk    文件:FacebookRequestErrorTests.java   
public void testSingleWebLoginError() throws JSONException {
    JSONObject originalResponse = new JSONObject(ERROR_SINGLE_RESPONSE_WEB_LOGIN);
    JSONObject withStatusCodeAndBody = new JSONObject();
    withStatusCodeAndBody.put("code", 400);
    withStatusCodeAndBody.put("body", originalResponse);
    FacebookRequestError error =
            FacebookRequestError.checkResponseAndCreateError(withStatusCodeAndBody, originalResponse, null);
    assertNotNull(error);
    assertEquals(400, error.getRequestStatusCode());
    assertEquals("User need to login", error.getErrorMessage());
    assertEquals("OAuthException", error.getErrorType());
    assertEquals(102, error.getErrorCode());
    assertEquals(459, error.getSubErrorCode());
    assertTrue(error.getBatchRequestResult() instanceof JSONObject);
    assertEquals(FacebookRequestError.Category.AUTHENTICATION_RETRY, error.getCategory());
    assertEquals(R.string.com_facebook_requesterror_web_login, error.getUserActionMessageId());
}
项目:facebook-android-sdk    文件:FacebookRequestErrorTests.java   
public void testSingleReloginError() throws JSONException {
    JSONObject originalResponse = new JSONObject(ERROR_SINGLE_RESPONSE_RELOGIN);
    JSONObject withStatusCodeAndBody = new JSONObject();
    withStatusCodeAndBody.put("code", 400);
    withStatusCodeAndBody.put("body", originalResponse);
    FacebookRequestError error =
            FacebookRequestError.checkResponseAndCreateError(withStatusCodeAndBody, originalResponse, null);
    assertNotNull(error);
    assertEquals(400, error.getRequestStatusCode());
    assertEquals("User need to relogin", error.getErrorMessage());
    assertEquals("OAuthException", error.getErrorType());
    assertEquals(102, error.getErrorCode());
    assertEquals(FacebookRequestError.INVALID_ERROR_CODE, error.getSubErrorCode());
    assertTrue(error.getBatchRequestResult() instanceof JSONObject);
    assertEquals(FacebookRequestError.Category.AUTHENTICATION_REOPEN_SESSION, error.getCategory());
    assertEquals(R.string.com_facebook_requesterror_reconnect, error.getUserActionMessageId());
}
项目:facebook-android-sdk    文件:FacebookRequestErrorTests.java   
public void testSingleReloginDeletedAppError() throws JSONException {
    JSONObject originalResponse = new JSONObject(ERROR_SINGLE_RESPONSE_RELOGIN_DELETED_APP);
    JSONObject withStatusCodeAndBody = new JSONObject();
    withStatusCodeAndBody.put("code", 400);
    withStatusCodeAndBody.put("body", originalResponse);
    FacebookRequestError error =
            FacebookRequestError.checkResponseAndCreateError(withStatusCodeAndBody, originalResponse, null);
    assertNotNull(error);
    assertEquals(400, error.getRequestStatusCode());
    assertEquals("User need to relogin", error.getErrorMessage());
    assertEquals("OAuthException", error.getErrorType());
    assertEquals(190, error.getErrorCode());
    assertEquals(458, error.getSubErrorCode());
    assertTrue(error.getBatchRequestResult() instanceof JSONObject);
    assertEquals(FacebookRequestError.Category.AUTHENTICATION_REOPEN_SESSION, error.getCategory());
    assertEquals(R.string.com_facebook_requesterror_relogin, error.getUserActionMessageId());
}
项目:facebook-android-sdk    文件:PlacePickerFragmentTests.java   
@MediumTest
@LargeTest
public void testCanSetParametersViaLayout() throws Throwable {
    TestActivity activity = getActivity();
    assertNotNull(activity);

    runAndBlockOnUiThread(0, new Runnable() {
        @Override
        public void run() {
            getActivity().setContentToLayout(R.layout.place_picker_test_layout_1, R.id.place_picker_fragment);
        }
    });

    final PlacePickerFragment fragment = activity.getFragment();
    assertNotNull(fragment);

    assertEquals(false, fragment.getShowPictures());
    assertEquals(75, fragment.getRadiusInMeters());
    assertEquals(5, fragment.getResultsLimit());
    assertEquals("coffee", fragment.getSearchText());
    Collection<String> extraFields = fragment.getExtraFields();
    assertTrue(extraFields.contains("checkins"));
    assertTrue(extraFields.contains("general_info"));
    // It doesn't make sense to specify location via layout, so we don't support it.
}
项目:facebook-android-sdk    文件:FriendPickerFragmentTests.java   
@MediumTest
@LargeTest
public void testCanSetParametersViaLayout() throws Throwable {
    TestActivity activity = getActivity();
    assertNotNull(activity);

    runAndBlockOnUiThread(0, new Runnable() {
        @Override
        public void run() {
            getActivity().setContentToLayout(R.layout.friend_picker_test_layout_1, R.id.friend_picker_fragment);
        }
    });

    final FriendPickerFragment fragment = activity.getFragment();
    assertNotNull(fragment);

    assertEquals(false, fragment.getShowPictures());
    assertEquals(false, fragment.getMultiSelect());
    Collection<String> extraFields = fragment.getExtraFields();
    assertTrue(extraFields.contains("middle_name"));
    assertTrue(extraFields.contains("link"));
    // It doesn't make sense to specify user id via layout, so we don't support it.
}