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 16 matching lines...) Expand all Loading... |
27 using sync_driver::DataTypeController; | 27 using sync_driver::DataTypeController; |
28 | 28 |
29 class ProfileSyncComponentsFactoryImplTest : public testing::Test { | 29 class ProfileSyncComponentsFactoryImplTest : public testing::Test { |
30 protected: | 30 protected: |
31 ProfileSyncComponentsFactoryImplTest() | 31 ProfileSyncComponentsFactoryImplTest() |
32 : thread_bundle_(content::TestBrowserThreadBundle::DEFAULT) {} | 32 : thread_bundle_(content::TestBrowserThreadBundle::DEFAULT) {} |
33 | 33 |
34 void SetUp() override { | 34 void SetUp() override { |
35 profile_.reset(new TestingProfile()); | 35 profile_.reset(new TestingProfile()); |
36 base::FilePath program_path(FILE_PATH_LITERAL("chrome.exe")); | 36 base::FilePath program_path(FILE_PATH_LITERAL("chrome.exe")); |
37 command_line_.reset(new CommandLine(program_path)); | 37 command_line_.reset(new base::CommandLine(program_path)); |
38 scope_set_.insert(GaiaConstants::kChromeSyncOAuth2Scope); | 38 scope_set_.insert(GaiaConstants::kChromeSyncOAuth2Scope); |
39 } | 39 } |
40 | 40 |
41 // Returns the collection of default datatypes. | 41 // Returns the collection of default datatypes. |
42 static std::vector<syncer::ModelType> DefaultDatatypes() { | 42 static std::vector<syncer::ModelType> DefaultDatatypes() { |
43 std::vector<syncer::ModelType> datatypes; | 43 std::vector<syncer::ModelType> datatypes; |
44 datatypes.push_back(syncer::APPS); | 44 datatypes.push_back(syncer::APPS); |
45 #if defined(ENABLE_APP_LIST) | 45 #if defined(ENABLE_APP_LIST) |
46 if (app_list::switches::IsAppListSyncEnabled()) | 46 if (app_list::switches::IsAppListSyncEnabled()) |
47 datatypes.push_back(syncer::APP_LIST); | 47 datatypes.push_back(syncer::APP_LIST); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 browser_sync::MANUAL_START)); | 120 browser_sync::MANUAL_START)); |
121 pss->factory()->RegisterDataTypes(pss.get()); | 121 pss->factory()->RegisterDataTypes(pss.get()); |
122 DataTypeController::StateMap controller_states; | 122 DataTypeController::StateMap controller_states; |
123 pss->GetDataTypeControllerStates(&controller_states); | 123 pss->GetDataTypeControllerStates(&controller_states); |
124 EXPECT_EQ(DefaultDatatypesCount() - types.Size(), controller_states.size()); | 124 EXPECT_EQ(DefaultDatatypesCount() - types.Size(), controller_states.size()); |
125 CheckDefaultDatatypesInMapExcept(&controller_states, types); | 125 CheckDefaultDatatypesInMapExcept(&controller_states, types); |
126 } | 126 } |
127 | 127 |
128 content::TestBrowserThreadBundle thread_bundle_; | 128 content::TestBrowserThreadBundle thread_bundle_; |
129 scoped_ptr<Profile> profile_; | 129 scoped_ptr<Profile> profile_; |
130 scoped_ptr<CommandLine> command_line_; | 130 scoped_ptr<base::CommandLine> command_line_; |
131 OAuth2TokenService::ScopeSet scope_set_; | 131 OAuth2TokenService::ScopeSet scope_set_; |
132 }; | 132 }; |
133 | 133 |
134 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDefault) { | 134 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDefault) { |
135 ProfileOAuth2TokenService* token_service = | 135 ProfileOAuth2TokenService* token_service = |
136 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); | 136 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()); |
137 scoped_ptr<ProfileSyncService> pss(new ProfileSyncService( | 137 scoped_ptr<ProfileSyncService> pss(new ProfileSyncService( |
138 scoped_ptr<ProfileSyncComponentsFactory>( | 138 scoped_ptr<ProfileSyncComponentsFactory>( |
139 new ProfileSyncComponentsFactoryImpl( | 139 new ProfileSyncComponentsFactoryImpl( |
140 profile_.get(), | 140 profile_.get(), |
(...skipping 13 matching lines...) Expand all Loading... |
154 } | 154 } |
155 | 155 |
156 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableOne) { | 156 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableOne) { |
157 TestSwitchDisablesType(syncer::ModelTypeSet(syncer::AUTOFILL)); | 157 TestSwitchDisablesType(syncer::ModelTypeSet(syncer::AUTOFILL)); |
158 } | 158 } |
159 | 159 |
160 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableMultiple) { | 160 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableMultiple) { |
161 TestSwitchDisablesType( | 161 TestSwitchDisablesType( |
162 syncer::ModelTypeSet(syncer::AUTOFILL_PROFILE, syncer::BOOKMARKS)); | 162 syncer::ModelTypeSet(syncer::AUTOFILL_PROFILE, syncer::BOOKMARKS)); |
163 } | 163 } |
OLD | NEW |