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

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

Issue 195873020: [Sync] Move SyncPrefs into sync_driver component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rerererebase Created 6 years, 9 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 | Annotate | Revision Log
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/values.h" 5 #include "base/values.h"
6 #include "chrome/browser/sync/test/integration/preferences_helper.h" 6 #include "chrome/browser/sync/test/integration/preferences_helper.h"
7 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 7 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
8 #include "chrome/browser/sync/test/integration/sync_test.h" 8 #include "chrome/browser/sync/test/integration/sync_test.h"
9 #include "chrome/browser/translate/translate_tab_helper.h" 9 #include "chrome/browser/translate/translate_tab_helper.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
11 #include "components/password_manager/core/common/password_manager_pref_names.h" 11 #include "components/password_manager/core/common/password_manager_pref_names.h"
12 #include "components/sync_driver/pref_names.h"
12 #include "components/translate/core/browser/translate_prefs.h" 13 #include "components/translate/core/browser/translate_prefs.h"
13 #include "components/translate/core/common/translate_pref_names.h" 14 #include "components/translate/core/common/translate_pref_names.h"
14 15
15 using preferences_helper::AppendStringPref; 16 using preferences_helper::AppendStringPref;
16 using preferences_helper::BooleanPrefMatches; 17 using preferences_helper::BooleanPrefMatches;
17 using preferences_helper::ChangeBooleanPref; 18 using preferences_helper::ChangeBooleanPref;
18 using preferences_helper::ChangeIntegerPref; 19 using preferences_helper::ChangeIntegerPref;
19 using preferences_helper::ChangeInt64Pref; 20 using preferences_helper::ChangeInt64Pref;
20 using preferences_helper::ChangeListPref; 21 using preferences_helper::ChangeListPref;
21 using preferences_helper::ChangeStringPref; 22 using preferences_helper::ChangeStringPref;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 69 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
69 ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled)); 70 ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled));
70 } 71 }
71 72
72 // TCM ID - 3699293. 73 // TCM ID - 3699293.
73 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, 74 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
74 kSyncKeepEverythingSynced) { 75 kSyncKeepEverythingSynced) {
75 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 76 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
76 DisableVerifier(); 77 DisableVerifier();
77 78
78 ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncKeepEverythingSynced)); 79 ASSERT_TRUE(
79 ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncThemes)); 80 BooleanPrefMatches(sync_driver::prefs::kSyncKeepEverythingSynced));
81 ASSERT_TRUE(BooleanPrefMatches(sync_driver::prefs::kSyncThemes));
80 82
81 GetClient(0)->DisableSyncForDatatype(syncer::THEMES); 83 GetClient(0)->DisableSyncForDatatype(syncer::THEMES);
82 ASSERT_FALSE(BooleanPrefMatches(prefs::kSyncKeepEverythingSynced)); 84 ASSERT_FALSE(
85 BooleanPrefMatches(sync_driver::prefs::kSyncKeepEverythingSynced));
83 } 86 }
84 87
85 // TCM ID - 3661290. 88 // TCM ID - 3661290.
86 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, DisablePreferences) { 89 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, DisablePreferences) {
87 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 90 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
88 DisableVerifier(); 91 DisableVerifier();
89 92
90 ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncPreferences)); 93 ASSERT_TRUE(BooleanPrefMatches(sync_driver::prefs::kSyncPreferences));
91 ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled)); 94 ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled));
92 95
93 GetClient(1)->DisableSyncForDatatype(syncer::PREFERENCES); 96 GetClient(1)->DisableSyncForDatatype(syncer::PREFERENCES);
94 ChangeBooleanPref(0, prefs::kPasswordManagerEnabled); 97 ChangeBooleanPref(0, prefs::kPasswordManagerEnabled);
95 ASSERT_TRUE(GetClient(0)->AwaitCommitActivityCompletion()); 98 ASSERT_TRUE(GetClient(0)->AwaitCommitActivityCompletion());
96 ASSERT_FALSE(BooleanPrefMatches(prefs::kPasswordManagerEnabled)); 99 ASSERT_FALSE(BooleanPrefMatches(prefs::kPasswordManagerEnabled));
97 100
98 GetClient(1)->EnableSyncForDatatype(syncer::PREFERENCES); 101 GetClient(1)->EnableSyncForDatatype(syncer::PREFERENCES);
99 ASSERT_TRUE(AwaitQuiescence()); 102 ASSERT_TRUE(AwaitQuiescence());
100 ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled)); 103 ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled));
101 } 104 }
102 105
103 // TCM ID - 3664292. 106 // TCM ID - 3664292.
104 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, DisableSync) { 107 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, DisableSync) {
105 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 108 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
106 DisableVerifier(); 109 DisableVerifier();
107 110
108 ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncPreferences)); 111 ASSERT_TRUE(BooleanPrefMatches(sync_driver::prefs::kSyncPreferences));
109 ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled)); 112 ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled));
110 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); 113 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
111 114
112 GetClient(1)->DisableSyncForAllDatatypes(); 115 GetClient(1)->DisableSyncForAllDatatypes();
113 ChangeBooleanPref(0, prefs::kPasswordManagerEnabled); 116 ChangeBooleanPref(0, prefs::kPasswordManagerEnabled);
114 ASSERT_TRUE(GetClient(0)->AwaitCommitActivityCompletion()); 117 ASSERT_TRUE(GetClient(0)->AwaitCommitActivityCompletion());
115 ASSERT_FALSE(BooleanPrefMatches(prefs::kPasswordManagerEnabled)); 118 ASSERT_FALSE(BooleanPrefMatches(prefs::kPasswordManagerEnabled));
116 119
117 ChangeBooleanPref(1, prefs::kShowHomeButton); 120 ChangeBooleanPref(1, prefs::kShowHomeButton);
118 ASSERT_FALSE(BooleanPrefMatches(prefs::kShowHomeButton)); 121 ASSERT_FALSE(BooleanPrefMatches(prefs::kShowHomeButton));
119 122
120 GetClient(1)->EnableSyncForAllDatatypes(); 123 GetClient(1)->EnableSyncForAllDatatypes();
121 ASSERT_TRUE(AwaitQuiescence()); 124 ASSERT_TRUE(AwaitQuiescence());
122 ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled)); 125 ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled));
123 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); 126 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
124 } 127 }
125 128
126 // TCM ID - 3604297. 129 // TCM ID - 3604297.
127 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, SignInDialog) { 130 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, SignInDialog) {
128 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 131 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
129 DisableVerifier(); 132 DisableVerifier();
130 133
131 ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncPreferences)); 134 ASSERT_TRUE(BooleanPrefMatches(sync_driver::prefs::kSyncPreferences));
132 ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncBookmarks)); 135 ASSERT_TRUE(BooleanPrefMatches(sync_driver::prefs::kSyncBookmarks));
133 ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncThemes)); 136 ASSERT_TRUE(BooleanPrefMatches(sync_driver::prefs::kSyncThemes));
134 ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncExtensions)); 137 ASSERT_TRUE(BooleanPrefMatches(sync_driver::prefs::kSyncExtensions));
135 ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncAutofill)); 138 ASSERT_TRUE(BooleanPrefMatches(sync_driver::prefs::kSyncAutofill));
136 ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncKeepEverythingSynced)); 139 ASSERT_TRUE(
140 BooleanPrefMatches(sync_driver::prefs::kSyncKeepEverythingSynced));
137 141
138 GetClient(0)->DisableSyncForDatatype(syncer::PREFERENCES); 142 GetClient(0)->DisableSyncForDatatype(syncer::PREFERENCES);
139 GetClient(1)->EnableSyncForDatatype(syncer::PREFERENCES); 143 GetClient(1)->EnableSyncForDatatype(syncer::PREFERENCES);
140 GetClient(0)->DisableSyncForDatatype(syncer::AUTOFILL); 144 GetClient(0)->DisableSyncForDatatype(syncer::AUTOFILL);
141 GetClient(1)->EnableSyncForDatatype(syncer::AUTOFILL); 145 GetClient(1)->EnableSyncForDatatype(syncer::AUTOFILL);
142 GetClient(0)->DisableSyncForDatatype(syncer::BOOKMARKS); 146 GetClient(0)->DisableSyncForDatatype(syncer::BOOKMARKS);
143 GetClient(1)->EnableSyncForDatatype(syncer::BOOKMARKS); 147 GetClient(1)->EnableSyncForDatatype(syncer::BOOKMARKS);
144 GetClient(0)->DisableSyncForDatatype(syncer::EXTENSIONS); 148 GetClient(0)->DisableSyncForDatatype(syncer::EXTENSIONS);
145 GetClient(1)->EnableSyncForDatatype(syncer::EXTENSIONS); 149 GetClient(1)->EnableSyncForDatatype(syncer::EXTENSIONS);
146 GetClient(0)->DisableSyncForDatatype(syncer::THEMES); 150 GetClient(0)->DisableSyncForDatatype(syncer::THEMES);
147 GetClient(1)->EnableSyncForDatatype(syncer::THEMES); 151 GetClient(1)->EnableSyncForDatatype(syncer::THEMES);
148 152
149 ASSERT_TRUE(AwaitQuiescence()); 153 ASSERT_TRUE(AwaitQuiescence());
150 154
151 ASSERT_FALSE(BooleanPrefMatches(prefs::kSyncPreferences)); 155 ASSERT_FALSE(BooleanPrefMatches(sync_driver::prefs::kSyncPreferences));
152 ASSERT_FALSE(BooleanPrefMatches(prefs::kSyncBookmarks)); 156 ASSERT_FALSE(BooleanPrefMatches(sync_driver::prefs::kSyncBookmarks));
153 ASSERT_FALSE(BooleanPrefMatches(prefs::kSyncThemes)); 157 ASSERT_FALSE(BooleanPrefMatches(sync_driver::prefs::kSyncThemes));
154 ASSERT_FALSE(BooleanPrefMatches(prefs::kSyncExtensions)); 158 ASSERT_FALSE(BooleanPrefMatches(sync_driver::prefs::kSyncExtensions));
155 ASSERT_FALSE(BooleanPrefMatches(prefs::kSyncAutofill)); 159 ASSERT_FALSE(BooleanPrefMatches(sync_driver::prefs::kSyncAutofill));
156 ASSERT_FALSE(BooleanPrefMatches(prefs::kSyncKeepEverythingSynced)); 160 ASSERT_FALSE(
161 BooleanPrefMatches(sync_driver::prefs::kSyncKeepEverythingSynced));
157 } 162 }
158 163
159 // TCM ID - 3666296. 164 // TCM ID - 3666296.
160 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, kShowBookmarkBar) { 165 IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, kShowBookmarkBar) {
161 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 166 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
162 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowBookmarkBar)); 167 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowBookmarkBar));
163 168
164 ChangeBooleanPref(0, prefs::kShowBookmarkBar); 169 ChangeBooleanPref(0, prefs::kShowBookmarkBar);
165 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 170 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
166 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowBookmarkBar)); 171 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowBookmarkBar));
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 602 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
598 ASSERT_TRUE(IsEncryptionComplete(0)); 603 ASSERT_TRUE(IsEncryptionComplete(0));
599 ASSERT_TRUE(IsEncryptionComplete(1)); 604 ASSERT_TRUE(IsEncryptionComplete(1));
600 ASSERT_TRUE(BooleanPrefMatches(prefs::kHomePageIsNewTabPage)); 605 ASSERT_TRUE(BooleanPrefMatches(prefs::kHomePageIsNewTabPage));
601 606
602 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); 607 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
603 ChangeBooleanPref(0, prefs::kShowHomeButton); 608 ChangeBooleanPref(0, prefs::kShowHomeButton);
604 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 609 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
605 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton)); 610 ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
606 } 611 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_prefs_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