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

Side by Side Diff: chrome/browser/sync/sync_prefs_unittest.cc

Issue 8334030: Merge search engines sync data type with Preferences. Sync the default search provider. Add some ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Merge to TOT and fixed additional conflicts from rsimha. Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/sync/sync_prefs.cc ('k') | chrome/browser/sync/sync_setup_flow.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/sync_prefs.h" 5 #include "chrome/browser/sync/sync_prefs.h"
6 6
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "chrome/browser/sync/syncable/model_type.h" 8 #include "chrome/browser/sync/syncable/model_type.h"
9 #include "chrome/test/base/testing_pref_service.h" 9 #include "chrome/test/base/testing_pref_service.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 23 matching lines...) Expand all
34 all_types.insert(type); 34 all_types.insert(type);
35 } 35 }
36 all_types.erase(syncable::NIGORI); 36 all_types.erase(syncable::NIGORI);
37 return all_types; 37 return all_types;
38 } 38 }
39 39
40 // Returns all types visible from the setup UI. 40 // Returns all types visible from the setup UI.
41 syncable::ModelTypeSet GetUserVisibleTypes() { 41 syncable::ModelTypeSet GetUserVisibleTypes() {
42 syncable::ModelTypeSet user_visible_types(GetNonPassiveTypes()); 42 syncable::ModelTypeSet user_visible_types(GetNonPassiveTypes());
43 user_visible_types.erase(syncable::AUTOFILL_PROFILE); 43 user_visible_types.erase(syncable::AUTOFILL_PROFILE);
44 user_visible_types.erase(syncable::SEARCH_ENGINES);
44 user_visible_types.erase(syncable::APP_NOTIFICATIONS); 45 user_visible_types.erase(syncable::APP_NOTIFICATIONS);
45 return user_visible_types; 46 return user_visible_types;
46 } 47 }
47 48
48 TEST_F(SyncPrefsTest, Basic) { 49 TEST_F(SyncPrefsTest, Basic) {
49 SyncPrefs sync_prefs(&pref_service_); 50 SyncPrefs sync_prefs(&pref_service_);
50 51
51 EXPECT_FALSE(sync_prefs.HasSyncSetupCompleted()); 52 EXPECT_FALSE(sync_prefs.HasSyncSetupCompleted());
52 sync_prefs.SetSyncSetupCompleted(); 53 sync_prefs.SetSyncSetupCompleted();
53 EXPECT_TRUE(sync_prefs.HasSyncSetupCompleted()); 54 EXPECT_TRUE(sync_prefs.HasSyncSetupCompleted());
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 sync_prefs.GetPreferredDataTypes(non_passive_types)); 104 sync_prefs.GetPreferredDataTypes(non_passive_types));
104 const syncable::ModelTypeSet& user_visible_types = GetUserVisibleTypes(); 105 const syncable::ModelTypeSet& user_visible_types = GetUserVisibleTypes();
105 for (syncable::ModelTypeSet::const_iterator it = user_visible_types.begin(); 106 for (syncable::ModelTypeSet::const_iterator it = user_visible_types.begin();
106 it != user_visible_types.end(); ++it) { 107 it != user_visible_types.end(); ++it) {
107 syncable::ModelTypeSet preferred_types; 108 syncable::ModelTypeSet preferred_types;
108 preferred_types.insert(*it); 109 preferred_types.insert(*it);
109 syncable::ModelTypeSet expected_preferred_types(preferred_types); 110 syncable::ModelTypeSet expected_preferred_types(preferred_types);
110 if (*it == syncable::AUTOFILL) { 111 if (*it == syncable::AUTOFILL) {
111 expected_preferred_types.insert(syncable::AUTOFILL_PROFILE); 112 expected_preferred_types.insert(syncable::AUTOFILL_PROFILE);
112 } 113 }
114 if (*it == syncable::PREFERENCES) {
115 expected_preferred_types.insert(syncable::SEARCH_ENGINES);
116 }
113 if (*it == syncable::APPS) { 117 if (*it == syncable::APPS) {
114 expected_preferred_types.insert(syncable::APP_NOTIFICATIONS); 118 expected_preferred_types.insert(syncable::APP_NOTIFICATIONS);
115 } 119 }
116 sync_prefs.SetPreferredDataTypes(non_passive_types, preferred_types); 120 sync_prefs.SetPreferredDataTypes(non_passive_types, preferred_types);
117 EXPECT_EQ(expected_preferred_types, 121 EXPECT_EQ(expected_preferred_types,
118 sync_prefs.GetPreferredDataTypes(non_passive_types)); 122 sync_prefs.GetPreferredDataTypes(non_passive_types));
119 } 123 }
120 } 124 }
121 125
122 TEST_F(SyncPrefsTest, MaxInvalidationVersions) { 126 TEST_F(SyncPrefsTest, MaxInvalidationVersions) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 const syncable::ModelTypeSet& non_passive_types = GetNonPassiveTypes(); 228 const syncable::ModelTypeSet& non_passive_types = GetNonPassiveTypes();
225 EXPECT_TRUE(sync_prefs.GetPreferredDataTypes(non_passive_types).empty()); 229 EXPECT_TRUE(sync_prefs.GetPreferredDataTypes(non_passive_types).empty());
226 EXPECT_FALSE(sync_prefs.IsManaged()); 230 EXPECT_FALSE(sync_prefs.IsManaged());
227 EXPECT_TRUE(sync_prefs.GetEncryptionBootstrapToken().empty()); 231 EXPECT_TRUE(sync_prefs.GetEncryptionBootstrapToken().empty());
228 EXPECT_TRUE(sync_prefs.GetAllMaxVersions().empty()); 232 EXPECT_TRUE(sync_prefs.GetAllMaxVersions().empty());
229 } 233 }
230 234
231 } // namespace 235 } // namespace
232 236
233 } // namespace browser_sync 237 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_prefs.cc ('k') | chrome/browser/sync/sync_setup_flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698