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

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

Issue 12286007: Revert "Revert 182527" ([Sync] Make SESSIONS an implicit type) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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 "chrome/browser/sync/sync_prefs.h" 5 #include "chrome/browser/sync/sync_prefs.h"
6 6
7 #include "base/command_line.h"
7 #include "base/message_loop.h" 8 #include "base/message_loop.h"
8 #include "base/time.h" 9 #include "base/time.h"
10 #include "chrome/common/chrome_switches.h"
9 #include "chrome/test/base/testing_pref_service_syncable.h" 11 #include "chrome/test/base/testing_pref_service_syncable.h"
10 #include "sync/internal_api/public/base/model_type.h" 12 #include "sync/internal_api/public/base/model_type.h"
11 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
13 15
14 namespace browser_sync { 16 namespace browser_sync {
15 17
16 namespace { 18 namespace {
17 19
18 using ::testing::InSequence; 20 using ::testing::InSequence;
19 using ::testing::StrictMock; 21 using ::testing::StrictMock;
20 22
21 class SyncPrefsTest : public testing::Test { 23 class SyncPrefsTest : public testing::Test {
22 protected: 24 protected:
23 virtual void SetUp() OVERRIDE { 25 virtual void SetUp() OVERRIDE {
26 CommandLine::ForCurrentProcess()->AppendSwitch(
27 switches::kHistoryEnableFullHistorySync);
24 SyncPrefs::RegisterUserPrefs(pref_service_.registry()); 28 SyncPrefs::RegisterUserPrefs(pref_service_.registry());
25 } 29 }
26 30
27 TestingPrefServiceSyncable pref_service_; 31 TestingPrefServiceSyncable pref_service_;
28 32
29 private: 33 private:
30 MessageLoop loop_; 34 MessageLoop loop_;
31 }; 35 };
32 36
33 TEST_F(SyncPrefsTest, Basic) { 37 TEST_F(SyncPrefsTest, Basic) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 expected_preferred_types.Put(syncer::DICTIONARY); 103 expected_preferred_types.Put(syncer::DICTIONARY);
100 expected_preferred_types.Put(syncer::SEARCH_ENGINES); 104 expected_preferred_types.Put(syncer::SEARCH_ENGINES);
101 } 105 }
102 if (it.Get() == syncer::APPS) { 106 if (it.Get() == syncer::APPS) {
103 expected_preferred_types.Put(syncer::APP_NOTIFICATIONS); 107 expected_preferred_types.Put(syncer::APP_NOTIFICATIONS);
104 expected_preferred_types.Put(syncer::APP_SETTINGS); 108 expected_preferred_types.Put(syncer::APP_SETTINGS);
105 } 109 }
106 if (it.Get() == syncer::EXTENSIONS) { 110 if (it.Get() == syncer::EXTENSIONS) {
107 expected_preferred_types.Put(syncer::EXTENSION_SETTINGS); 111 expected_preferred_types.Put(syncer::EXTENSION_SETTINGS);
108 } 112 }
109 if (it.Get() == syncer::SESSIONS) { 113 if (it.Get() == syncer::TYPED_URLS) {
110 expected_preferred_types.Put(syncer::HISTORY_DELETE_DIRECTIVES); 114 expected_preferred_types.Put(syncer::HISTORY_DELETE_DIRECTIVES);
115 expected_preferred_types.Put(syncer::SESSIONS);
111 expected_preferred_types.Put(syncer::FAVICON_IMAGES); 116 expected_preferred_types.Put(syncer::FAVICON_IMAGES);
112 expected_preferred_types.Put(syncer::FAVICON_TRACKING); 117 expected_preferred_types.Put(syncer::FAVICON_TRACKING);
113 } 118 }
119 if (it.Get() == syncer::PROXY_TABS) {
120 expected_preferred_types.Put(syncer::SESSIONS);
121 expected_preferred_types.Put(syncer::FAVICON_IMAGES);
122 expected_preferred_types.Put(syncer::FAVICON_TRACKING);
123 }
114 sync_prefs.SetPreferredDataTypes(user_types, preferred_types); 124 sync_prefs.SetPreferredDataTypes(user_types, preferred_types);
115 EXPECT_TRUE(expected_preferred_types.Equals( 125 EXPECT_TRUE(expected_preferred_types.Equals(
116 sync_prefs.GetPreferredDataTypes(user_types))); 126 sync_prefs.GetPreferredDataTypes(user_types)));
117 } 127 }
118 } 128 }
119 129
120 class MockSyncPrefObserver : public SyncPrefObserver { 130 class MockSyncPrefObserver : public SyncPrefObserver {
121 public: 131 public:
122 MOCK_METHOD1(OnSyncManagedPrefChange, void(bool)); 132 MOCK_METHOD1(OnSyncManagedPrefChange, void(bool));
123 }; 133 };
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 EXPECT_FALSE(sync_prefs.HasKeepEverythingSynced()); 198 EXPECT_FALSE(sync_prefs.HasKeepEverythingSynced());
189 const syncer::ModelTypeSet user_types = syncer::UserTypes(); 199 const syncer::ModelTypeSet user_types = syncer::UserTypes();
190 EXPECT_TRUE(sync_prefs.GetPreferredDataTypes(user_types).Empty()); 200 EXPECT_TRUE(sync_prefs.GetPreferredDataTypes(user_types).Empty());
191 EXPECT_FALSE(sync_prefs.IsManaged()); 201 EXPECT_FALSE(sync_prefs.IsManaged());
192 EXPECT_TRUE(sync_prefs.GetEncryptionBootstrapToken().empty()); 202 EXPECT_TRUE(sync_prefs.GetEncryptionBootstrapToken().empty());
193 } 203 }
194 204
195 } // namespace 205 } // namespace
196 206
197 } // namespace browser_sync 207 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/sync_prefs.cc ('k') | chrome/browser/sync/test/integration/enable_disable_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698