OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/extensions/api/identity/account_tracker.h" | 5 #include "chrome/browser/extensions/api/identity/account_tracker.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 11 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
| 12 #include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h" |
12 #include "chrome/browser/signin/fake_signin_manager.h" | 13 #include "chrome/browser/signin/fake_signin_manager.h" |
13 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
14 #include "chrome/browser/signin/signin_manager_base.h" | 15 #include "chrome/browser/signin/signin_manager_base.h" |
15 #include "chrome/browser/signin/signin_manager_factory.h" | 16 #include "chrome/browser/signin/signin_manager_factory.h" |
16 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
17 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
18 #include "content/public/test/test_browser_thread_bundle.h" | 19 #include "content/public/test/test_browser_thread_bundle.h" |
19 #include "google_apis/gaia/gaia_oauth_client.h" | 20 #include "google_apis/gaia/gaia_oauth_client.h" |
20 #include "net/http/http_status_code.h" | 21 #include "net/http/http_status_code.h" |
21 #include "net/url_request/test_url_fetcher_factory.h" | 22 #include "net/url_request/test_url_fetcher_factory.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 205 |
205 class IdentityAccountTrackerTest : public testing::Test { | 206 class IdentityAccountTrackerTest : public testing::Test { |
206 public: | 207 public: |
207 IdentityAccountTrackerTest() {} | 208 IdentityAccountTrackerTest() {} |
208 | 209 |
209 virtual ~IdentityAccountTrackerTest() {} | 210 virtual ~IdentityAccountTrackerTest() {} |
210 | 211 |
211 virtual void SetUp() OVERRIDE { | 212 virtual void SetUp() OVERRIDE { |
212 TestingProfile::Builder builder; | 213 TestingProfile::Builder builder; |
213 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), | 214 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), |
214 FakeProfileOAuth2TokenService::Build); | 215 FakeProfileOAuth2TokenServiceWrapper::Build); |
215 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), | 216 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), |
216 FakeSigninManagerBase::Build); | 217 FakeSigninManagerBase::Build); |
217 | 218 |
218 test_profile_ = builder.Build(); | 219 test_profile_ = builder.Build(); |
219 | 220 |
220 fake_oauth2_token_service_ = static_cast<FakeProfileOAuth2TokenService*>( | 221 fake_oauth2_token_service_ = static_cast<FakeProfileOAuth2TokenService*>( |
221 ProfileOAuth2TokenServiceFactory::GetForProfile(test_profile_.get())); | 222 ProfileOAuth2TokenServiceFactory::GetForProfile(test_profile_.get())); |
222 | 223 |
223 SigninManagerBase* signin_manager = | 224 SigninManagerBase* signin_manager = |
224 SigninManagerFactory::GetForProfile(test_profile_.get()); | 225 SigninManagerFactory::GetForProfile(test_profile_.get()); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 EXPECT_TRUE(observer()->CheckEvents()); | 505 EXPECT_TRUE(observer()->CheckEvents()); |
505 | 506 |
506 NotifyTokenAvailable("user@example.com"); | 507 NotifyTokenAvailable("user@example.com"); |
507 ReturnOAuthUrlFetchSuccess("user@example.com"); | 508 ReturnOAuthUrlFetchSuccess("user@example.com"); |
508 EXPECT_TRUE(observer()->CheckEvents( | 509 EXPECT_TRUE(observer()->CheckEvents( |
509 TrackingEvent(ADDED, "user@example.com", kFakeGaiaId), | 510 TrackingEvent(ADDED, "user@example.com", kFakeGaiaId), |
510 TrackingEvent(SIGN_IN, "user@example.com", kFakeGaiaId))); | 511 TrackingEvent(SIGN_IN, "user@example.com", kFakeGaiaId))); |
511 } | 512 } |
512 | 513 |
513 } // namespace extensions | 514 } // namespace extensions |
OLD | NEW |