| OLD | NEW |
| 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 "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/test/base/testing_pref_service.h" | 9 #include "chrome/test/base/testing_pref_service.h" |
| 10 #include "sync/internal_api/public/base/model_type.h" | 10 #include "sync/internal_api/public/base/model_type.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 private: | 25 private: |
| 26 MessageLoop loop_; | 26 MessageLoop loop_; |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // Returns all types visible from the setup UI. | 29 // Returns all types visible from the setup UI. |
| 30 syncer::ModelTypeSet GetUserVisibleTypes() { | 30 syncer::ModelTypeSet GetUserVisibleTypes() { |
| 31 syncer::ModelTypeSet user_visible_types(syncer::UserTypes()); | 31 syncer::ModelTypeSet user_visible_types(syncer::UserTypes()); |
| 32 user_visible_types.Remove(syncer::APP_NOTIFICATIONS); | 32 user_visible_types.Remove(syncer::APP_NOTIFICATIONS); |
| 33 user_visible_types.Remove(syncer::APP_SETTINGS); | 33 user_visible_types.Remove(syncer::APP_SETTINGS); |
| 34 user_visible_types.Remove(syncer::AUTOFILL_PROFILE); | 34 user_visible_types.Remove(syncer::AUTOFILL_PROFILE); |
| 35 user_visible_types.Remove(syncer::DICTIONARY); |
| 35 user_visible_types.Remove(syncer::EXTENSION_SETTINGS); | 36 user_visible_types.Remove(syncer::EXTENSION_SETTINGS); |
| 36 user_visible_types.Remove(syncer::SEARCH_ENGINES); | 37 user_visible_types.Remove(syncer::SEARCH_ENGINES); |
| 37 return user_visible_types; | 38 return user_visible_types; |
| 38 } | 39 } |
| 39 | 40 |
| 40 TEST_F(SyncPrefsTest, Basic) { | 41 TEST_F(SyncPrefsTest, Basic) { |
| 41 SyncPrefs sync_prefs(&pref_service_); | 42 SyncPrefs sync_prefs(&pref_service_); |
| 42 | 43 |
| 43 EXPECT_FALSE(sync_prefs.HasSyncSetupCompleted()); | 44 EXPECT_FALSE(sync_prefs.HasSyncSetupCompleted()); |
| 44 sync_prefs.SetSyncSetupCompleted(); | 45 sync_prefs.SetSyncSetupCompleted(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 const syncer::ModelTypeSet user_visible_types = GetUserVisibleTypes(); | 97 const syncer::ModelTypeSet user_visible_types = GetUserVisibleTypes(); |
| 97 for (syncer::ModelTypeSet::Iterator it = user_visible_types.First(); | 98 for (syncer::ModelTypeSet::Iterator it = user_visible_types.First(); |
| 98 it.Good(); it.Inc()) { | 99 it.Good(); it.Inc()) { |
| 99 syncer::ModelTypeSet preferred_types; | 100 syncer::ModelTypeSet preferred_types; |
| 100 preferred_types.Put(it.Get()); | 101 preferred_types.Put(it.Get()); |
| 101 syncer::ModelTypeSet expected_preferred_types(preferred_types); | 102 syncer::ModelTypeSet expected_preferred_types(preferred_types); |
| 102 if (it.Get() == syncer::AUTOFILL) { | 103 if (it.Get() == syncer::AUTOFILL) { |
| 103 expected_preferred_types.Put(syncer::AUTOFILL_PROFILE); | 104 expected_preferred_types.Put(syncer::AUTOFILL_PROFILE); |
| 104 } | 105 } |
| 105 if (it.Get() == syncer::PREFERENCES) { | 106 if (it.Get() == syncer::PREFERENCES) { |
| 107 expected_preferred_types.Put(syncer::DICTIONARY); |
| 106 expected_preferred_types.Put(syncer::SEARCH_ENGINES); | 108 expected_preferred_types.Put(syncer::SEARCH_ENGINES); |
| 107 } | 109 } |
| 108 if (it.Get() == syncer::APPS) { | 110 if (it.Get() == syncer::APPS) { |
| 109 expected_preferred_types.Put(syncer::APP_NOTIFICATIONS); | 111 expected_preferred_types.Put(syncer::APP_NOTIFICATIONS); |
| 110 expected_preferred_types.Put(syncer::APP_SETTINGS); | 112 expected_preferred_types.Put(syncer::APP_SETTINGS); |
| 111 } | 113 } |
| 112 if (it.Get() == syncer::EXTENSIONS) { | 114 if (it.Get() == syncer::EXTENSIONS) { |
| 113 expected_preferred_types.Put(syncer::EXTENSION_SETTINGS); | 115 expected_preferred_types.Put(syncer::EXTENSION_SETTINGS); |
| 114 } | 116 } |
| 115 if (it.Get() == syncer::SESSIONS) { | 117 if (it.Get() == syncer::SESSIONS) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 EXPECT_FALSE(sync_prefs.HasKeepEverythingSynced()); | 199 EXPECT_FALSE(sync_prefs.HasKeepEverythingSynced()); |
| 198 const syncer::ModelTypeSet user_types = syncer::UserTypes(); | 200 const syncer::ModelTypeSet user_types = syncer::UserTypes(); |
| 199 EXPECT_TRUE(sync_prefs.GetPreferredDataTypes(user_types).Empty()); | 201 EXPECT_TRUE(sync_prefs.GetPreferredDataTypes(user_types).Empty()); |
| 200 EXPECT_FALSE(sync_prefs.IsManaged()); | 202 EXPECT_FALSE(sync_prefs.IsManaged()); |
| 201 EXPECT_TRUE(sync_prefs.GetEncryptionBootstrapToken().empty()); | 203 EXPECT_TRUE(sync_prefs.GetEncryptionBootstrapToken().empty()); |
| 202 } | 204 } |
| 203 | 205 |
| 204 } // namespace | 206 } // namespace |
| 205 | 207 |
| 206 } // namespace browser_sync | 208 } // namespace browser_sync |
| OLD | NEW |