| 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" |
| 11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 12 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" | 12 #include "chrome/browser/sync/profile_sync_components_factory_impl.h" |
| 13 #include "chrome/browser/sync/profile_sync_service.h" | 13 #include "chrome/browser/sync/profile_sync_service.h" |
| 14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 15 #include "chrome/common/chrome_version_info.h" | 15 #include "chrome/common/chrome_version_info.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 17 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 17 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| 18 #include "components/sync_driver/data_type_controller.h" | 18 #include "components/sync_driver/data_type_controller.h" |
| 19 #include "content/public/test/test_browser_thread.h" | 19 #include "content/public/test/test_browser_thread.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "ui/app_list/app_list_switches.h" |
| 21 | 22 |
| 22 using browser_sync::DataTypeController; | 23 using browser_sync::DataTypeController; |
| 23 using content::BrowserThread; | 24 using content::BrowserThread; |
| 24 | 25 |
| 25 class ProfileSyncComponentsFactoryImplTest : public testing::Test { | 26 class ProfileSyncComponentsFactoryImplTest : public testing::Test { |
| 26 protected: | 27 protected: |
| 27 ProfileSyncComponentsFactoryImplTest() | 28 ProfileSyncComponentsFactoryImplTest() |
| 28 : ui_thread_(BrowserThread::UI, &message_loop_) {} | 29 : ui_thread_(BrowserThread::UI, &message_loop_) {} |
| 29 | 30 |
| 30 virtual void SetUp() { | 31 virtual void SetUp() { |
| 31 profile_.reset(new TestingProfile()); | 32 profile_.reset(new TestingProfile()); |
| 32 base::FilePath program_path(FILE_PATH_LITERAL("chrome.exe")); | 33 base::FilePath program_path(FILE_PATH_LITERAL("chrome.exe")); |
| 33 command_line_.reset(new CommandLine(program_path)); | 34 command_line_.reset(new CommandLine(program_path)); |
| 34 } | 35 } |
| 35 | 36 |
| 36 // Returns the collection of default datatypes. | 37 // Returns the collection of default datatypes. |
| 37 static std::vector<syncer::ModelType> DefaultDatatypes() { | 38 static std::vector<syncer::ModelType> DefaultDatatypes() { |
| 38 std::vector<syncer::ModelType> datatypes; | 39 std::vector<syncer::ModelType> datatypes; |
| 39 datatypes.push_back(syncer::APPS); | 40 datatypes.push_back(syncer::APPS); |
| 40 #if defined(ENABLE_APP_LIST) | 41 #if defined(ENABLE_APP_LIST) |
| 41 datatypes.push_back(syncer::APP_LIST); | 42 if (app_list::switches::IsAppListSyncEnabled()) |
| 43 datatypes.push_back(syncer::APP_LIST); |
| 42 #endif | 44 #endif |
| 43 datatypes.push_back(syncer::APP_SETTINGS); | 45 datatypes.push_back(syncer::APP_SETTINGS); |
| 44 datatypes.push_back(syncer::AUTOFILL); | 46 datatypes.push_back(syncer::AUTOFILL); |
| 45 datatypes.push_back(syncer::AUTOFILL_PROFILE); | 47 datatypes.push_back(syncer::AUTOFILL_PROFILE); |
| 46 datatypes.push_back(syncer::BOOKMARKS); | 48 datatypes.push_back(syncer::BOOKMARKS); |
| 47 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) | 49 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) |
| 48 datatypes.push_back(syncer::DICTIONARY); | 50 datatypes.push_back(syncer::DICTIONARY); |
| 49 #endif | 51 #endif |
| 50 datatypes.push_back(syncer::EXTENSIONS); | 52 datatypes.push_back(syncer::EXTENSIONS); |
| 51 datatypes.push_back(syncer::EXTENSION_SETTINGS); | 53 datatypes.push_back(syncer::EXTENSION_SETTINGS); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } | 140 } |
| 139 | 141 |
| 140 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableOne) { | 142 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableOne) { |
| 141 TestSwitchDisablesType(syncer::ModelTypeSet(syncer::AUTOFILL)); | 143 TestSwitchDisablesType(syncer::ModelTypeSet(syncer::AUTOFILL)); |
| 142 } | 144 } |
| 143 | 145 |
| 144 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableMultiple) { | 146 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableMultiple) { |
| 145 TestSwitchDisablesType( | 147 TestSwitchDisablesType( |
| 146 syncer::ModelTypeSet(syncer::AUTOFILL_PROFILE, syncer::BOOKMARKS)); | 148 syncer::ModelTypeSet(syncer::AUTOFILL_PROFILE, syncer::BOOKMARKS)); |
| 147 } | 149 } |
| OLD | NEW |