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 "chrome_frame/test/net/fake_external_tab.h" | 5 #include "chrome_frame/test/net/fake_external_tab.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlcom.h> | 8 #include <atlcom.h> |
9 #include <exdisp.h> | 9 #include <exdisp.h> |
10 #include <Winsock2.h> | 10 #include <Winsock2.h> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "base/system_monitor/system_monitor.h" | 26 #include "base/system_monitor/system_monitor.h" |
27 #include "base/test/test_timeouts.h" | 27 #include "base/test/test_timeouts.h" |
28 #include "base/threading/platform_thread.h" | 28 #include "base/threading/platform_thread.h" |
29 #include "base/threading/thread.h" | 29 #include "base/threading/thread.h" |
30 #include "base/win/scoped_comptr.h" | 30 #include "base/win/scoped_comptr.h" |
31 #include "base/win/scoped_handle.h" | 31 #include "base/win/scoped_handle.h" |
32 #include "chrome/app/chrome_main_delegate.h" | 32 #include "chrome/app/chrome_main_delegate.h" |
33 #include "chrome/browser/automation/automation_provider_list.h" | 33 #include "chrome/browser/automation/automation_provider_list.h" |
34 #include "chrome/browser/chrome_content_browser_client.h" | 34 #include "chrome/browser/chrome_content_browser_client.h" |
35 #include "chrome/browser/prefs/browser_prefs.h" | 35 #include "chrome/browser/prefs/browser_prefs.h" |
| 36 #include "chrome/browser/prefs/pref_registry_simple.h" |
36 #include "chrome/browser/prefs/pref_service.h" | 37 #include "chrome/browser/prefs/pref_service.h" |
37 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 38 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
38 #include "chrome/browser/process_singleton.h" | 39 #include "chrome/browser/process_singleton.h" |
39 #include "chrome/browser/profiles/profile_manager.h" | 40 #include "chrome/browser/profiles/profile_manager.h" |
40 #include "chrome/browser/renderer_host/web_cache_manager.h" | 41 #include "chrome/browser/renderer_host/web_cache_manager.h" |
41 #include "chrome/common/chrome_constants.h" | 42 #include "chrome/common/chrome_constants.h" |
42 #include "chrome/common/chrome_content_client.h" | 43 #include "chrome/common/chrome_content_client.h" |
43 #include "chrome/common/chrome_paths.h" | 44 #include "chrome/common/chrome_paths.h" |
44 #include "chrome/common/chrome_paths_internal.h" | 45 #include "chrome/common/chrome_paths_internal.h" |
45 #include "chrome/common/chrome_switches.h" | 46 #include "chrome/common/chrome_switches.h" |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 JsonPrefStore::GetTaskRunnerForFile(local_state_path, | 510 JsonPrefStore::GetTaskRunnerForFile(local_state_path, |
510 BrowserThread::GetBlockingPool()); | 511 BrowserThread::GetBlockingPool()); |
511 browser_process_.reset(new FakeBrowserProcessImpl(local_state_task_runner, | 512 browser_process_.reset(new FakeBrowserProcessImpl(local_state_task_runner, |
512 *cmd)); | 513 *cmd)); |
513 // BrowserProcessImpl's constructor should set g_browser_process. | 514 // BrowserProcessImpl's constructor should set g_browser_process. |
514 DCHECK(g_browser_process); | 515 DCHECK(g_browser_process); |
515 g_browser_process->SetApplicationLocale("en-US"); | 516 g_browser_process->SetApplicationLocale("en-US"); |
516 | 517 |
517 content::RenderProcessHost::SetRunRendererInProcess(true); | 518 content::RenderProcessHost::SetRunRendererInProcess(true); |
518 | 519 |
519 browser_process_->local_state()->RegisterBooleanPref( | 520 // TODO(joi): Registration should be done up front via browser_prefs.cc |
520 prefs::kMetricsReportingEnabled, false); | 521 scoped_refptr<PrefRegistrySimple> registry = static_cast<PrefRegistrySimple*>( |
| 522 browser_process_->local_state()->DeprecatedGetPrefRegistry()); |
| 523 if (!browser_process_->local_state()->FindPreference( |
| 524 prefs::kMetricsReportingEnabled)) { |
| 525 registry->RegisterBooleanPref(prefs::kMetricsReportingEnabled, false); |
| 526 } |
521 } | 527 } |
522 | 528 |
523 void FakeExternalTab::InitializePostThreadsCreated() { | 529 void FakeExternalTab::InitializePostThreadsCreated() { |
524 FilePath profile_path(ProfileManager::GetDefaultProfileDir(user_data())); | 530 FilePath profile_path(ProfileManager::GetDefaultProfileDir(user_data())); |
525 Profile* profile = | 531 Profile* profile = |
526 g_browser_process->profile_manager()->GetProfile(profile_path); | 532 g_browser_process->profile_manager()->GetProfile(profile_path); |
527 } | 533 } |
528 | 534 |
529 void FakeExternalTab::Shutdown() { | 535 void FakeExternalTab::Shutdown() { |
530 browser_process_.reset(); | 536 browser_process_.reset(); |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 // content::InitializeSandboxInfo(&sandbox_info); | 964 // content::InitializeSandboxInfo(&sandbox_info); |
959 FakeMainDelegate delegate; | 965 FakeMainDelegate delegate; |
960 content::ContentMain( | 966 content::ContentMain( |
961 reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL)), | 967 reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL)), |
962 &sandbox_info, | 968 &sandbox_info, |
963 &delegate); | 969 &delegate); |
964 | 970 |
965 // Note: In debug builds, we ExitProcess during PostDestroyThreads. | 971 // Note: In debug builds, we ExitProcess during PostDestroyThreads. |
966 return g_test_suite->test_result(); | 972 return g_test_suite->test_result(); |
967 } | 973 } |
OLD | NEW |