| OLD | NEW |
| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 void TestSwitchDisablesType(const char* cmd_switch, | 92 void TestSwitchDisablesType(const char* cmd_switch, |
| 93 syncer::ModelType type) { | 93 syncer::ModelType type) { |
| 94 command_line_->AppendSwitch(cmd_switch); | 94 command_line_->AppendSwitch(cmd_switch); |
| 95 scoped_ptr<ProfileSyncService> pss( | 95 scoped_ptr<ProfileSyncService> pss( |
| 96 new ProfileSyncService( | 96 new ProfileSyncService( |
| 97 new ProfileSyncComponentsFactoryImpl(profile_.get(), | 97 new ProfileSyncComponentsFactoryImpl(profile_.get(), |
| 98 command_line_.get()), | 98 command_line_.get()), |
| 99 profile_.get(), | 99 profile_.get(), |
| 100 NULL, | 100 NULL, |
| 101 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()), | 101 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()), |
| 102 ProfileSyncService::MANUAL_START)); | 102 browser_sync::MANUAL_START)); |
| 103 pss->factory()->RegisterDataTypes(pss.get()); | 103 pss->factory()->RegisterDataTypes(pss.get()); |
| 104 DataTypeController::StateMap controller_states; | 104 DataTypeController::StateMap controller_states; |
| 105 pss->GetDataTypeControllerStates(&controller_states); | 105 pss->GetDataTypeControllerStates(&controller_states); |
| 106 EXPECT_EQ(DefaultDatatypesCount() - 1, controller_states.size()); | 106 EXPECT_EQ(DefaultDatatypesCount() - 1, controller_states.size()); |
| 107 CheckDefaultDatatypesInMapExcept(&controller_states, type); | 107 CheckDefaultDatatypesInMapExcept(&controller_states, type); |
| 108 } | 108 } |
| 109 | 109 |
| 110 base::MessageLoop message_loop_; | 110 base::MessageLoop message_loop_; |
| 111 content::TestBrowserThread ui_thread_; | 111 content::TestBrowserThread ui_thread_; |
| 112 scoped_ptr<Profile> profile_; | 112 scoped_ptr<Profile> profile_; |
| 113 scoped_ptr<CommandLine> command_line_; | 113 scoped_ptr<CommandLine> command_line_; |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDefault) { | 116 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDefault) { |
| 117 scoped_ptr<ProfileSyncService> pss(new ProfileSyncService( | 117 scoped_ptr<ProfileSyncService> pss(new ProfileSyncService( |
| 118 new ProfileSyncComponentsFactoryImpl(profile_.get(), command_line_.get()), | 118 new ProfileSyncComponentsFactoryImpl(profile_.get(), command_line_.get()), |
| 119 profile_.get(), | 119 profile_.get(), |
| 120 NULL, | 120 NULL, |
| 121 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()), | 121 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()), |
| 122 ProfileSyncService::MANUAL_START)); | 122 browser_sync::MANUAL_START)); |
| 123 pss->factory()->RegisterDataTypes(pss.get()); | 123 pss->factory()->RegisterDataTypes(pss.get()); |
| 124 DataTypeController::StateMap controller_states; | 124 DataTypeController::StateMap controller_states; |
| 125 pss->GetDataTypeControllerStates(&controller_states); | 125 pss->GetDataTypeControllerStates(&controller_states); |
| 126 EXPECT_EQ(DefaultDatatypesCount(), controller_states.size()); | 126 EXPECT_EQ(DefaultDatatypesCount(), controller_states.size()); |
| 127 CheckDefaultDatatypesInMapExcept(&controller_states, syncer::UNSPECIFIED); | 127 CheckDefaultDatatypesInMapExcept(&controller_states, syncer::UNSPECIFIED); |
| 128 } | 128 } |
| 129 | 129 |
| 130 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableAutofill) { | 130 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableAutofill) { |
| 131 TestSwitchDisablesType(switches::kDisableSyncAutofill, | 131 TestSwitchDisablesType(switches::kDisableSyncAutofill, |
| 132 syncer::AUTOFILL); | 132 syncer::AUTOFILL); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 159 | 159 |
| 160 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableAutofillProfile) { | 160 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableAutofillProfile) { |
| 161 TestSwitchDisablesType(switches::kDisableSyncAutofillProfile, | 161 TestSwitchDisablesType(switches::kDisableSyncAutofillProfile, |
| 162 syncer::AUTOFILL_PROFILE); | 162 syncer::AUTOFILL_PROFILE); |
| 163 } | 163 } |
| 164 | 164 |
| 165 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisablePasswords) { | 165 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisablePasswords) { |
| 166 TestSwitchDisablesType(switches::kDisableSyncPasswords, | 166 TestSwitchDisablesType(switches::kDisableSyncPasswords, |
| 167 syncer::PASSWORDS); | 167 syncer::PASSWORDS); |
| 168 } | 168 } |
| OLD | NEW |