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

Side by Side Diff: chrome/browser/sync/profile_sync_auth_provider_unittest.cc

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address final comments Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/run_loop.h" 5 #include "base/run_loop.h"
6 #include "chrome/browser/signin/account_tracker_service_factory.h" 6 #include "chrome/browser/signin/account_tracker_service_factory.h"
7 #include "chrome/browser/signin/chrome_signin_client_factory.h" 7 #include "chrome/browser/signin/chrome_signin_client_factory.h"
8 #include "chrome/browser/signin/fake_account_tracker_service.h" 8 #include "chrome/browser/signin/fake_account_tracker_service.h"
9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 9 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" 10 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h"
(...skipping 22 matching lines...) Expand all
33 builder.AddTestingFactory(AccountTrackerServiceFactory::GetInstance(), 33 builder.AddTestingFactory(AccountTrackerServiceFactory::GetInstance(),
34 FakeAccountTrackerService::Build); 34 FakeAccountTrackerService::Build);
35 builder.AddTestingFactory(ChromeSigninClientFactory::GetInstance(), 35 builder.AddTestingFactory(ChromeSigninClientFactory::GetInstance(),
36 signin::BuildTestSigninClient); 36 signin::BuildTestSigninClient);
37 37
38 profile_ = builder.Build(); 38 profile_ = builder.Build();
39 39
40 FakeProfileOAuth2TokenService* token_service = 40 FakeProfileOAuth2TokenService* token_service =
41 (FakeProfileOAuth2TokenService*) 41 (FakeProfileOAuth2TokenService*)
42 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); 42 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get());
43 token_service->IssueRefreshTokenForUser(kAccountId, "fake_refresh_token"); 43 token_service->UpdateCredentials(kAccountId, "fake_refresh_token");
44 44
45 auth_provider_frontend_.reset(new ProfileSyncAuthProvider( 45 auth_provider_frontend_.reset(new ProfileSyncAuthProvider(
46 token_service, kAccountId, GaiaConstants::kChromeSyncOAuth2Scope)); 46 token_service, kAccountId, GaiaConstants::kChromeSyncOAuth2Scope));
47 auth_provider_backend_ = 47 auth_provider_backend_ =
48 auth_provider_frontend_->CreateProviderForSyncThread().Pass(); 48 auth_provider_frontend_->CreateProviderForSyncThread().Pass();
49 } 49 }
50 50
51 void RequestTokenFinished(const GoogleServiceAuthError& error, 51 void RequestTokenFinished(const GoogleServiceAuthError& error,
52 const std::string& token) { 52 const std::string& token) {
53 issued_tokens_.push_back(token); 53 issued_tokens_.push_back(token);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 run_loop.RunUntilIdle(); 90 run_loop.RunUntilIdle();
91 EXPECT_EQ(2U, request_token_errors_.size()); 91 EXPECT_EQ(2U, request_token_errors_.size());
92 92
93 EXPECT_EQ("", issued_tokens_[0]); 93 EXPECT_EQ("", issued_tokens_[0]);
94 EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED, 94 EXPECT_EQ(GoogleServiceAuthError::REQUEST_CANCELED,
95 request_token_errors_[0].state()); 95 request_token_errors_[0].state());
96 96
97 EXPECT_NE("", issued_tokens_[1]); 97 EXPECT_NE("", issued_tokens_[1]);
98 EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(), request_token_errors_[1]); 98 EXPECT_EQ(GoogleServiceAuthError::AuthErrorNone(), request_token_errors_[1]);
99 } 99 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_auth_provider.cc ('k') | chrome/browser/sync/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698