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

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

Issue 9500005: Add a declarative way in c/b/s/sync_prefs.cc to say which data types have prefs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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
« no previous file with comments | « chrome/browser/sync/sync_prefs.cc ('k') | chrome/browser/ui/webui/sync_setup_handler.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/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/time.h" 8 #include "base/time.h"
9 #include "chrome/browser/sync/syncable/model_type.h" 9 #include "chrome/browser/sync/syncable/model_type.h"
10 #include "chrome/test/base/testing_pref_service.h" 10 #include "chrome/test/base/testing_pref_service.h"
(...skipping 18 matching lines...) Expand all
29 // Get all types with a user-facing component. 29 // Get all types with a user-facing component.
30 syncable::ModelTypeSet GetNonPassiveTypes() { 30 syncable::ModelTypeSet GetNonPassiveTypes() {
31 syncable::ModelTypeSet non_passive_types = syncable::ModelTypeSet::All(); 31 syncable::ModelTypeSet non_passive_types = syncable::ModelTypeSet::All();
32 non_passive_types.Remove(syncable::NIGORI); 32 non_passive_types.Remove(syncable::NIGORI);
33 return non_passive_types; 33 return non_passive_types;
34 } 34 }
35 35
36 // Returns all types visible from the setup UI. 36 // Returns all types visible from the setup UI.
37 syncable::ModelTypeSet GetUserVisibleTypes() { 37 syncable::ModelTypeSet GetUserVisibleTypes() {
38 syncable::ModelTypeSet user_visible_types(GetNonPassiveTypes()); 38 syncable::ModelTypeSet user_visible_types(GetNonPassiveTypes());
39 user_visible_types.Remove(syncable::APP_NOTIFICATIONS);
40 user_visible_types.Remove(syncable::APP_SETTINGS);
39 user_visible_types.Remove(syncable::AUTOFILL_PROFILE); 41 user_visible_types.Remove(syncable::AUTOFILL_PROFILE);
42 user_visible_types.Remove(syncable::EXTENSION_SETTINGS);
40 user_visible_types.Remove(syncable::SEARCH_ENGINES); 43 user_visible_types.Remove(syncable::SEARCH_ENGINES);
41 user_visible_types.Remove(syncable::APP_NOTIFICATIONS);
42 return user_visible_types; 44 return user_visible_types;
43 } 45 }
44 46
45 TEST_F(SyncPrefsTest, Basic) { 47 TEST_F(SyncPrefsTest, Basic) {
46 SyncPrefs sync_prefs(&pref_service_); 48 SyncPrefs sync_prefs(&pref_service_);
47 49
48 EXPECT_FALSE(sync_prefs.HasSyncSetupCompleted()); 50 EXPECT_FALSE(sync_prefs.HasSyncSetupCompleted());
49 sync_prefs.SetSyncSetupCompleted(); 51 sync_prefs.SetSyncSetupCompleted();
50 EXPECT_TRUE(sync_prefs.HasSyncSetupCompleted()); 52 EXPECT_TRUE(sync_prefs.HasSyncSetupCompleted());
51 53
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 preferred_types.Put(it.Get()); 107 preferred_types.Put(it.Get());
106 syncable::ModelTypeSet expected_preferred_types(preferred_types); 108 syncable::ModelTypeSet expected_preferred_types(preferred_types);
107 if (it.Get() == syncable::AUTOFILL) { 109 if (it.Get() == syncable::AUTOFILL) {
108 expected_preferred_types.Put(syncable::AUTOFILL_PROFILE); 110 expected_preferred_types.Put(syncable::AUTOFILL_PROFILE);
109 } 111 }
110 if (it.Get() == syncable::PREFERENCES) { 112 if (it.Get() == syncable::PREFERENCES) {
111 expected_preferred_types.Put(syncable::SEARCH_ENGINES); 113 expected_preferred_types.Put(syncable::SEARCH_ENGINES);
112 } 114 }
113 if (it.Get() == syncable::APPS) { 115 if (it.Get() == syncable::APPS) {
114 expected_preferred_types.Put(syncable::APP_NOTIFICATIONS); 116 expected_preferred_types.Put(syncable::APP_NOTIFICATIONS);
117 expected_preferred_types.Put(syncable::APP_SETTINGS);
118 }
119 if (it.Get() == syncable::EXTENSIONS) {
120 expected_preferred_types.Put(syncable::EXTENSION_SETTINGS);
115 } 121 }
116 sync_prefs.SetPreferredDataTypes(non_passive_types, preferred_types); 122 sync_prefs.SetPreferredDataTypes(non_passive_types, preferred_types);
117 EXPECT_TRUE(expected_preferred_types.Equals( 123 EXPECT_TRUE(expected_preferred_types.Equals(
118 sync_prefs.GetPreferredDataTypes(non_passive_types))); 124 sync_prefs.GetPreferredDataTypes(non_passive_types)));
119 } 125 }
120 } 126 }
121 127
122 TEST_F(SyncPrefsTest, MaxInvalidationVersions) { 128 TEST_F(SyncPrefsTest, MaxInvalidationVersions) {
123 SyncPrefs sync_prefs(&pref_service_); 129 SyncPrefs sync_prefs(&pref_service_);
124 130
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 const syncable::ModelTypeSet non_passive_types = GetNonPassiveTypes(); 229 const syncable::ModelTypeSet non_passive_types = GetNonPassiveTypes();
224 EXPECT_TRUE(sync_prefs.GetPreferredDataTypes(non_passive_types).Empty()); 230 EXPECT_TRUE(sync_prefs.GetPreferredDataTypes(non_passive_types).Empty());
225 EXPECT_FALSE(sync_prefs.IsManaged()); 231 EXPECT_FALSE(sync_prefs.IsManaged());
226 EXPECT_TRUE(sync_prefs.GetEncryptionBootstrapToken().empty()); 232 EXPECT_TRUE(sync_prefs.GetEncryptionBootstrapToken().empty());
227 EXPECT_TRUE(sync_prefs.GetAllMaxVersions().empty()); 233 EXPECT_TRUE(sync_prefs.GetAllMaxVersions().empty());
228 } 234 }
229 235
230 } // namespace 236 } // namespace
231 237
232 } // namespace browser_sync 238 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_prefs.cc ('k') | chrome/browser/ui/webui/sync_setup_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698