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

Side by Side Diff: components/signin/core/browser/account_tracker_service_unittest.cc

Issue 2817723002: Revert of Reimplement AccountManagerHelper singleton instance creation (Closed)
Patch Set: Created 3 years, 8 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 <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"
19 #include "components/signin/core/browser/fake_account_fetcher_service.h" 18 #include "components/signin/core/browser/fake_account_fetcher_service.h"
20 #include "components/signin/core/browser/test_signin_client.h" 19 #include "components/signin/core/browser/test_signin_client.h"
21 #include "components/signin/core/common/signin_pref_names.h" 20 #include "components/signin/core/common/signin_pref_names.h"
22 #include "google_apis/gaia/fake_oauth2_token_service.h" 21 #include "google_apis/gaia/fake_oauth2_token_service.h"
23 #include "google_apis/gaia/gaia_oauth_client.h" 22 #include "google_apis/gaia/gaia_oauth_client.h"
24 #include "net/http/http_status_code.h" 23 #include "net/http/http_status_code.h"
25 #include "net/url_request/test_url_fetcher_factory.h" 24 #include "net/url_request/test_url_fetcher_factory.h"
26 #include "net/url_request/url_fetcher_delegate.h" 25 #include "net/url_request/url_fetcher_delegate.h"
27 #include "net/url_request/url_request_test_util.h" 26 #include "net/url_request/url_request_test_util.h"
28 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 248
250 } // namespace 249 } // namespace
251 250
252 class AccountTrackerServiceTest : public testing::Test { 251 class AccountTrackerServiceTest : public testing::Test {
253 public: 252 public:
254 AccountTrackerServiceTest() {} 253 AccountTrackerServiceTest() {}
255 254
256 ~AccountTrackerServiceTest() override {} 255 ~AccountTrackerServiceTest() override {}
257 256
258 void SetUp() override { 257 void SetUp() override {
259 ChildAccountInfoFetcher::InitializeForTests();
260
261 fake_oauth2_token_service_.reset(new FakeOAuth2TokenService()); 258 fake_oauth2_token_service_.reset(new FakeOAuth2TokenService());
262 259
263 pref_service_.registry()->RegisterListPref( 260 pref_service_.registry()->RegisterListPref(
264 AccountTrackerService::kAccountInfoPref); 261 AccountTrackerService::kAccountInfoPref);
265 pref_service_.registry()->RegisterIntegerPref( 262 pref_service_.registry()->RegisterIntegerPref(
266 prefs::kAccountIdMigrationState, 263 prefs::kAccountIdMigrationState,
267 AccountTrackerService::MIGRATION_NOT_STARTED); 264 AccountTrackerService::MIGRATION_NOT_STARTED);
268 pref_service_.registry()->RegisterInt64Pref( 265 pref_service_.registry()->RegisterInt64Pref(
269 AccountFetcherService::kLastUpdatePref, 0); 266 AccountFetcherService::kLastUpdatePref, 0);
270 signin_client_.reset(new TestSigninClient(&pref_service_)); 267 signin_client_.reset(new TestSigninClient(&pref_service_));
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1212 ASSERT_FALSE(info.is_child_account); 1209 ASSERT_FALSE(info.is_child_account);
1213 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(UPDATED, child_id))); 1210 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(UPDATED, child_id)));
1214 1211
1215 SimulateTokenRevoked(child_id); 1212 SimulateTokenRevoked(child_id);
1216 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(REMOVED, child_id))); 1213 ASSERT_TRUE(observer.CheckEvents(TrackingEvent(REMOVED, child_id)));
1217 1214
1218 tracker.RemoveObserver(&observer); 1215 tracker.RemoveObserver(&observer);
1219 fetcher.Shutdown(); 1216 fetcher.Shutdown();
1220 tracker.Shutdown(); 1217 tracker.Shutdown();
1221 } 1218 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698