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

Side by Side Diff: chrome/browser/sync/test/integration/sync_errors_test.cc

Issue 534733002: Revert "[Sync] Move DataTypeStatusTable ownership into DataTypeManager." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 "base/prefs/pref_member.h" 5 #include "base/prefs/pref_member.h"
6 #include "base/prefs/pref_service.h" 6 #include "base/prefs/pref_service.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "chrome/browser/sync/profile_sync_service.h" 8 #include "chrome/browser/sync/profile_sync_service.h"
9 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" 9 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
10 #include "chrome/browser/sync/test/integration/passwords_helper.h" 10 #include "chrome/browser/sync/test/integration/passwords_helper.h"
(...skipping 19 matching lines...) Expand all
30 virtual bool IsExitConditionSatisfied() OVERRIDE { 30 virtual bool IsExitConditionSatisfied() OVERRIDE {
31 return !service()->setup_in_progress() && 31 return !service()->setup_in_progress() &&
32 !service()->HasSyncSetupCompleted(); 32 !service()->HasSyncSetupCompleted();
33 } 33 }
34 34
35 virtual std::string GetDebugMessage() const OVERRIDE { 35 virtual std::string GetDebugMessage() const OVERRIDE {
36 return "Sync Disabled"; 36 return "Sync Disabled";
37 } 37 }
38 }; 38 };
39 39
40 class TypeDisabledChecker : public SingleClientStatusChangeChecker {
41 public:
42 explicit TypeDisabledChecker(ProfileSyncService* service,
43 syncer::ModelType type)
44 : SingleClientStatusChangeChecker(service), type_(type) {}
45
46 virtual bool IsExitConditionSatisfied() OVERRIDE {
47 return !service()->GetActiveDataTypes().Has(type_);
48 }
49
50 virtual std::string GetDebugMessage() const OVERRIDE {
51 return "Type disabled";
52 }
53 private:
54 syncer::ModelType type_;
55 };
56
57 bool AwaitSyncDisabled(ProfileSyncService* service) { 40 bool AwaitSyncDisabled(ProfileSyncService* service) {
58 SyncDisabledChecker checker(service); 41 SyncDisabledChecker checker(service);
59 checker.Wait(); 42 checker.Wait();
60 return !checker.TimedOut(); 43 return !checker.TimedOut();
61 } 44 }
62 45
63 bool AwaitTypeDisabled(ProfileSyncService* service,
64 syncer::ModelType type) {
65 TypeDisabledChecker checker(service, type);
66 checker.Wait();
67 return !checker.TimedOut();
68 }
69
70 class SyncErrorTest : public SyncTest { 46 class SyncErrorTest : public SyncTest {
71 public: 47 public:
72 SyncErrorTest() : SyncTest(SINGLE_CLIENT) {} 48 SyncErrorTest() : SyncTest(SINGLE_CLIENT) {}
73 virtual ~SyncErrorTest() {} 49 virtual ~SyncErrorTest() {}
74 50
75 private: 51 private:
76 DISALLOW_COPY_AND_ASSIGN(SyncErrorTest); 52 DISALLOW_COPY_AND_ASSIGN(SyncErrorTest);
77 }; 53 };
78 54
79 // TODO(pvalenzuela): Remove this class when all tests here are converted to 55 // TODO(pvalenzuela): Remove this class when all tests here are converted to
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 196
221 IN_PROC_BROWSER_TEST_F(LegacySyncErrorTest, DisableDatatypeWhileRunning) { 197 IN_PROC_BROWSER_TEST_F(LegacySyncErrorTest, DisableDatatypeWhileRunning) {
222 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 198 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
223 syncer::ModelTypeSet synced_datatypes = 199 syncer::ModelTypeSet synced_datatypes =
224 GetSyncService((0))->GetActiveDataTypes(); 200 GetSyncService((0))->GetActiveDataTypes();
225 ASSERT_TRUE(synced_datatypes.Has(syncer::TYPED_URLS)); 201 ASSERT_TRUE(synced_datatypes.Has(syncer::TYPED_URLS));
226 ASSERT_TRUE(synced_datatypes.Has(syncer::SESSIONS)); 202 ASSERT_TRUE(synced_datatypes.Has(syncer::SESSIONS));
227 GetProfile(0)->GetPrefs()->SetBoolean( 203 GetProfile(0)->GetPrefs()->SetBoolean(
228 prefs::kSavingBrowserHistoryDisabled, true); 204 prefs::kSavingBrowserHistoryDisabled, true);
229 205
230 // Wait for reconfigurations. 206 // Flush any tasks posted by observers of the pref change.
231 ASSERT_TRUE(AwaitTypeDisabled(GetSyncService(0), syncer::TYPED_URLS)); 207 base::RunLoop().RunUntilIdle();
232 ASSERT_TRUE(AwaitTypeDisabled(GetSyncService(0), syncer::SESSIONS)); 208
209 synced_datatypes = GetSyncService((0))->GetActiveDataTypes();
210 ASSERT_FALSE(synced_datatypes.Has(syncer::TYPED_URLS));
211 ASSERT_FALSE(synced_datatypes.Has(syncer::SESSIONS));
233 212
234 const BookmarkNode* node1 = AddFolder(0, 0, "title1"); 213 const BookmarkNode* node1 = AddFolder(0, 0, "title1");
235 SetTitle(0, node1, "new_title1"); 214 SetTitle(0, node1, "new_title1");
236 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0)))); 215 ASSERT_TRUE(AwaitCommitActivityCompletion(GetSyncService((0))));
237 // TODO(lipalani)" Verify initial sync ended for typed url is false. 216 // TODO(lipalani)" Verify initial sync ended for typed url is false.
238 } 217 }
239 218
240 } // namespace 219 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service_unittest.cc ('k') | chrome/browser/sync/test_profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698