diff options
author | machenbach@chromium.org <machenbach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-30 07:18:20 +0000 |
---|---|---|
committer | machenbach@chromium.org <machenbach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-30 07:18:20 +0000 |
commit | 31000efe5883fb405cdba88707ff3836424eb1ec (patch) | |
tree | 862775896475b60455cc5287cb19835f08fb5cf6 /google_apis/gaia/gaia_oauth_client_unittest.cc | |
parent | 87e9992419dd6218e99fe22590bafb2a584d96f4 (diff) | |
download | chromium_src-31000efe5883fb405cdba88707ff3836424eb1ec.zip chromium_src-31000efe5883fb405cdba88707ff3836424eb1ec.tar.gz chromium_src-31000efe5883fb405cdba88707ff3836424eb1ec.tar.bz2 |
Revert of Use new people.get api instead of oauth2/v1/userinfo. (https://codereview.chromium.org/257773002/)
Reason for revert:
[Sheriff]Speculative revert for breaking CrOS:
http://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromiumOS%20Tests%20%282%29/builds/23489
Will reland if it doesn't help.
Original issue's description:
> Use new people.get api instead of oauth2/v1/userinfo.
> Consolidate all uses into main helper class.
>
> Details about new api: https://developers.google.com/+/api/latest/people/get
>
> Format of returned response: https://developers.google.com/+/api/latest/people#resource
>
> BUG=320354
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=267068
TBR=atwilson@chromium.org,noms@chromium.org,guohui@chromium.org,gene@chromium.org,rogerta@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=320354
Review URL: https://codereview.chromium.org/265563002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267114 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis/gaia/gaia_oauth_client_unittest.cc')
-rw-r--r-- | google_apis/gaia/gaia_oauth_client_unittest.cc | 59 |
1 files changed, 14 insertions, 45 deletions
diff --git a/google_apis/gaia/gaia_oauth_client_unittest.cc b/google_apis/gaia/gaia_oauth_client_unittest.cc index 338578e..d4014f7 100644 --- a/google_apis/gaia/gaia_oauth_client_unittest.cc +++ b/google_apis/gaia/gaia_oauth_client_unittest.cc @@ -134,22 +134,25 @@ const std::string kTestUserId = "8675309"; const int kTestExpiresIn = 3920; const std::string kDummyGetTokensResult = - "{\"access_token\":\"" + kTestAccessToken + "\"," - "\"expires_in\":" + base::IntToString(kTestExpiresIn) + "," - "\"refresh_token\":\"" + kTestRefreshToken + "\"}"; + "{\"access_token\":\"" + kTestAccessToken + "\"," + "\"expires_in\":" + base::IntToString(kTestExpiresIn) + "," + "\"refresh_token\":\"" + kTestRefreshToken + "\"}"; const std::string kDummyRefreshTokenResult = - "{\"access_token\":\"" + kTestAccessToken + "\"," - "\"expires_in\":" + base::IntToString(kTestExpiresIn) + "}"; + "{\"access_token\":\"" + kTestAccessToken + "\"," + "\"expires_in\":" + base::IntToString(kTestExpiresIn) + "}"; + +const std::string kDummyUserInfoResult = + "{\"email\":\"" + kTestUserEmail + "\"}"; const std::string kDummyUserIdResult = - "{\"id\":\"" + kTestUserId + "\"}"; + "{\"id\":\"" + kTestUserId + "\"}"; const std::string kDummyTokenInfoResult = - "{\"issued_to\": \"1234567890.apps.googleusercontent.com\"," - "\"audience\": \"1234567890.apps.googleusercontent.com\"," - "\"scope\": \"https://googleapis.com/oauth2/v2/tokeninfo\"," - "\"expires_in\":" + base::IntToString(kTestExpiresIn) + "}"; + "{\"issued_to\": \"1234567890.apps.googleusercontent.com\"," + "\"audience\": \"1234567890.apps.googleusercontent.com\"," + "\"scope\": \"https://googleapis.com/oauth2/v2/tokeninfo\"," + "\"expires_in\":" + base::IntToString(kTestExpiresIn) + "}"; } namespace gaia { @@ -301,45 +304,11 @@ TEST_F(GaiaOAuthClientTest, RefreshTokenDownscopingSuccess) { factory.get_url_fetcher()->Finish(); } -TEST_F(GaiaOAuthClientTest, GetUserEmail) { - MockGaiaOAuthClientDelegate delegate; - EXPECT_CALL(delegate, OnGetUserEmailResponse(kTestUserEmail)).Times(1); - - const std::string kDummyUserInfoResult = - "{\"emails\": [{\"value\":\"" + kTestUserEmail + - "\", \"type\":\"account\"}]}"; - - MockOAuthFetcherFactory factory; - factory.set_results(kDummyUserInfoResult); - - GaiaOAuthClient auth(GetRequestContext()); - auth.GetUserEmail("access_token", 1, &delegate); -} -TEST_F(GaiaOAuthClientTest, GetUserEmailSecondItemValid) { +TEST_F(GaiaOAuthClientTest, GetUserEmail) { MockGaiaOAuthClientDelegate delegate; EXPECT_CALL(delegate, OnGetUserEmailResponse(kTestUserEmail)).Times(1); - const std::string kDummyUserInfoResult = - "{\"emails\": [{\"value\":\"foo\"}," - "{\"value\":\"" + kTestUserEmail + - "\", \"type\":\"account\"}]}"; - - MockOAuthFetcherFactory factory; - factory.set_results(kDummyUserInfoResult); - - GaiaOAuthClient auth(GetRequestContext()); - auth.GetUserEmail("access_token", 1, &delegate); -} - -TEST_F(GaiaOAuthClientTest, GetUserEmailNoValidItems) { - MockGaiaOAuthClientDelegate delegate; - EXPECT_CALL(delegate, OnNetworkError(_)).Times(1); - - const std::string kDummyUserInfoResult = - "{\"emails\": [{\"value\":\"" + kTestUserEmail + - "\", \"type\":\"foo\"}]}"; - MockOAuthFetcherFactory factory; factory.set_results(kDummyUserInfoResult); |