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

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

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

Powered by Google App Engine
This is Rietveld 408576698