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

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

Issue 2833042: Enable extensions sync by default. (Closed)
Patch Set: Fixed unittests Created 10 years, 5 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
« no previous file with comments | « chrome/browser/sync/profile_sync_factory_impl.cc ('k') | no next file » | 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) 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/chrome_thread.h" 10 #include "chrome/browser/chrome_thread.h"
(...skipping 25 matching lines...) Expand all
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(4U, controller_states_ptr->size()); 46 EXPECT_EQ(5U, 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 } 52 }
52 53
53 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableAutofill) { 54 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableAutofill) {
54 command_line_->AppendSwitch(switches::kDisableSyncAutofill); 55 command_line_->AppendSwitch(switches::kDisableSyncAutofill);
55 scoped_ptr<ProfileSyncService> pss; 56 scoped_ptr<ProfileSyncService> pss;
56 pss.reset(profile_sync_service_factory_->CreateProfileSyncService()); 57 pss.reset(profile_sync_service_factory_->CreateProfileSyncService());
57 DataTypeController::StateMap controller_states; 58 DataTypeController::StateMap controller_states;
58 DataTypeController::StateMap* controller_states_ptr = &controller_states; 59 DataTypeController::StateMap* controller_states_ptr = &controller_states;
59 pss->GetDataTypeControllerStates(controller_states_ptr); 60 pss->GetDataTypeControllerStates(controller_states_ptr);
60 EXPECT_EQ(3U, controller_states_ptr->size()); 61 EXPECT_EQ(4U, controller_states_ptr->size());
61 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS)); 62 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
62 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES)); 63 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
63 EXPECT_EQ(0U, controller_states_ptr->count(syncable::AUTOFILL)); 64 EXPECT_EQ(0U, controller_states_ptr->count(syncable::AUTOFILL));
64 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES)); 65 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
66 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
65 } 67 }
66 68
67 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableBookmarks) { 69 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableBookmarks) {
68 command_line_->AppendSwitch(switches::kDisableSyncBookmarks); 70 command_line_->AppendSwitch(switches::kDisableSyncBookmarks);
69 scoped_ptr<ProfileSyncService> pss; 71 scoped_ptr<ProfileSyncService> pss;
70 pss.reset(profile_sync_service_factory_->CreateProfileSyncService()); 72 pss.reset(profile_sync_service_factory_->CreateProfileSyncService());
71 DataTypeController::StateMap controller_states; 73 DataTypeController::StateMap controller_states;
72 DataTypeController::StateMap* controller_states_ptr = &controller_states; 74 DataTypeController::StateMap* controller_states_ptr = &controller_states;
73 pss->GetDataTypeControllerStates(controller_states_ptr); 75 pss->GetDataTypeControllerStates(controller_states_ptr);
74 EXPECT_EQ(3U, controller_states_ptr->size()); 76 EXPECT_EQ(4U, controller_states_ptr->size());
75 EXPECT_EQ(0U, controller_states_ptr->count(syncable::BOOKMARKS)); 77 EXPECT_EQ(0U, controller_states_ptr->count(syncable::BOOKMARKS));
76 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES)); 78 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
77 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL)); 79 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
78 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES)); 80 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
81 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
79 } 82 }
80 83
81 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisablePreferences) { 84 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisablePreferences) {
82 command_line_->AppendSwitch(switches::kDisableSyncPreferences); 85 command_line_->AppendSwitch(switches::kDisableSyncPreferences);
83 scoped_ptr<ProfileSyncService> pss; 86 scoped_ptr<ProfileSyncService> pss;
84 pss.reset(profile_sync_service_factory_->CreateProfileSyncService()); 87 pss.reset(profile_sync_service_factory_->CreateProfileSyncService());
85 DataTypeController::StateMap controller_states; 88 DataTypeController::StateMap controller_states;
86 DataTypeController::StateMap* controller_states_ptr = &controller_states; 89 DataTypeController::StateMap* controller_states_ptr = &controller_states;
87 pss->GetDataTypeControllerStates(controller_states_ptr); 90 pss->GetDataTypeControllerStates(controller_states_ptr);
88 EXPECT_EQ(3U, controller_states_ptr->size()); 91 EXPECT_EQ(4U, controller_states_ptr->size());
89 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS)); 92 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
90 EXPECT_EQ(0U, controller_states_ptr->count(syncable::PREFERENCES)); 93 EXPECT_EQ(0U, controller_states_ptr->count(syncable::PREFERENCES));
91 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL)); 94 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
92 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES)); 95 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
96 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
93 } 97 }
94 98
95 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableThemes) { 99 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableThemes) {
96 command_line_->AppendSwitch(switches::kDisableSyncThemes); 100 command_line_->AppendSwitch(switches::kDisableSyncThemes);
97 scoped_ptr<ProfileSyncService> pss; 101 scoped_ptr<ProfileSyncService> pss;
98 pss.reset(profile_sync_service_factory_->CreateProfileSyncService()); 102 pss.reset(profile_sync_service_factory_->CreateProfileSyncService());
99 DataTypeController::StateMap controller_states; 103 DataTypeController::StateMap controller_states;
100 DataTypeController::StateMap* controller_states_ptr = &controller_states; 104 DataTypeController::StateMap* controller_states_ptr = &controller_states;
101 pss->GetDataTypeControllerStates(controller_states_ptr); 105 pss->GetDataTypeControllerStates(controller_states_ptr);
102 EXPECT_EQ(3U, controller_states_ptr->size()); 106 EXPECT_EQ(4U, controller_states_ptr->size());
103 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS)); 107 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
104 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES)); 108 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
105 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL)); 109 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
106 EXPECT_EQ(0U, controller_states_ptr->count(syncable::THEMES)); 110 EXPECT_EQ(0U, controller_states_ptr->count(syncable::THEMES));
111 EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
107 } 112 }
113
114 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableExtensions) {
115 command_line_->AppendSwitch(switches::kDisableSyncExtensions);
116 scoped_ptr<ProfileSyncService> pss;
117 pss.reset(profile_sync_service_factory_->CreateProfileSyncService());
118 DataTypeController::StateMap controller_states;
119 DataTypeController::StateMap* controller_states_ptr = &controller_states;
120 pss->GetDataTypeControllerStates(controller_states_ptr);
121 EXPECT_EQ(4U, controller_states_ptr->size());
122 EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
123 EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
124 EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
125 EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
126 EXPECT_EQ(0U, controller_states_ptr->count(syncable::EXTENSIONS));
127 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_factory_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698