Chromium Code Reviews

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

Issue 3913005: sync: enable password sync by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/debug
Patch Set: fix mac again Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "chrome/browser/browser_thread.h" 10 #include "chrome/browser/browser_thread.h"
(...skipping 25 matching lines...)
36 scoped_ptr<CommandLine> command_line_; 36 scoped_ptr<CommandLine> command_line_;
37 scoped_ptr<ProfileSyncFactoryImpl> profile_sync_service_factory_; 37 scoped_ptr<ProfileSyncFactoryImpl> profile_sync_service_factory_;
38 }; 38 };
39 39
40 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDefault) { 40 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDefault) {
41 scoped_ptr<ProfileSyncService> pss; 41 scoped_ptr<ProfileSyncService> pss;
42 pss.reset(profile_sync_service_factory_->CreateProfileSyncService("")); 42 pss.reset(profile_sync_service_factory_->CreateProfileSyncService(""));
43 DataTypeController::StateMap controller_states; 43 DataTypeController::StateMap controller_states;
44 DataTypeController::StateMap* controller_states_ptr = &controller_states; 44 DataTypeController::StateMap* controller_states_ptr = &controller_states;
45 pss->GetDataTypeControllerStates(controller_states_ptr); 45 pss->GetDataTypeControllerStates(controller_states_ptr);
46 EXPECT_EQ(6U, controller_states_ptr->size()); 46 EXPECT_EQ(7U, controller_states_ptr->size());
47 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS)); 47 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
48 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES)); 48 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
49 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL)); 49 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
50 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES)); 50 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
51 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS)); 51 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
52 EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS)); 52 EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS));
53 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PASSWORDS));
53 } 54 }
54 55
55 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableAutofill) { 56 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableAutofill) {
56 command_line_->AppendSwitch(switches::kDisableSyncAutofill); 57 command_line_->AppendSwitch(switches::kDisableSyncAutofill);
57 scoped_ptr<ProfileSyncService> pss; 58 scoped_ptr<ProfileSyncService> pss;
58 pss.reset(profile_sync_service_factory_->CreateProfileSyncService("")); 59 pss.reset(profile_sync_service_factory_->CreateProfileSyncService(""));
59 DataTypeController::StateMap controller_states; 60 DataTypeController::StateMap controller_states;
60 DataTypeController::StateMap* controller_states_ptr = &controller_states; 61 DataTypeController::StateMap* controller_states_ptr = &controller_states;
61 pss->GetDataTypeControllerStates(controller_states_ptr); 62 pss->GetDataTypeControllerStates(controller_states_ptr);
62 EXPECT_EQ(5U, controller_states_ptr->size()); 63 EXPECT_EQ(6U, controller_states_ptr->size());
63 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS)); 64 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
64 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES)); 65 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
65 EXPECT_EQ(0U, controller_states_ptr->count(syncable::AUTOFILL)); 66 EXPECT_EQ(0U, controller_states_ptr->count(syncable::AUTOFILL));
66 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES)); 67 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
67 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS)); 68 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
68 EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS)); 69 EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS));
70 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PASSWORDS));
69 } 71 }
70 72
71 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableBookmarks) { 73 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableBookmarks) {
72 command_line_->AppendSwitch(switches::kDisableSyncBookmarks); 74 command_line_->AppendSwitch(switches::kDisableSyncBookmarks);
73 scoped_ptr<ProfileSyncService> pss; 75 scoped_ptr<ProfileSyncService> pss;
74 pss.reset(profile_sync_service_factory_->CreateProfileSyncService("")); 76 pss.reset(profile_sync_service_factory_->CreateProfileSyncService(""));
75 DataTypeController::StateMap controller_states; 77 DataTypeController::StateMap controller_states;
76 DataTypeController::StateMap* controller_states_ptr = &controller_states; 78 DataTypeController::StateMap* controller_states_ptr = &controller_states;
77 pss->GetDataTypeControllerStates(controller_states_ptr); 79 pss->GetDataTypeControllerStates(controller_states_ptr);
78 EXPECT_EQ(5U, controller_states_ptr->size()); 80 EXPECT_EQ(6U, controller_states_ptr->size());
79 EXPECT_EQ(0U, controller_states_ptr->count(syncable::BOOKMARKS)); 81 EXPECT_EQ(0U, controller_states_ptr->count(syncable::BOOKMARKS));
80 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES)); 82 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
81 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL)); 83 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
82 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES)); 84 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
83 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS)); 85 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
84 EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS)); 86 EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS));
87 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PASSWORDS));
85 } 88 }
86 89
87 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisablePreferences) { 90 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisablePreferences) {
88 command_line_->AppendSwitch(switches::kDisableSyncPreferences); 91 command_line_->AppendSwitch(switches::kDisableSyncPreferences);
89 scoped_ptr<ProfileSyncService> pss; 92 scoped_ptr<ProfileSyncService> pss;
90 pss.reset(profile_sync_service_factory_->CreateProfileSyncService("")); 93 pss.reset(profile_sync_service_factory_->CreateProfileSyncService(""));
91 DataTypeController::StateMap controller_states; 94 DataTypeController::StateMap controller_states;
92 DataTypeController::StateMap* controller_states_ptr = &controller_states; 95 DataTypeController::StateMap* controller_states_ptr = &controller_states;
93 pss->GetDataTypeControllerStates(controller_states_ptr); 96 pss->GetDataTypeControllerStates(controller_states_ptr);
94 EXPECT_EQ(5U, controller_states_ptr->size()); 97 EXPECT_EQ(6U, controller_states_ptr->size());
95 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS)); 98 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
96 EXPECT_EQ(0U, controller_states_ptr->count(syncable::PREFERENCES)); 99 EXPECT_EQ(0U, controller_states_ptr->count(syncable::PREFERENCES));
97 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL)); 100 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
98 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES)); 101 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
99 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS)); 102 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
100 EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS)); 103 EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS));
104 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PASSWORDS));
101 } 105 }
102 106
103 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableThemes) { 107 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableThemes) {
104 command_line_->AppendSwitch(switches::kDisableSyncThemes); 108 command_line_->AppendSwitch(switches::kDisableSyncThemes);
105 scoped_ptr<ProfileSyncService> pss; 109 scoped_ptr<ProfileSyncService> pss;
106 pss.reset(profile_sync_service_factory_->CreateProfileSyncService("")); 110 pss.reset(profile_sync_service_factory_->CreateProfileSyncService(""));
107 DataTypeController::StateMap controller_states; 111 DataTypeController::StateMap controller_states;
108 DataTypeController::StateMap* controller_states_ptr = &controller_states; 112 DataTypeController::StateMap* controller_states_ptr = &controller_states;
109 pss->GetDataTypeControllerStates(controller_states_ptr); 113 pss->GetDataTypeControllerStates(controller_states_ptr);
110 EXPECT_EQ(5U, controller_states_ptr->size()); 114 EXPECT_EQ(6U, controller_states_ptr->size());
111 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS)); 115 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
112 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES)); 116 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
113 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL)); 117 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
114 EXPECT_EQ(0U, controller_states_ptr->count(syncable::THEMES)); 118 EXPECT_EQ(0U, controller_states_ptr->count(syncable::THEMES));
115 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS)); 119 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
116 EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS)); 120 EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS));
121 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PASSWORDS));
117 } 122 }
118 123
119 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableExtensions) { 124 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableExtensions) {
120 command_line_->AppendSwitch(switches::kDisableSyncExtensions); 125 command_line_->AppendSwitch(switches::kDisableSyncExtensions);
121 scoped_ptr<ProfileSyncService> pss; 126 scoped_ptr<ProfileSyncService> pss;
122 pss.reset(profile_sync_service_factory_->CreateProfileSyncService("")); 127 pss.reset(profile_sync_service_factory_->CreateProfileSyncService(""));
123 DataTypeController::StateMap controller_states; 128 DataTypeController::StateMap controller_states;
124 DataTypeController::StateMap* controller_states_ptr = &controller_states; 129 DataTypeController::StateMap* controller_states_ptr = &controller_states;
125 pss->GetDataTypeControllerStates(controller_states_ptr); 130 pss->GetDataTypeControllerStates(controller_states_ptr);
126 EXPECT_EQ(5U, controller_states_ptr->size()); 131 EXPECT_EQ(6U, controller_states_ptr->size());
127 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS)); 132 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
128 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES)); 133 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
129 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL)); 134 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
130 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES)); 135 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
131 EXPECT_EQ(0U, controller_states_ptr->count(syncable::EXTENSIONS)); 136 EXPECT_EQ(0U, controller_states_ptr->count(syncable::EXTENSIONS));
132 EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS)); 137 EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS));
138 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PASSWORDS));
133 } 139 }
134 140
135 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableApps) { 141 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableApps) {
136 command_line_->AppendSwitch(switches::kDisableSyncApps); 142 command_line_->AppendSwitch(switches::kDisableSyncApps);
143
137 scoped_ptr<ProfileSyncService> pss; 144 scoped_ptr<ProfileSyncService> pss;
138 pss.reset(profile_sync_service_factory_->CreateProfileSyncService("")); 145 pss.reset(profile_sync_service_factory_->CreateProfileSyncService(""));
139 DataTypeController::StateMap controller_states; 146 DataTypeController::StateMap controller_states;
140 DataTypeController::StateMap* controller_states_ptr = &controller_states; 147 DataTypeController::StateMap* controller_states_ptr = &controller_states;
141 pss->GetDataTypeControllerStates(controller_states_ptr); 148 pss->GetDataTypeControllerStates(controller_states_ptr);
142 EXPECT_EQ(5U, controller_states_ptr->size()); 149 EXPECT_EQ(6U, controller_states_ptr->size());
143 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS)); 150 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
144 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES)); 151 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
145 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL)); 152 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
146 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES)); 153 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
147 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS)); 154 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
148 EXPECT_EQ(0U, controller_states_ptr->count(syncable::APPS)); 155 EXPECT_EQ(0U, controller_states_ptr->count(syncable::APPS));
156 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PASSWORDS));
149 } 157 }
158
159 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisablePasswords) {
160 command_line_->AppendSwitch(switches::kDisableSyncPasswords);
161 scoped_ptr<ProfileSyncService> pss;
162 pss.reset(profile_sync_service_factory_->CreateProfileSyncService(""));
163 DataTypeController::StateMap controller_states;
164 DataTypeController::StateMap* controller_states_ptr = &controller_states;
165 pss->GetDataTypeControllerStates(controller_states_ptr);
166 EXPECT_EQ(6U, controller_states_ptr->size());
167 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
168 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
169 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
170 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
171 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
172 EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS));
173 EXPECT_EQ(0U, controller_states_ptr->count(syncable::PASSWORDS));
174 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_factory_impl.cc ('k') | chrome/browser/sync/profile_sync_service_autofill_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine