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

Side by Side Diff: components/browser_sync/browser/profile_sync_service_unittest.cc

Issue 2044303004: Sync: Support multiple setup UIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android Created 4 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/browser_sync/browser/profile_sync_service.h" 5 #include "components/browser_sync/browser/profile_sync_service.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 417
418 // Verify that the SetSetupInProgress function call updates state 418 // Verify that the SetSetupInProgress function call updates state
419 // and notifies observers. 419 // and notifies observers.
420 TEST_F(ProfileSyncServiceTest, SetupInProgress) { 420 TEST_F(ProfileSyncServiceTest, SetupInProgress) {
421 CreateService(ProfileSyncService::AUTO_START); 421 CreateService(ProfileSyncService::AUTO_START);
422 InitializeForFirstSync(); 422 InitializeForFirstSync();
423 423
424 TestSyncServiceObserver observer(service()); 424 TestSyncServiceObserver observer(service());
425 service()->AddObserver(&observer); 425 service()->AddObserver(&observer);
426 426
427 service()->SetSetupInProgress(true); 427 auto setup_handle = service()->GetSetupInProgressHandle();
428 EXPECT_TRUE(observer.setup_in_progress()); 428 EXPECT_TRUE(observer.setup_in_progress());
429 service()->SetSetupInProgress(false); 429 setup_handle.reset();
430 EXPECT_FALSE(observer.setup_in_progress()); 430 EXPECT_FALSE(observer.setup_in_progress());
431 431
432 service()->RemoveObserver(&observer); 432 service()->RemoveObserver(&observer);
433 } 433 }
434 434
435 // Verify that disable by enterprise policy works. 435 // Verify that disable by enterprise policy works.
436 TEST_F(ProfileSyncServiceTest, DisabledByPolicyBeforeInit) { 436 TEST_F(ProfileSyncServiceTest, DisabledByPolicyBeforeInit) {
437 prefs()->SetManagedPref(sync_driver::prefs::kSyncManaged, 437 prefs()->SetManagedPref(sync_driver::prefs::kSyncManaged,
438 new base::FundamentalValue(true)); 438 new base::FundamentalValue(true));
439 IssueTestTokens(); 439 IssueTestTokens();
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if 944 // dereferenced in OnSyncCycleCompleted. The fix is to use find() to check if
945 // entry for sessions exists in map. 945 // entry for sessions exists in map.
946 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) { 946 TEST_F(ProfileSyncServiceTest, ValidPointersInDTCMap) {
947 CreateService(ProfileSyncService::AUTO_START); 947 CreateService(ProfileSyncService::AUTO_START);
948 service()->OnSessionRestoreComplete(); 948 service()->OnSessionRestoreComplete();
949 service()->OnSyncCycleCompleted(); 949 service()->OnSyncCycleCompleted();
950 } 950 }
951 951
952 } // namespace 952 } // namespace
953 } // namespace browser_sync 953 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698