Commit 5c5277c2 authored by Reilly Grant's avatar Reilly Grant Committed by Commit Bot

Remove unused IssueAuthToken infrastucture

This GAIA method is unused. Removing the infrastructure for handling the
result of calling it.

Bug: 844982
Change-Id: I85598a2535346046e2f34a0f0126eca8a7acc70a
Reviewed-on: https://chromium-review.googlesource.com/1111115Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Reviewed-by: default avatarRoger Tawa <rogerta@chromium.org>
Commit-Queue: Reilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573487}
parent 32d15eec
......@@ -865,8 +865,6 @@ void SyncTest::SetupMockGaiaResponses() {
test_url_loader_factory_.AddResponse(
GaiaUrls::GetInstance()->get_user_info_url().spec(),
"email=user@gmail.com\ndisplayEmail=user@gmail.com");
test_url_loader_factory_.AddResponse(
GaiaUrls::GetInstance()->issue_auth_token_url().spec(), "auth");
test_url_loader_factory_.AddResponse(GoogleURLTracker::kSearchDomainCheckURL,
".google.com");
test_url_loader_factory_.AddResponse(
......
......@@ -93,11 +93,6 @@ class GaiaAuthConsumer {
virtual void OnClientLoginSuccess(const ClientLoginResult& result) {}
virtual void OnClientLoginFailure(const GoogleServiceAuthError& error) {}
virtual void OnIssueAuthTokenSuccess(const std::string& service,
const std::string& auth_token) {}
virtual void OnIssueAuthTokenFailure(const std::string& service,
const GoogleServiceAuthError& error) {}
virtual void OnClientOAuthCode(const std::string& auth_code) {}
virtual void OnClientOAuthSuccess(const ClientOAuthResult& result) {}
virtual void OnClientOAuthFailure(const GoogleServiceAuthError& error) {}
......
......@@ -210,7 +210,6 @@ GaiaAuthFetcher::GaiaAuthFetcher(GaiaAuthConsumer* consumer,
: consumer_(consumer),
getter_(getter),
source_(source),
issue_auth_token_gurl_(GaiaUrls::GetInstance()->issue_auth_token_url()),
oauth2_token_gurl_(GaiaUrls::GetInstance()->oauth2_token_url()),
oauth2_revoke_gurl_(GaiaUrls::GetInstance()->oauth2_revoke_url()),
get_user_info_gurl_(GaiaUrls::GetInstance()->get_user_info_url()),
......@@ -942,20 +941,6 @@ GoogleServiceAuthError GaiaAuthFetcher::GenerateAuthError(
return GoogleServiceAuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE);
}
void GaiaAuthFetcher::OnIssueAuthTokenFetched(
const std::string& data,
const net::URLRequestStatus& status,
int response_code) {
if (status.is_success() && response_code == net::HTTP_OK) {
// Only the bare token is returned in the body of this Gaia call
// without any padding.
consumer_->OnIssueAuthTokenSuccess(requested_service_, data);
} else {
consumer_->OnIssueAuthTokenFailure(requested_service_,
GenerateAuthError(data, status));
}
}
void GaiaAuthFetcher::OnClientLoginToOAuth2Fetched(
const std::string& data,
const net::ResponseCookies& cookies,
......@@ -1145,11 +1130,9 @@ void GaiaAuthFetcher::DispatchFetchedRequest(
const net::ResponseCookies& cookies,
const net::URLRequestStatus& status,
int response_code) {
if (url == issue_auth_token_gurl_) {
OnIssueAuthTokenFetched(data, status, response_code);
} else if (base::StartsWith(url.spec(),
deprecated_client_login_to_oauth2_gurl_.spec(),
base::CompareCase::SENSITIVE)) {
if (base::StartsWith(url.spec(),
deprecated_client_login_to_oauth2_gurl_.spec(),
base::CompareCase::SENSITIVE)) {
OnClientLoginToOAuth2Fetched(data, cookies, status, response_code);
} else if (url == oauth2_token_gurl_) {
OnOAuth2TokenPairFetched(data, status, response_code);
......
......@@ -52,22 +52,6 @@ class GaiaAuthFetcher : public net::URLFetcherDelegate {
net::URLRequestContextGetter* getter);
~GaiaAuthFetcher() override;
// Start a request to obtain |service| token for the the account identified by
// |uber_token|.
//
// Either OnIssueAuthTokenSuccess or OnIssueAuthTokenFailure will be
// called on the consumer on the original thread.
void StartTokenAuth(const std::string& uber_token,
const char* const service);
// Start a request to obtain service token for the the account identified by
// |oauth2_access_token| and the |service|.
//
// Either OnIssueAuthTokenSuccess or OnIssueAuthTokenFailure will be
// called on the consumer on the original thread.
void StartIssueAuthTokenForOAuth2(const std::string& oauth2_access_token,
const char* const service);
// Start a request to revoke |auth_token|.
//
// OnOAuth2RevokeTokenCompleted will be called on the consumer on the original
......@@ -284,10 +268,6 @@ class GaiaAuthFetcher : public net::URLFetcherDelegate {
static const char kClientLoginToOAuth2CookiePartCodePrefix[];
static const int kClientLoginToOAuth2CookiePartCodePrefixLength;
void OnIssueAuthTokenFetched(const std::string& data,
const net::URLRequestStatus& status,
int response_code);
void OnClientLoginToOAuth2Fetched(const std::string& data,
const net::ResponseCookies& cookies,
const net::URLRequestStatus& status,
......@@ -393,7 +373,6 @@ class GaiaAuthFetcher : public net::URLFetcherDelegate {
GaiaAuthConsumer* const consumer_;
net::URLRequestContextGetter* const getter_;
std::string source_;
const GURL issue_auth_token_gurl_;
const GURL oauth2_token_gurl_;
const GURL oauth2_revoke_gurl_;
const GURL get_user_info_gurl_;
......
......@@ -97,9 +97,7 @@ void MockFetcher::Start() {
class GaiaAuthFetcherTest : public testing::Test {
protected:
GaiaAuthFetcherTest()
: issue_auth_token_source_(
GaiaUrls::GetInstance()->issue_auth_token_url()),
client_login_to_oauth2_source_(
: client_login_to_oauth2_source_(
GaiaUrls::GetInstance()->deprecated_client_login_to_oauth2_url()),
oauth2_token_source_(GaiaUrls::GetInstance()->oauth2_token_url()),
token_auth_source_(GaiaUrls::GetInstance()->token_auth_url()),
......@@ -147,7 +145,6 @@ class GaiaAuthFetcherTest : public testing::Test {
EXPECT_EQ(captcha_token, out_captcha_token);
}
GURL issue_auth_token_source_;
GURL client_login_to_oauth2_source_;
GURL oauth2_token_source_;
GURL token_auth_source_;
......@@ -174,8 +171,6 @@ class MockGaiaConsumer : public GaiaAuthConsumer {
~MockGaiaConsumer() override {}
MOCK_METHOD1(OnClientLoginSuccess, void(const ClientLoginResult& result));
MOCK_METHOD2(OnIssueAuthTokenSuccess, void(const std::string& service,
const std::string& token));
MOCK_METHOD1(OnClientOAuthCode, void(const std::string& data));
MOCK_METHOD1(OnClientOAuthSuccess,
void(const GaiaAuthConsumer::ClientOAuthResult& result));
......@@ -183,8 +178,6 @@ class MockGaiaConsumer : public GaiaAuthConsumer {
MOCK_METHOD1(OnUberAuthTokenSuccess, void(const std::string& data));
MOCK_METHOD1(OnClientLoginFailure,
void(const GoogleServiceAuthError& error));
MOCK_METHOD2(OnIssueAuthTokenFailure, void(const std::string& service,
const GoogleServiceAuthError& error));
MOCK_METHOD1(OnClientOAuthFailure,
void(const GoogleServiceAuthError& error));
MOCK_METHOD1(OnOAuth2RevokeTokenCompleted,
......@@ -227,25 +220,6 @@ TEST_F(GaiaAuthFetcherTest, MAYBE_ErrorComparator) {
EXPECT_TRUE(expected_error == matching_error);
}
TEST_F(GaiaAuthFetcherTest, TokenNetFailure) {
int error_no = net::ERR_CONNECTION_RESET;
net::URLRequestStatus status(net::URLRequestStatus::FAILED, error_no);
GoogleServiceAuthError expected_error =
GoogleServiceAuthError::FromConnectionError(error_no);
MockGaiaConsumer consumer;
EXPECT_CALL(consumer, OnIssueAuthTokenFailure(_, expected_error))
.Times(1);
GaiaAuthFetcher auth(&consumer, std::string(), GetRequestContext());
MockFetcher mock_fetcher(issue_auth_token_source_, status, 0, std::string(),
net::URLFetcher::GET, &auth);
auth.OnURLFetchComplete(&mock_fetcher);
}
TEST_F(GaiaAuthFetcherTest, ParseRequest) {
RunParsingTest("SID=sid\nLSID=lsid\nAuth=auth\n", "sid", "lsid", "auth");
RunParsingTest("LSID=lsid\nSID=sid\nAuth=auth\n", "sid", "lsid", "auth");
......@@ -271,18 +245,6 @@ TEST_F(GaiaAuthFetcherTest, ParseErrorRequest) {
"CaptchaUrl=C\n", "E", "U", "C", "T");
}
TEST_F(GaiaAuthFetcherTest, WorkingIssueAuthToken) {
MockGaiaConsumer consumer;
EXPECT_CALL(consumer, OnIssueAuthTokenSuccess(_, "token"))
.Times(1);
GaiaAuthFetcher auth(&consumer, std::string(), GetRequestContext());
net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, 0);
MockFetcher mock_fetcher(issue_auth_token_source_, status, net::HTTP_OK,
"token", net::URLFetcher::GET, &auth);
auth.OnURLFetchComplete(&mock_fetcher);
}
TEST_F(GaiaAuthFetcherTest, CheckTwoFactorResponse) {
std::string response =
base::StringPrintf("Error=BadAuthentication\n%s\n",
......
......@@ -28,7 +28,6 @@ const char kEmbeddedSetupChromeOsUrlSuffixV2[] = "embedded/setup/v2/chromeos";
const char kSigninChromeSyncDice[] = "signin/chrome/sync?ssp=1";
const char kServiceLoginAuthUrlSuffix[] = "ServiceLoginAuth";
const char kServiceLogoutUrlSuffix[] = "Logout";
const char kIssueAuthTokenUrlSuffix[] = "IssueAuthToken";
const char kGetUserInfoUrlSuffix[] = "GetUserInfo";
const char kTokenAuthUrlSuffix[] = "TokenAuth";
const char kMergeSessionUrlSuffix[] = "MergeSession";
......@@ -109,7 +108,6 @@ GaiaUrls::GaiaUrls() {
signin_chrome_sync_dice_ = gaia_url_.Resolve(kSigninChromeSyncDice);
service_login_auth_url_ = gaia_url_.Resolve(kServiceLoginAuthUrlSuffix);
service_logout_url_ = gaia_url_.Resolve(kServiceLogoutUrlSuffix);
issue_auth_token_url_ = gaia_url_.Resolve(kIssueAuthTokenUrlSuffix);
get_user_info_url_ = gaia_url_.Resolve(kGetUserInfoUrlSuffix);
token_auth_url_ = gaia_url_.Resolve(kTokenAuthUrlSuffix);
merge_session_url_ = gaia_url_.Resolve(kMergeSessionUrlSuffix);
......@@ -187,10 +185,6 @@ const GURL& GaiaUrls::service_logout_url() const {
return service_logout_url_;
}
const GURL& GaiaUrls::issue_auth_token_url() const {
return issue_auth_token_url_;
}
const GURL& GaiaUrls::get_user_info_url() const {
return get_user_info_url_;
}
......
......@@ -26,7 +26,6 @@ class GaiaUrls {
const GURL& signin_chrome_sync_dice() const;
const GURL& service_login_auth_url() const;
const GURL& service_logout_url() const;
const GURL& issue_auth_token_url() const;
const GURL& get_user_info_url() const;
const GURL& token_auth_url() const;
const GURL& merge_session_url() const;
......@@ -77,7 +76,6 @@ class GaiaUrls {
GURL signin_chrome_sync_dice_;
GURL service_login_auth_url_;
GURL service_logout_url_;
GURL issue_auth_token_url_;
GURL get_user_info_url_;
GURL token_auth_url_;
GURL merge_session_url_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment