diff options
author | pavely@chromium.org <pavely@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-31 01:02:08 +0000 |
---|---|---|
committer | pavely@chromium.org <pavely@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-31 01:02:08 +0000 |
commit | 0ed0d29439f7ce9229ca3b9061f5795b710febf7 (patch) | |
tree | 6ca4fdca22eee8edadb4107458f5527ff5f64364 /google_apis | |
parent | 5a0e61be29b1860fd64bcaee06e56bc48da78e56 (diff) | |
download | chromium_src-0ed0d29439f7ce9229ca3b9061f5795b710febf7.zip chromium_src-0ed0d29439f7ce9229ca3b9061f5795b710febf7.tar.gz chromium_src-0ed0d29439f7ce9229ca3b9061f5795b710febf7.tar.bz2 |
Remove GaiaAuthFetcher::StartCookieForOAuthCodeExchange.
It is not used anywhere.
R=rogerta@chromium.org
BUG=
Review URL: https://codereview.chromium.org/301323003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273968 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis')
-rw-r--r-- | google_apis/gaia/gaia_auth_consumer.h | 3 | ||||
-rw-r--r-- | google_apis/gaia/gaia_auth_fetcher.cc | 21 | ||||
-rw-r--r-- | google_apis/gaia/gaia_auth_fetcher.h | 12 | ||||
-rw-r--r-- | google_apis/gaia/gaia_auth_fetcher_unittest.cc | 52 |
4 files changed, 3 insertions, 85 deletions
diff --git a/google_apis/gaia/gaia_auth_consumer.h b/google_apis/gaia/gaia_auth_consumer.h index 4dfabf7..d5ab306 100644 --- a/google_apis/gaia/gaia_auth_consumer.h +++ b/google_apis/gaia/gaia_auth_consumer.h @@ -72,9 +72,6 @@ class GaiaAuthConsumer { virtual void OnClientOAuthSuccess(const ClientOAuthResult& result) {} virtual void OnClientOAuthFailure(const GoogleServiceAuthError& error) {} - virtual void OnClientOAuthCodeSuccess(const std::string& auth_code) {} - virtual void OnClientOAuthCodeFailure(const GoogleServiceAuthError& error) {} - virtual void OnOAuth2RevokeTokenCompleted() {} virtual void OnGetUserInfoSuccess(const UserInfoMap& data) {} diff --git a/google_apis/gaia/gaia_auth_fetcher.cc b/google_apis/gaia/gaia_auth_fetcher.cc index 4e21fd7..f0494ab 100644 --- a/google_apis/gaia/gaia_auth_fetcher.cc +++ b/google_apis/gaia/gaia_auth_fetcher.cc @@ -183,8 +183,7 @@ GaiaAuthFetcher::GaiaAuthFetcher(GaiaAuthConsumer* consumer, list_accounts_gurl_(GaiaUrls::GetInstance()->list_accounts_url()), client_login_to_oauth2_gurl_( GaiaUrls::GetInstance()->client_login_to_oauth2_url()), - fetch_pending_(false), - fetch_code_only_(false) {} + fetch_pending_(false) {} GaiaAuthFetcher::~GaiaAuthFetcher() {} @@ -544,13 +543,6 @@ void GaiaAuthFetcher::StartRevokeOAuth2Token(const std::string& auth_token) { fetcher_->Start(); } -void GaiaAuthFetcher::StartCookieForOAuthCodeExchange( - const std::string& session_index) { - // Same as the first step of StartCookieForOAuthLoginTokenExchange; - StartCookieForOAuthLoginTokenExchange(session_index); - fetch_code_only_ = true; -} - void GaiaAuthFetcher::StartCookieForOAuthLoginTokenExchange( const std::string& session_index) { DCHECK(!fetch_pending_) << "Tried to fetch two things at once!"; @@ -572,7 +564,6 @@ void GaiaAuthFetcher::StartCookieForOAuthLoginTokenExchange( net::LOAD_NORMAL, this)); fetch_pending_ = true; - fetch_code_only_ = false; fetcher_->Start(); } @@ -764,16 +755,10 @@ void GaiaAuthFetcher::OnClientLoginToOAuth2Fetched( if (status.is_success() && response_code == net::HTTP_OK) { std::string auth_code; ParseClientLoginToOAuth2Response(cookies, &auth_code); - if (fetch_code_only_) - consumer_->OnClientOAuthCodeSuccess(auth_code); - else - StartAuthCodeForOAuth2TokenExchange(auth_code); + StartAuthCodeForOAuth2TokenExchange(auth_code); } else { GoogleServiceAuthError auth_error(GenerateAuthError(data, status)); - if (fetch_code_only_) - consumer_->OnClientOAuthCodeFailure(auth_error); - else - consumer_->OnClientOAuthFailure(auth_error); + consumer_->OnClientOAuthFailure(auth_error); } } diff --git a/google_apis/gaia/gaia_auth_fetcher.h b/google_apis/gaia/gaia_auth_fetcher.h index 3dfb4baa..0864f18 100644 --- a/google_apis/gaia/gaia_auth_fetcher.h +++ b/google_apis/gaia/gaia_auth_fetcher.h @@ -107,15 +107,6 @@ class GaiaAuthFetcher : public net::URLFetcherDelegate { void StartRevokeOAuth2Token(const std::string& auth_token); // Start a request to exchange the cookies of a signed-in user session - // for an OAuth2 authorization code. In the case of a session with - // multiple accounts signed in, |session_index| indicate the which of accounts - // within the session. - // - // Either OnClientOAuthCodeSuccess or OnClientOAuthCodeFailure will be - // called on the consumer on the original thread. - void StartCookieForOAuthCodeExchange(const std::string& session_index); - - // Start a request to exchange the cookies of a signed-in user session // for an OAuthLogin-scoped oauth2 token. In the case of a session with // multiple accounts signed in, |session_index| indicate the which of accounts // within the session. @@ -383,9 +374,6 @@ class GaiaAuthFetcher : public net::URLFetcherDelegate { std::string request_body_; std::string requested_service_; // Currently tracked for IssueAuthToken only. bool fetch_pending_; - // This is to distinguish between the fetch for oauth login token and that for - // oauth code. - bool fetch_code_only_; friend class GaiaAuthFetcherTest; FRIEND_TEST_ALL_PREFIXES(GaiaAuthFetcherTest, CaptchaParse); diff --git a/google_apis/gaia/gaia_auth_fetcher_unittest.cc b/google_apis/gaia/gaia_auth_fetcher_unittest.cc index 9d2f60a..af235df 100644 --- a/google_apis/gaia/gaia_auth_fetcher_unittest.cc +++ b/google_apis/gaia/gaia_auth_fetcher_unittest.cc @@ -175,8 +175,6 @@ class MockGaiaConsumer : public GaiaAuthConsumer { const std::string& token)); MOCK_METHOD1(OnClientOAuthSuccess, void(const GaiaAuthConsumer::ClientOAuthResult& result)); - MOCK_METHOD1(OnClientOAuthCodeSuccess, - void(const std::string& result)); MOCK_METHOD1(OnMergeSessionSuccess, void(const std::string& data)); MOCK_METHOD1(OnUberAuthTokenSuccess, void(const std::string& data)); MOCK_METHOD1(OnClientLoginFailure, @@ -185,8 +183,6 @@ class MockGaiaConsumer : public GaiaAuthConsumer { const GoogleServiceAuthError& error)); MOCK_METHOD1(OnClientOAuthFailure, void(const GoogleServiceAuthError& error)); - MOCK_METHOD1(OnClientOAuthCodeFailure, - void(const GoogleServiceAuthError& error)); MOCK_METHOD1(OnMergeSessionFailure, void( const GoogleServiceAuthError& error)); MOCK_METHOD1(OnUberAuthTokenFailure, void( @@ -632,54 +628,6 @@ TEST_F(GaiaAuthFetcherTest, OAuthLoginTokenOAuth2TokenPairFailure) { EXPECT_FALSE(auth.HasPendingFetch()); } -TEST_F(GaiaAuthFetcherTest, OAuthCodeWithCookiesSuccess) { - MockGaiaConsumer consumer; - EXPECT_CALL(consumer, OnClientOAuthCodeSuccess("test-code")).Times(1); - - net::TestURLFetcherFactory factory; - GaiaAuthFetcher auth(&consumer, std::string(), GetRequestContext()); - auth.StartCookieForOAuthCodeExchange(""); - - net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); - EXPECT_TRUE(NULL != fetcher); - EXPECT_EQ(net::LOAD_NORMAL, fetcher->GetLoadFlags()); - EXPECT_TRUE(auth.HasPendingFetch()); - - net::ResponseCookies cookies; - cookies.push_back(kGetAuthCodeValidCookie); - MockFetcher mock_fetcher( - client_login_to_oauth2_source_, - net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0), - net::HTTP_OK, - cookies, - std::string(), - net::URLFetcher::POST, - &auth); - auth.OnURLFetchComplete(&mock_fetcher); - EXPECT_FALSE(auth.HasPendingFetch()); -} - -TEST_F(GaiaAuthFetcherTest, OAuthCodeWithCookiesFailure) { - MockGaiaConsumer consumer; - EXPECT_CALL(consumer, OnClientOAuthCodeFailure(_)).Times(1); - - GaiaAuthFetcher auth(&consumer, std::string(), GetRequestContext()); - auth.StartCookieForOAuthCodeExchange(""); - - EXPECT_TRUE(auth.HasPendingFetch()); - net::ResponseCookies cookies; - MockFetcher mock_fetcher( - client_login_to_oauth2_source_, - net::URLRequestStatus(net::URLRequestStatus::SUCCESS, 0), - net::HTTP_FORBIDDEN, - cookies, - std::string(), - net::URLFetcher::POST, - &auth); - auth.OnURLFetchComplete(&mock_fetcher); - EXPECT_FALSE(auth.HasPendingFetch()); -} - TEST_F(GaiaAuthFetcherTest, MergeSessionSuccess) { MockGaiaConsumer consumer; EXPECT_CALL(consumer, OnMergeSessionSuccess("<html></html>")) |