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

Side by Side Diff: chrome/test/base/testing_profile.cc

Issue 2907493002: ChromeOS: Per-user time zone: refactor tests first. (Closed)
Patch Set: Move more code from dependent CL here. Created 3 years, 6 months 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 (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 "chrome/test/base/testing_profile.h" 5 #include "chrome/test/base/testing_profile.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
19 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
20 #include "base/threading/thread_restrictions.h" 20 #include "base/threading/thread_restrictions.h"
21 #include "base/threading/thread_task_runner_handle.h" 21 #include "base/threading/thread_task_runner_handle.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h" 23 #include "chrome/browser/autocomplete/in_memory_url_index_factory.h"
24 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 24 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
25 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" 25 #include "chrome/browser/bookmarks/chrome_bookmark_client.h"
26 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" 26 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
27 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
28 #include "chrome/browser/chrome_notification_types.h" 28 #include "chrome/browser/chrome_notification_types.h"
29 #include "chrome/browser/chromeos/settings/cros_settings.h"
29 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 30 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
30 #include "chrome/browser/favicon/chrome_fallback_icon_client_factory.h" 31 #include "chrome/browser/favicon/chrome_fallback_icon_client_factory.h"
31 #include "chrome/browser/favicon/fallback_icon_service_factory.h" 32 #include "chrome/browser/favicon/fallback_icon_service_factory.h"
32 #include "chrome/browser/favicon/favicon_service_factory.h" 33 #include "chrome/browser/favicon/favicon_service_factory.h"
33 #include "chrome/browser/history/chrome_history_client.h" 34 #include "chrome/browser/history/chrome_history_client.h"
34 #include "chrome/browser/history/history_service_factory.h" 35 #include "chrome/browser/history/history_service_factory.h"
35 #include "chrome/browser/history/web_history_service_factory.h" 36 #include "chrome/browser/history/web_history_service_factory.h"
36 #include "chrome/browser/net/proxy_service_factory.h" 37 #include "chrome/browser/net/proxy_service_factory.h"
37 #include "chrome/browser/policy/profile_policy_connector.h" 38 #include "chrome/browser/policy/profile_policy_connector.h"
38 #include "chrome/browser/policy/profile_policy_connector_factory.h" 39 #include "chrome/browser/policy/profile_policy_connector_factory.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 422 }
422 } 423 }
423 424
424 void TestingProfile::Init() { 425 void TestingProfile::Init() {
425 base::ThreadRestrictions::ScopedAllowIO allow_io; 426 base::ThreadRestrictions::ScopedAllowIO allow_io;
426 // If threads have been initialized, we should be on the UI thread. 427 // If threads have been initialized, we should be on the UI thread.
427 DCHECK(!content::BrowserThread::IsThreadInitialized( 428 DCHECK(!content::BrowserThread::IsThreadInitialized(
428 content::BrowserThread::UI) || 429 content::BrowserThread::UI) ||
429 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 430 content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
430 431
432 #if defined(OS_CHROMEOS)
433 if (!chromeos::CrosSettings::IsInitialized())
434 scoped_cros_settings_test_helper_.reset(
435 new chromeos::ScopedCrosSettingsTestHelper);
436 #endif
437
431 set_is_guest_profile(guest_session_); 438 set_is_guest_profile(guest_session_);
432 439
433 BrowserContext::Initialize(this, profile_path_); 440 BrowserContext::Initialize(this, profile_path_);
434 441
435 browser_context_dependency_manager_->MarkBrowserContextLive(this); 442 browser_context_dependency_manager_->MarkBrowserContextLive(this);
436 443
437 #if defined(OS_ANDROID) 444 #if defined(OS_ANDROID)
438 // Make sure token service knows its running in tests. 445 // Make sure token service knows its running in tests.
439 OAuth2TokenServiceDelegateAndroid::set_is_testing_profile(); 446 OAuth2TokenServiceDelegateAndroid::set_is_testing_profile();
440 #endif 447 #endif
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 // Note: Owned by |original_profile|. 1112 // Note: Owned by |original_profile|.
1106 return new TestingProfile(path_, delegate_, 1113 return new TestingProfile(path_, delegate_,
1107 #if BUILDFLAG(ENABLE_EXTENSIONS) 1114 #if BUILDFLAG(ENABLE_EXTENSIONS)
1108 extension_policy_, 1115 extension_policy_,
1109 #endif 1116 #endif
1110 std::move(pref_service_), original_profile, 1117 std::move(pref_service_), original_profile,
1111 guest_session_, supervised_user_id_, 1118 guest_session_, supervised_user_id_,
1112 std::move(policy_service_), testing_factories_, 1119 std::move(policy_service_), testing_factories_,
1113 profile_name_); 1120 profile_name_);
1114 } 1121 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698