Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2438)

Unified Diff: chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc

Issue 7574009: Added OAuth support to TokenService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc
diff --git a/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc b/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc
index 8d6ac02835d5e0978b0137e97e31684a011f7300..1a5d0aa6c0825c28f02b4879100bcbe83bb8f6ae 100644
--- a/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc
+++ b/chrome/browser/net/gaia/gaia_oauth_fetcher_unittest.cc
@@ -65,7 +65,7 @@ class MockGaiaOAuthConsumer : public GaiaOAuthConsumer {
void(const GoogleServiceAuthError& error));
MOCK_METHOD3(OnOAuthWrapBridgeSuccess,
- void(const std::string& service_name,
+ void(const std::string& service_scope,
const std::string& token,
const std::string& expires_in));
MOCK_METHOD1(OnOAuthWrapBridgeFailure,
@@ -80,21 +80,19 @@ class MockGaiaOAuthFetcher : public GaiaOAuthFetcher {
MockGaiaOAuthFetcher(GaiaOAuthConsumer* consumer,
net::URLRequestContextGetter* getter,
Profile* profile,
- const std::string& service_name,
const std::string& service_scope)
: GaiaOAuthFetcher(
- consumer, getter, profile, service_name, service_scope) {}
+ consumer, getter, profile, service_scope) {}
~MockGaiaOAuthFetcher() {}
MOCK_METHOD1(StartOAuthGetAccessToken,
void(const std::string& oauth1_request_token));
- MOCK_METHOD5(StartOAuthWrapBridge,
+ MOCK_METHOD4(StartOAuthWrapBridge,
void(const std::string& oauth1_access_token,
const std::string& oauth1_access_token_secret,
const std::string& wrap_token_duration,
- const std::string& service_name,
const std::string& oauth2_scope));
MOCK_METHOD1(StartUserInfo, void(const std::string& oauth2_access_token));
@@ -151,8 +149,9 @@ TEST(GaiaOAuthFetcherTest, GetOAuthToken) {
typedef TestingBrowserProcessTest GaiaOAuthFetcherTest;
TEST_F(GaiaOAuthFetcherTest, OAuthGetAccessToken) {
- const std::string oauth_token="1/OAuth1-Access_Token-1234567890abcdefghijklm";
- const std::string oauth_token_secret="Dont_tell_the_secret-123";
+ const std::string oauth_token =
+ "1/OAuth1-Access_Token-1234567890abcdefghijklm";
+ const std::string oauth_token_secret = "Dont_tell_the_secret-123";
const std::string data("oauth_token="
"1%2FOAuth1-Access_Token-1234567890abcdefghijklm"
"&oauth_token_secret=Dont_tell_the_secret-123");
@@ -166,13 +165,11 @@ TEST_F(GaiaOAuthFetcherTest, OAuthGetAccessToken) {
MockGaiaOAuthFetcher oauth_fetcher(&consumer,
profile.GetRequestContext(),
&profile,
- "service_name-eKARPyky",
"service_scope-JnG18MEE");
EXPECT_CALL(oauth_fetcher,
StartOAuthWrapBridge(oauth_token,
oauth_token_secret,
"3600",
- "service_name-eKARPyky",
"service_scope-JnG18MEE")).Times(1);
net::ResponseCookies cookies;
@@ -186,8 +183,9 @@ TEST_F(GaiaOAuthFetcherTest, OAuthGetAccessToken) {
}
TEST_F(GaiaOAuthFetcherTest, OAuthWrapBridge) {
- const std::string wrap_token="1/OAuth2-Access_Token-nopqrstuvwxyz1234567890";
- const std::string expires_in="3600";
+ const std::string wrap_token =
+ "1/OAuth2-Access_Token-nopqrstuvwxyz1234567890";
+ const std::string expires_in = "3600";
const std::string data("wrap_access_token="
"1%2FOAuth2-Access_Token-nopqrstuvwxyz1234567890"
@@ -195,7 +193,7 @@ TEST_F(GaiaOAuthFetcherTest, OAuthWrapBridge) {
MockGaiaOAuthConsumer consumer;
EXPECT_CALL(consumer,
- OnOAuthWrapBridgeSuccess("service_name-62Ykg3K1",
+ OnOAuthWrapBridgeSuccess("service_scope-0fL85iOi",
wrap_token,
expires_in)).Times(1);
@@ -203,7 +201,6 @@ TEST_F(GaiaOAuthFetcherTest, OAuthWrapBridge) {
MockGaiaOAuthFetcher oauth_fetcher(&consumer,
profile .GetRequestContext(),
&profile,
- "service_name-62Ykg3K1",
"service_scope-0fL85iOi");
EXPECT_CALL(oauth_fetcher, StartUserInfo(wrap_token)).Times(1);
@@ -218,9 +215,10 @@ TEST_F(GaiaOAuthFetcherTest, OAuthWrapBridge) {
}
TEST_F(GaiaOAuthFetcherTest, UserInfo) {
- const std::string email_address="someone@somewhere.net";
- const std::string wrap_token="1/OAuth2-Access_Token-nopqrstuvwxyz1234567890";
- const std::string expires_in="3600";
+ const std::string email_address = "someone@somewhere.net";
+ const std::string wrap_token =
+ "1/OAuth2-Access_Token-nopqrstuvwxyz1234567890";
+ const std::string expires_in = "3600";
const std::string data("{\n \"email\": \"someone@somewhere.net\",\n"
" \"verified_email\": true\n}\n");
MockGaiaOAuthConsumer consumer;
@@ -231,7 +229,6 @@ TEST_F(GaiaOAuthFetcherTest, UserInfo) {
MockGaiaOAuthFetcher oauth_fetcher(&consumer,
profile .GetRequestContext(),
&profile,
- "service_name-S2igVNUm",
"service_scope-Nrj4LmgU");
net::ResponseCookies cookies;

Powered by Google App Engine
This is Rietveld 408576698