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.h" | 10 #include "base/message_loop.h" |
11 #include "chrome/browser/sync/glue/data_type_controller.h" | 11 #include "chrome/browser/sync/glue/data_type_controller.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/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
16 #include "content/public/test/test_browser_thread.h" | 17 #include "content/public/test/test_browser_thread.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 using browser_sync::DataTypeController; | 20 using browser_sync::DataTypeController; |
20 using content::BrowserThread; | 21 using content::BrowserThread; |
21 | 22 |
22 class ProfileSyncComponentsFactoryImplTest : public testing::Test { | 23 class ProfileSyncComponentsFactoryImplTest : public testing::Test { |
23 protected: | 24 protected: |
24 ProfileSyncComponentsFactoryImplTest() | 25 ProfileSyncComponentsFactoryImplTest() |
25 : ui_thread_(BrowserThread::UI, &message_loop_) {} | 26 : ui_thread_(BrowserThread::UI, &message_loop_) {} |
26 | 27 |
27 virtual void SetUp() { | 28 virtual void SetUp() { |
28 profile_.reset(new TestingProfile()); | 29 profile_.reset(new TestingProfile()); |
29 base::FilePath program_path(FILE_PATH_LITERAL("chrome.exe")); | 30 base::FilePath program_path(FILE_PATH_LITERAL("chrome.exe")); |
30 command_line_.reset(new CommandLine(program_path)); | 31 command_line_.reset(new CommandLine(program_path)); |
31 } | 32 } |
32 | 33 |
33 // Returns the collection of default datatypes. | 34 // Returns the collection of default datatypes. |
34 static std::vector<syncer::ModelType> DefaultDatatypes() { | 35 static std::vector<syncer::ModelType> DefaultDatatypes() { |
| 36 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
35 std::vector<syncer::ModelType> datatypes; | 37 std::vector<syncer::ModelType> datatypes; |
36 datatypes.push_back(syncer::APPS); | 38 datatypes.push_back(syncer::APPS); |
37 datatypes.push_back(syncer::APP_SETTINGS); | 39 datatypes.push_back(syncer::APP_SETTINGS); |
38 datatypes.push_back(syncer::AUTOFILL); | 40 datatypes.push_back(syncer::AUTOFILL); |
39 datatypes.push_back(syncer::AUTOFILL_PROFILE); | 41 datatypes.push_back(syncer::AUTOFILL_PROFILE); |
40 datatypes.push_back(syncer::BOOKMARKS); | 42 datatypes.push_back(syncer::BOOKMARKS); |
41 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) | 43 #if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_CHROMEOS) |
42 datatypes.push_back(syncer::DICTIONARY); | 44 datatypes.push_back(syncer::DICTIONARY); |
43 #endif | 45 #endif |
44 datatypes.push_back(syncer::EXTENSIONS); | 46 datatypes.push_back(syncer::EXTENSIONS); |
45 datatypes.push_back(syncer::EXTENSION_SETTINGS); | 47 datatypes.push_back(syncer::EXTENSION_SETTINGS); |
46 datatypes.push_back(syncer::PASSWORDS); | 48 datatypes.push_back(syncer::PASSWORDS); |
47 datatypes.push_back(syncer::PREFERENCES); | 49 datatypes.push_back(syncer::PREFERENCES); |
48 datatypes.push_back(syncer::SEARCH_ENGINES); | 50 datatypes.push_back(syncer::SEARCH_ENGINES); |
49 datatypes.push_back(syncer::SESSIONS); | 51 datatypes.push_back(syncer::SESSIONS); |
| 52 if (channel == chrome::VersionInfo::CHANNEL_UNKNOWN || |
| 53 channel == chrome::VersionInfo::CHANNEL_DEV || |
| 54 channel == chrome::VersionInfo::CHANNEL_CANARY) { |
| 55 datatypes.push_back(syncer::SYNCED_NOTIFICATIONS); |
| 56 } |
50 datatypes.push_back(syncer::PROXY_TABS); | 57 datatypes.push_back(syncer::PROXY_TABS); |
51 datatypes.push_back(syncer::THEMES); | 58 datatypes.push_back(syncer::THEMES); |
52 datatypes.push_back(syncer::TYPED_URLS); | 59 datatypes.push_back(syncer::TYPED_URLS); |
53 return datatypes; | 60 return datatypes; |
54 } | 61 } |
55 | 62 |
56 // Returns the number of default datatypes. | 63 // Returns the number of default datatypes. |
57 static size_t DefaultDatatypesCount() { | 64 static size_t DefaultDatatypesCount() { |
58 return DefaultDatatypes().size(); | 65 return DefaultDatatypes().size(); |
59 } | 66 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 155 |
149 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableAutofillProfile) { | 156 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisableAutofillProfile) { |
150 TestSwitchDisablesType(switches::kDisableSyncAutofillProfile, | 157 TestSwitchDisablesType(switches::kDisableSyncAutofillProfile, |
151 syncer::AUTOFILL_PROFILE); | 158 syncer::AUTOFILL_PROFILE); |
152 } | 159 } |
153 | 160 |
154 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisablePasswords) { | 161 TEST_F(ProfileSyncComponentsFactoryImplTest, CreatePSSDisablePasswords) { |
155 TestSwitchDisablesType(switches::kDisableSyncPasswords, | 162 TestSwitchDisablesType(switches::kDisableSyncPasswords, |
156 syncer::PASSWORDS); | 163 syncer::PASSWORDS); |
157 } | 164 } |
OLD | NEW |