OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/extensions/api/preferences_private/preferences_private_
api.h" | 15 #include "chrome/browser/extensions/api/preferences_private/preferences_private_
api.h" |
16 #include "chrome/browser/extensions/extension_apitest.h" | 16 #include "chrome/browser/extensions/extension_apitest.h" |
17 #include "chrome/browser/extensions/extension_function_test_utils.h" | 17 #include "chrome/browser/extensions/extension_function_test_utils.h" |
18 #include "chrome/browser/extensions/extension_test_message_listener.h" | 18 #include "chrome/browser/extensions/extension_test_message_listener.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
21 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 21 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
22 #include "chrome/browser/sync/profile_sync_service.h" | 22 #include "chrome/browser/sync/profile_sync_service.h" |
23 #include "chrome/browser/sync/profile_sync_service_factory.h" | 23 #include "chrome/browser/sync/profile_sync_service_factory.h" |
24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
25 #include "chrome/common/chrome_constants.h" | 25 #include "chrome/common/chrome_constants.h" |
26 #include "chrome/common/chrome_paths.h" | 26 #include "chrome/common/chrome_paths.h" |
27 #include "chrome/test/base/testing_profile.h" | 27 #include "chrome/test/base/testing_profile.h" |
| 28 #include "components/sync_driver/sync_prefs.h" |
28 #include "content/public/browser/browser_context.h" | 29 #include "content/public/browser/browser_context.h" |
29 | 30 |
30 using extensions::PreferencesPrivateGetSyncCategoriesWithoutPassphraseFunction; | 31 using extensions::PreferencesPrivateGetSyncCategoriesWithoutPassphraseFunction; |
31 | 32 |
32 namespace { | 33 namespace { |
33 | 34 |
34 class FakeProfileSyncService : public ProfileSyncService { | 35 class FakeProfileSyncService : public ProfileSyncService { |
35 public: | 36 public: |
36 explicit FakeProfileSyncService(Profile* profile) | 37 explicit FakeProfileSyncService(Profile* profile) |
37 : ProfileSyncService( | 38 : ProfileSyncService( |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 ExtensionApiTest::SetUpOnMainThread(); | 110 ExtensionApiTest::SetUpOnMainThread(); |
110 | 111 |
111 base::FilePath path; | 112 base::FilePath path; |
112 PathService::Get(chrome::DIR_USER_DATA, &path); | 113 PathService::Get(chrome::DIR_USER_DATA, &path); |
113 path = path.AppendASCII("test_profile"); | 114 path = path.AppendASCII("test_profile"); |
114 if (!base::PathExists(path)) | 115 if (!base::PathExists(path)) |
115 CHECK(base::CreateDirectory(path)); | 116 CHECK(base::CreateDirectory(path)); |
116 | 117 |
117 Profile* profile = | 118 Profile* profile = |
118 Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS); | 119 Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS); |
119 browser_sync::SyncPrefs sync_prefs(profile->GetPrefs()); | 120 sync_driver::SyncPrefs sync_prefs(profile->GetPrefs()); |
120 sync_prefs.SetKeepEverythingSynced(false); | 121 sync_prefs.SetKeepEverythingSynced(false); |
121 | 122 |
122 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 123 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
123 profile_manager->RegisterTestingProfile(profile, true, false); | 124 profile_manager->RegisterTestingProfile(profile, true, false); |
124 browser_ = new Browser(Browser::CreateParams( | 125 browser_ = new Browser(Browser::CreateParams( |
125 profile, chrome::HOST_DESKTOP_TYPE_NATIVE)); | 126 profile, chrome::HOST_DESKTOP_TYPE_NATIVE)); |
126 | 127 |
127 service_ = static_cast<FakeProfileSyncService*>( | 128 service_ = static_cast<FakeProfileSyncService*>( |
128 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 129 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
129 profile, &FakeProfileSyncService::BuildFakeProfileSyncService)); | 130 profile, &FakeProfileSyncService::BuildFakeProfileSyncService)); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 178 |
178 // Verifies that we wait for the sync service to be ready before checking | 179 // Verifies that we wait for the sync service to be ready before checking |
179 // encryption status. | 180 // encryption status. |
180 IN_PROC_BROWSER_TEST_F(PreferencesPrivateApiTest, | 181 IN_PROC_BROWSER_TEST_F(PreferencesPrivateApiTest, |
181 GetSyncCategoriesWithoutPassphraseAsynchronous) { | 182 GetSyncCategoriesWithoutPassphraseAsynchronous) { |
182 service_->set_sync_initialized(false); | 183 service_->set_sync_initialized(false); |
183 TestGetSyncCategoriesWithoutPassphraseFunction(); | 184 TestGetSyncCategoriesWithoutPassphraseFunction(); |
184 } | 185 } |
185 | 186 |
186 } // namespace | 187 } // namespace |
OLD | NEW |