Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: chrome/browser/extensions/api/preferences_private/preferences_private_apitest.cc

Issue 1422773004: [sync] Abstract most ProfileSyncService //chrome deps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pss_chrome_signin_deps
Patch Set: Response to review Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
15 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/extensions/api/preferences_private/preferences_private_ api.h" 18 #include "chrome/browser/extensions/api/preferences_private/preferences_private_ api.h"
19 #include "chrome/browser/extensions/extension_apitest.h" 19 #include "chrome/browser/extensions/extension_apitest.h"
20 #include "chrome/browser/extensions/extension_function_test_utils.h" 20 #include "chrome/browser/extensions/extension_function_test_utils.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/profiles/profile_manager.h" 22 #include "chrome/browser/profiles/profile_manager.h"
23 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 23 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
24 #include "chrome/browser/sync/chrome_sync_client.h" 24 #include "chrome/browser/sync/chrome_sync_client.h"
25 #include "chrome/browser/sync/profile_sync_service.h" 25 #include "chrome/browser/sync/profile_sync_service.h"
26 #include "chrome/browser/sync/profile_sync_service_factory.h" 26 #include "chrome/browser/sync/profile_sync_service_factory.h"
27 #include "chrome/browser/sync/profile_sync_test_util.h" 27 #include "chrome/browser/sync/profile_sync_test_util.h"
28 #include "chrome/browser/ui/browser.h" 28 #include "chrome/browser/ui/browser.h"
29 #include "chrome/common/channel_info.h"
29 #include "chrome/common/chrome_constants.h" 30 #include "chrome/common/chrome_constants.h"
30 #include "chrome/common/chrome_paths.h" 31 #include "chrome/common/chrome_paths.h"
31 #include "chrome/test/base/testing_profile.h" 32 #include "chrome/test/base/testing_profile.h"
32 #include "components/bookmarks/common/bookmark_constants.h" 33 #include "components/bookmarks/common/bookmark_constants.h"
33 #include "components/sync_driver/signin_manager_wrapper.h" 34 #include "components/sync_driver/signin_manager_wrapper.h"
34 #include "components/sync_driver/sync_api_component_factory_mock.h" 35 #include "components/sync_driver/sync_api_component_factory_mock.h"
35 #include "components/sync_driver/sync_prefs.h" 36 #include "components/sync_driver/sync_prefs.h"
36 #include "content/public/browser/browser_context.h" 37 #include "content/public/browser/browser_context.h"
37 #include "extensions/test/extension_test_message_listener.h" 38 #include "extensions/test/extension_test_message_listener.h"
38 39
39 #if defined(OS_CHROMEOS) 40 #if defined(OS_CHROMEOS)
40 #include "chromeos/chromeos_switches.h" 41 #include "chromeos/chromeos_switches.h"
41 #endif 42 #endif
42 43
43 using extensions::PreferencesPrivateGetSyncCategoriesWithoutPassphraseFunction; 44 using extensions::PreferencesPrivateGetSyncCategoriesWithoutPassphraseFunction;
44 45
45 namespace { 46 namespace {
46 47
47 class FakeProfileSyncService : public ProfileSyncService { 48 class FakeProfileSyncService : public ProfileSyncService {
48 public: 49 public:
49 explicit FakeProfileSyncService(Profile* profile) 50 explicit FakeProfileSyncService(Profile* profile)
50 : ProfileSyncService( 51 : ProfileSyncService(
51 make_scoped_ptr(new browser_sync::ChromeSyncClient( 52 make_scoped_ptr(new browser_sync::ChromeSyncClient(
52 profile, 53 profile,
53 make_scoped_ptr(new SyncApiComponentFactoryMock()))), 54 make_scoped_ptr(new SyncApiComponentFactoryMock()))),
54 profile, 55 profile,
55 make_scoped_ptr<SigninManagerWrapper>(NULL), 56 make_scoped_ptr<SigninManagerWrapper>(NULL),
56 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 57 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
57 browser_sync::MANUAL_START, 58 browser_sync::MANUAL_START,
58 base::Bind(&EmptyNetworkTimeUpdate)), 59 base::Bind(&EmptyNetworkTimeUpdate),
60 profile->GetPath(),
61 profile->GetRequestContext(),
62 profile->GetDebugName(),
63 chrome::GetChannel(),
64 content::BrowserThread::GetMessageLoopProxyForThread(
65 content::BrowserThread::DB),
66 content::BrowserThread::GetMessageLoopProxyForThread(
67 content::BrowserThread::FILE),
68 content::BrowserThread::GetBlockingPool()),
59 sync_initialized_(true), 69 sync_initialized_(true),
60 initialized_state_violation_(false) {} 70 initialized_state_violation_(false) {}
61 71
62 ~FakeProfileSyncService() override {} 72 ~FakeProfileSyncService() override {}
63 73
64 static scoped_ptr<KeyedService> BuildFakeProfileSyncService( 74 static scoped_ptr<KeyedService> BuildFakeProfileSyncService(
65 content::BrowserContext* context) { 75 content::BrowserContext* context) {
66 return make_scoped_ptr( 76 return make_scoped_ptr(
67 new FakeProfileSyncService(static_cast<Profile*>(context))); 77 new FakeProfileSyncService(static_cast<Profile*>(context)));
68 } 78 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 205
196 // Verifies that we wait for the sync service to be ready before checking 206 // Verifies that we wait for the sync service to be ready before checking
197 // encryption status. 207 // encryption status.
198 IN_PROC_BROWSER_TEST_F(PreferencesPrivateApiTest, 208 IN_PROC_BROWSER_TEST_F(PreferencesPrivateApiTest,
199 GetSyncCategoriesWithoutPassphraseAsynchronous) { 209 GetSyncCategoriesWithoutPassphraseAsynchronous) {
200 service_->set_sync_initialized(false); 210 service_->set_sync_initialized(false);
201 TestGetSyncCategoriesWithoutPassphraseFunction(); 211 TestGetSyncCategoriesWithoutPassphraseFunction();
202 } 212 }
203 213
204 } // namespace 214 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sync/chrome_sync_client.h » ('j') | chrome/browser/sync/profile_sync_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698