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

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

Issue 6811003: [Sync] Make generic non-frontend thread datatype controller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Copy paste :( Created 9 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <vector> 5 #include <vector>
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 } 70 }
71 71
72 // Asserts that if you apply the command line switch |cmd_switch|, 72 // Asserts that if you apply the command line switch |cmd_switch|,
73 // all types are enabled except for |type|, which is disabled. 73 // all types are enabled except for |type|, which is disabled.
74 void TestSwitchDisablesType(const char* cmd_switch, 74 void TestSwitchDisablesType(const char* cmd_switch,
75 syncable::ModelType type) { 75 syncable::ModelType type) {
76 command_line_->AppendSwitch(cmd_switch); 76 command_line_->AppendSwitch(cmd_switch);
77 scoped_ptr<ProfileSyncService> pss( 77 scoped_ptr<ProfileSyncService> pss(
78 profile_sync_service_factory_->CreateProfileSyncService("")); 78 profile_sync_service_factory_->CreateProfileSyncService(""));
79 profile_sync_service_factory_->RegisterDataTypes(pss.get());
79 DataTypeController::StateMap controller_states; 80 DataTypeController::StateMap controller_states;
80 pss->GetDataTypeControllerStates(&controller_states); 81 pss->GetDataTypeControllerStates(&controller_states);
81 EXPECT_EQ(DefaultDatatypesCount() - 1, controller_states.size()); 82 EXPECT_EQ(DefaultDatatypesCount() - 1, controller_states.size());
82 CheckDefaultDatatypesInMapExcept(&controller_states, type); 83 CheckDefaultDatatypesInMapExcept(&controller_states, type);
83 } 84 }
84 85
85 MessageLoop message_loop_; 86 MessageLoop message_loop_;
86 BrowserThread ui_thread_; 87 BrowserThread ui_thread_;
87 scoped_ptr<Profile> profile_; 88 scoped_ptr<Profile> profile_;
88 scoped_ptr<CommandLine> command_line_; 89 scoped_ptr<CommandLine> command_line_;
89 scoped_ptr<ProfileSyncFactoryImpl> profile_sync_service_factory_; 90 scoped_ptr<ProfileSyncFactoryImpl> profile_sync_service_factory_;
90 }; 91 };
91 92
92 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDefault) { 93 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDefault) {
93 scoped_ptr<ProfileSyncService> pss( 94 scoped_ptr<ProfileSyncService> pss(
94 profile_sync_service_factory_->CreateProfileSyncService("")); 95 profile_sync_service_factory_->CreateProfileSyncService(""));
96 profile_sync_service_factory_->RegisterDataTypes(pss.get());
95 DataTypeController::StateMap controller_states; 97 DataTypeController::StateMap controller_states;
96 pss->GetDataTypeControllerStates(&controller_states); 98 pss->GetDataTypeControllerStates(&controller_states);
97 EXPECT_EQ(DefaultDatatypesCount(), controller_states.size()); 99 EXPECT_EQ(DefaultDatatypesCount(), controller_states.size());
98 CheckDefaultDatatypesInMapExcept(&controller_states, syncable::UNSPECIFIED); 100 CheckDefaultDatatypesInMapExcept(&controller_states, syncable::UNSPECIFIED);
99 } 101 }
100 102
101 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableAutofill) { 103 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableAutofill) {
102 TestSwitchDisablesType(switches::kDisableSyncAutofill, 104 TestSwitchDisablesType(switches::kDisableSyncAutofill,
103 syncable::AUTOFILL); 105 syncable::AUTOFILL);
104 } 106 }
(...skipping 25 matching lines...) Expand all
130 132
131 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableAutofillProfile) { 133 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableAutofillProfile) {
132 TestSwitchDisablesType(switches::kDisableSyncAutofillProfile, 134 TestSwitchDisablesType(switches::kDisableSyncAutofillProfile,
133 syncable::AUTOFILL_PROFILE); 135 syncable::AUTOFILL_PROFILE);
134 } 136 }
135 137
136 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisablePasswords) { 138 TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisablePasswords) {
137 TestSwitchDisablesType(switches::kDisableSyncPasswords, 139 TestSwitchDisablesType(switches::kDisableSyncPasswords,
138 syncable::PASSWORDS); 140 syncable::PASSWORDS);
139 } 141 }
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