OLD | NEW |
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 <algorithm> | 5 #include <algorithm> |
6 #include <memory> | 6 #include <memory> |
7 #include <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "components/prefs/pref_registry_simple.h" | 12 #include "components/prefs/pref_registry_simple.h" |
13 #include "components/prefs/scoped_user_pref_update.h" | 13 #include "components/prefs/scoped_user_pref_update.h" |
14 #include "components/prefs/testing_pref_service.h" | 14 #include "components/prefs/testing_pref_service.h" |
15 #include "components/signin/core/browser/account_fetcher_service.h" | 15 #include "components/signin/core/browser/account_fetcher_service.h" |
16 #include "components/signin/core/browser/account_info.h" | 16 #include "components/signin/core/browser/account_info.h" |
17 #include "components/signin/core/browser/account_tracker_service.h" | 17 #include "components/signin/core/browser/account_tracker_service.h" |
| 18 #include "components/signin/core/browser/child_account_info_fetcher.h" |
18 #include "components/signin/core/browser/fake_account_fetcher_service.h" | 19 #include "components/signin/core/browser/fake_account_fetcher_service.h" |
19 #include "components/signin/core/browser/test_signin_client.h" | 20 #include "components/signin/core/browser/test_signin_client.h" |
20 #include "components/signin/core/common/signin_pref_names.h" | 21 #include "components/signin/core/common/signin_pref_names.h" |
21 #include "google_apis/gaia/fake_oauth2_token_service.h" | 22 #include "google_apis/gaia/fake_oauth2_token_service.h" |
22 #include "google_apis/gaia/gaia_oauth_client.h" | 23 #include "google_apis/gaia/gaia_oauth_client.h" |
23 #include "net/http/http_status_code.h" | 24 #include "net/http/http_status_code.h" |
24 #include "net/url_request/test_url_fetcher_factory.h" | 25 #include "net/url_request/test_url_fetcher_factory.h" |
25 #include "net/url_request/url_fetcher_delegate.h" | 26 #include "net/url_request/url_fetcher_delegate.h" |
26 #include "net/url_request/url_request_test_util.h" | 27 #include "net/url_request/url_request_test_util.h" |
27 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 249 |
249 } // namespace | 250 } // namespace |
250 | 251 |
251 class AccountTrackerServiceTest : public testing::Test { | 252 class AccountTrackerServiceTest : public testing::Test { |
252 public: | 253 public: |
253 AccountTrackerServiceTest() {} | 254 AccountTrackerServiceTest() {} |
254 | 255 |
255 ~AccountTrackerServiceTest() override {} | 256 ~AccountTrackerServiceTest() override {} |
256 | 257 |
257 void SetUp() override { | 258 void SetUp() override { |
| 259 ChildAccountInfoFetcher::InitializeForTests(); |
| 260 |
258 fake_oauth2_token_service_.reset(new FakeOAuth2TokenService()); | 261 fake_oauth2_token_service_.reset(new FakeOAuth2TokenService()); |
259 | 262 |
260 pref_service_.registry()->RegisterListPref( | 263 pref_service_.registry()->RegisterListPref( |
261 AccountTrackerService::kAccountInfoPref); | 264 AccountTrackerService::kAccountInfoPref); |
262 pref_service_.registry()->RegisterIntegerPref( | 265 pref_service_.registry()->RegisterIntegerPref( |
263 prefs::kAccountIdMigrationState, | 266 prefs::kAccountIdMigrationState, |
264 AccountTrackerService::MIGRATION_NOT_STARTED); | 267 AccountTrackerService::MIGRATION_NOT_STARTED); |
265 pref_service_.registry()->RegisterInt64Pref( | 268 pref_service_.registry()->RegisterInt64Pref( |
266 AccountFetcherService::kLastUpdatePref, 0); | 269 AccountFetcherService::kLastUpdatePref, 0); |
267 signin_client_.reset(new TestSigninClient(&pref_service_)); | 270 signin_client_.reset(new TestSigninClient(&pref_service_)); |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 ASSERT_FALSE(info.is_child_account); | 1212 ASSERT_FALSE(info.is_child_account); |
1210 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(UPDATED, child_id))); | 1213 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(UPDATED, child_id))); |
1211 | 1214 |
1212 SimulateTokenRevoked(child_id); | 1215 SimulateTokenRevoked(child_id); |
1213 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(REMOVED, child_id))); | 1216 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(REMOVED, child_id))); |
1214 | 1217 |
1215 tracker.RemoveObserver(&observer); | 1218 tracker.RemoveObserver(&observer); |
1216 fetcher.Shutdown(); | 1219 fetcher.Shutdown(); |
1217 tracker.Shutdown(); | 1220 tracker.Shutdown(); |
1218 } | 1221 } |
OLD | NEW |