| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "chrome/browser/sync/profile_sync_service_factory.h" | 5 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "chrome/common/features.h" |
| 14 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
| 15 #include "components/browser_sync/browser_sync_switches.h" | 16 #include "components/browser_sync/browser_sync_switches.h" |
| 16 #include "components/browser_sync/profile_sync_service.h" | 17 #include "components/browser_sync/profile_sync_service.h" |
| 17 #include "components/sync/base/model_type.h" | 18 #include "components/sync/base/model_type.h" |
| 18 #include "components/sync/driver/data_type_controller.h" | 19 #include "components/sync/driver/data_type_controller.h" |
| 19 #include "content/public/test/test_browser_thread_bundle.h" | 20 #include "content/public/test/test_browser_thread_bundle.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 21 #include "ui/app_list/app_list_switches.h" | 22 #include "ui/app_list/app_list_switches.h" |
| 22 | 23 |
| 23 using browser_sync::ProfileSyncService; | 24 using browser_sync::ProfileSyncService; |
| 24 using syncer::DataTypeController; | 25 using syncer::DataTypeController; |
| 25 | 26 |
| 26 class ProfileSyncServiceFactoryTest : public testing::Test { | 27 class ProfileSyncServiceFactoryTest : public testing::Test { |
| 27 protected: | 28 protected: |
| 28 ProfileSyncServiceFactoryTest() : profile_(new TestingProfile()) {} | 29 ProfileSyncServiceFactoryTest() : profile_(new TestingProfile()) {} |
| 29 | 30 |
| 30 // Returns the collection of default datatypes. | 31 // Returns the collection of default datatypes. |
| 31 std::vector<syncer::ModelType> DefaultDatatypes() { | 32 std::vector<syncer::ModelType> DefaultDatatypes() { |
| 32 std::vector<syncer::ModelType> datatypes; | 33 std::vector<syncer::ModelType> datatypes; |
| 33 | 34 |
| 34 // Desktop types. | 35 // Desktop types. |
| 35 #if !defined(OS_ANDROID) | 36 #if !defined(OS_ANDROID) |
| 36 datatypes.push_back(syncer::APPS); | 37 datatypes.push_back(syncer::APPS); |
| 37 #if defined(ENABLE_APP_LIST) | 38 #if BUILDFLAG(ENABLE_APP_LIST) |
| 38 if (app_list::switches::IsAppListSyncEnabled()) | 39 if (app_list::switches::IsAppListSyncEnabled()) |
| 39 datatypes.push_back(syncer::APP_LIST); | 40 datatypes.push_back(syncer::APP_LIST); |
| 40 #endif | 41 #endif |
| 41 datatypes.push_back(syncer::APP_SETTINGS); | 42 datatypes.push_back(syncer::APP_SETTINGS); |
| 42 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) | 43 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) |
| 43 datatypes.push_back(syncer::DICTIONARY); | 44 datatypes.push_back(syncer::DICTIONARY); |
| 44 #endif | 45 #endif |
| 45 #if defined(OS_CHROMEOS) | 46 #if defined(OS_CHROMEOS) |
| 46 datatypes.push_back(syncer::ARC_PACKAGE); | 47 datatypes.push_back(syncer::ARC_PACKAGE); |
| 47 #endif | 48 #endif |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 syncer::ModelTypeSet disabled_types(syncer::AUTOFILL_PROFILE, | 144 syncer::ModelTypeSet disabled_types(syncer::AUTOFILL_PROFILE, |
| 144 syncer::BOOKMARKS); | 145 syncer::BOOKMARKS); |
| 145 SetDisabledTypes(disabled_types); | 146 SetDisabledTypes(disabled_types); |
| 146 ProfileSyncService* pss = ProfileSyncServiceFactory::GetForProfile(profile()); | 147 ProfileSyncService* pss = ProfileSyncServiceFactory::GetForProfile(profile()); |
| 147 DataTypeController::StateMap controller_states; | 148 DataTypeController::StateMap controller_states; |
| 148 pss->GetDataTypeControllerStates(&controller_states); | 149 pss->GetDataTypeControllerStates(&controller_states); |
| 149 EXPECT_EQ(DefaultDatatypesCount() - disabled_types.Size(), | 150 EXPECT_EQ(DefaultDatatypesCount() - disabled_types.Size(), |
| 150 controller_states.size()); | 151 controller_states.size()); |
| 151 CheckDefaultDatatypesInMapExcept(&controller_states, disabled_types); | 152 CheckDefaultDatatypesInMapExcept(&controller_states, disabled_types); |
| 152 } | 153 } |
| OLD | NEW |