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 <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "chrome/common/features.h" | 13 #include "chrome/common/features.h" |
14 #include "chrome/test/base/testing_profile.h" | 14 #include "chrome/test/base/testing_profile.h" |
15 #include "components/browser_sync/browser_sync_switches.h" | 15 #include "components/browser_sync/browser_sync_switches.h" |
16 #include "components/browser_sync/profile_sync_service.h" | 16 #include "components/browser_sync/profile_sync_service.h" |
17 #include "components/sync/base/model_type.h" | 17 #include "components/sync/base/model_type.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_bundle.h" | 19 #include "content/public/test/test_browser_thread_bundle.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 #include "ui/app_list/app_list_switches.h" |
22 | 22 |
| 23 #if defined(OS_CHROMEOS) |
| 24 #include "chrome/browser/chromeos/arc/arc_util.h" |
| 25 #endif |
| 26 |
23 using browser_sync::ProfileSyncService; | 27 using browser_sync::ProfileSyncService; |
24 using syncer::DataTypeController; | 28 using syncer::DataTypeController; |
25 | 29 |
26 class ProfileSyncServiceFactoryTest : public testing::Test { | 30 class ProfileSyncServiceFactoryTest : public testing::Test { |
27 protected: | 31 protected: |
28 ProfileSyncServiceFactoryTest() : profile_(new TestingProfile()) {} | 32 ProfileSyncServiceFactoryTest() : profile_(new TestingProfile()) {} |
29 | 33 |
30 // Returns the collection of default datatypes. | 34 // Returns the collection of default datatypes. |
31 std::vector<syncer::ModelType> DefaultDatatypes() { | 35 std::vector<syncer::ModelType> DefaultDatatypes() { |
32 std::vector<syncer::ModelType> datatypes; | 36 std::vector<syncer::ModelType> datatypes; |
(...skipping 11 matching lines...) Expand all Loading... |
44 #endif | 48 #endif |
45 datatypes.push_back(syncer::EXTENSIONS); | 49 datatypes.push_back(syncer::EXTENSIONS); |
46 datatypes.push_back(syncer::EXTENSION_SETTINGS); | 50 datatypes.push_back(syncer::EXTENSION_SETTINGS); |
47 datatypes.push_back(syncer::SEARCH_ENGINES); | 51 datatypes.push_back(syncer::SEARCH_ENGINES); |
48 datatypes.push_back(syncer::THEMES); | 52 datatypes.push_back(syncer::THEMES); |
49 datatypes.push_back(syncer::SUPERVISED_USERS); | 53 datatypes.push_back(syncer::SUPERVISED_USERS); |
50 datatypes.push_back(syncer::SUPERVISED_USER_SHARED_SETTINGS); | 54 datatypes.push_back(syncer::SUPERVISED_USER_SHARED_SETTINGS); |
51 #endif // !OS_ANDROID | 55 #endif // !OS_ANDROID |
52 | 56 |
53 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
54 datatypes.push_back(syncer::ARC_PACKAGE); | 58 if (arc::IsArcAllowedForProfile(profile())) |
| 59 datatypes.push_back(syncer::ARC_PACKAGE); |
55 datatypes.push_back(syncer::PRINTERS); | 60 datatypes.push_back(syncer::PRINTERS); |
56 #endif // OS_CHROMEOS | 61 #endif // OS_CHROMEOS |
57 | 62 |
58 // Common types. | 63 // Common types. |
59 datatypes.push_back(syncer::AUTOFILL); | 64 datatypes.push_back(syncer::AUTOFILL); |
60 datatypes.push_back(syncer::AUTOFILL_PROFILE); | 65 datatypes.push_back(syncer::AUTOFILL_PROFILE); |
61 datatypes.push_back(syncer::AUTOFILL_WALLET_DATA); | 66 datatypes.push_back(syncer::AUTOFILL_WALLET_DATA); |
62 datatypes.push_back(syncer::AUTOFILL_WALLET_METADATA); | 67 datatypes.push_back(syncer::AUTOFILL_WALLET_METADATA); |
63 datatypes.push_back(syncer::BOOKMARKS); | 68 datatypes.push_back(syncer::BOOKMARKS); |
64 datatypes.push_back(syncer::DEVICE_INFO); | 69 datatypes.push_back(syncer::DEVICE_INFO); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 syncer::ModelTypeSet disabled_types(syncer::AUTOFILL_PROFILE, | 150 syncer::ModelTypeSet disabled_types(syncer::AUTOFILL_PROFILE, |
146 syncer::BOOKMARKS); | 151 syncer::BOOKMARKS); |
147 SetDisabledTypes(disabled_types); | 152 SetDisabledTypes(disabled_types); |
148 ProfileSyncService* pss = ProfileSyncServiceFactory::GetForProfile(profile()); | 153 ProfileSyncService* pss = ProfileSyncServiceFactory::GetForProfile(profile()); |
149 DataTypeController::StateMap controller_states; | 154 DataTypeController::StateMap controller_states; |
150 pss->GetDataTypeControllerStates(&controller_states); | 155 pss->GetDataTypeControllerStates(&controller_states); |
151 EXPECT_EQ(DefaultDatatypesCount() - disabled_types.Size(), | 156 EXPECT_EQ(DefaultDatatypesCount() - disabled_types.Size(), |
152 controller_states.size()); | 157 controller_states.size()); |
153 CheckDefaultDatatypesInMapExcept(&controller_states, disabled_types); | 158 CheckDefaultDatatypesInMapExcept(&controller_states, disabled_types); |
154 } | 159 } |
OLD | NEW |