summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-05 21:59:33 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-05 21:59:33 +0000
commitc1f87b2a4f2d08b92db6f0c7f4f6661d5166feb9 (patch)
treed1348080214f9bab7a2f3d2b7f6e474b55cb24d5
parent5435643695ec7f4e77fd4a2cda5bfa1222ec198f (diff)
downloadchromium_src-c1f87b2a4f2d08b92db6f0c7f4f6661d5166feb9.zip
chromium_src-c1f87b2a4f2d08b92db6f0c7f4f6661d5166feb9.tar.gz
chromium_src-c1f87b2a4f2d08b92db6f0c7f4f6661d5166feb9.tar.bz2
Make an empty content browser test work.
BUG=90448 Review URL: http://codereview.chromium.org/8137012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104181 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/test/base/chrome_test_launcher.cc36
-rw-r--r--content/browser/browser_main.cc3
-rw-r--r--content/content_shell.gypi60
-rw-r--r--content/content_tests.gypi36
-rw-r--r--content/shell/shell_main.cc58
-rw-r--r--content/shell/shell_main_delegate.cc53
-rw-r--r--content/shell/shell_main_delegate.h44
-rw-r--r--content/test/content_browser_test.cc15
-rw-r--r--content/test/content_browser_test.h9
-rw-r--r--content/test/content_test_launcher.cc39
-rw-r--r--content/test/test_launcher.cc36
-rw-r--r--content/test/test_launcher.h1
12 files changed, 255 insertions, 135 deletions
diff --git a/chrome/test/base/chrome_test_launcher.cc b/chrome/test/base/chrome_test_launcher.cc
index 57eb5b1..ce1fb9e 100644
--- a/chrome/test/base/chrome_test_launcher.cc
+++ b/chrome/test/base/chrome_test_launcher.cc
@@ -41,37 +41,8 @@ class ChromeTestLauncherDelegate : public test_launcher::TestLauncherDelegate {
}
virtual bool Run(int argc, char** argv, int* return_code) OVERRIDE {
- CommandLine* command_line = CommandLine::ForCurrentProcess();
-
- // TODO(pkasting): This "single_process vs. single-process" design is
- // terrible UI. Instead, there should be some sort of signal flag on the
- // command line, with all subsequent arguments passed through to the
- // underlying browser.
- if (command_line->HasSwitch(test_launcher::kSingleProcessTestsFlag) ||
- command_line->HasSwitch(
- test_launcher::kSingleProcessTestsAndChromeFlag) ||
- command_line->HasSwitch(test_launcher::kGTestListTestsFlag) ||
- command_line->HasSwitch(test_launcher::kGTestHelpFlag)) {
-#if defined(OS_WIN)
- if (command_line->HasSwitch(test_launcher::kSingleProcessTestsFlag)) {
- // This is the browser process, so setup the sandbox broker.
- sandbox::BrokerServices* broker_services =
- sandbox::SandboxFactory::GetBrokerServices();
- if (broker_services) {
- sandbox::InitBrokerServices(broker_services);
- // Precreate the desktop and window station used by the renderers.
- sandbox::TargetPolicy* policy = broker_services->CreatePolicy();
- sandbox::ResultCode result = policy->CreateAlternateDesktop(true);
- CHECK(sandbox::SBOX_ERROR_FAILED_TO_SWITCH_BACK_WINSTATION != result);
- policy->Release();
- }
- }
-#endif
- *return_code = ChromeTestSuite(argc, argv).Run();
- return true;
- }
-
#if defined(OS_WIN)
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kProcessType)) {
// This is a child process, call ChromeMain.
FilePath chrome_path(command_line->GetProgram().DirName());
@@ -91,9 +62,14 @@ class ChromeTestLauncherDelegate : public test_launcher::TestLauncherDelegate {
return true;
}
#endif // defined(OS_WIN)
+
return false;
}
+ virtual int RunTestSuite(int argc, char** argv) OVERRIDE {
+ return ChromeTestSuite(argc, argv).Run();
+ }
+
virtual bool AdjustChildProcessCommandLine(
CommandLine* command_line) OVERRIDE {
CommandLine new_command_line(command_line->GetProgram());
diff --git a/content/browser/browser_main.cc b/content/browser/browser_main.cc
index d28e35c..6a7833c 100644
--- a/content/browser/browser_main.cc
+++ b/content/browser/browser_main.cc
@@ -340,6 +340,9 @@ void BrowserMainParts::PreMainMessageLoopRun() {
}
void BrowserMainParts::MainMessageLoopRun() {
+ if (parameters().ui_task)
+ MessageLoopForUI::current()->PostTask(FROM_HERE, parameters().ui_task);
+
#if defined(OS_MACOSX)
MessageLoopForUI::current()->Run();
#else
diff --git a/content/content_shell.gypi b/content/content_shell.gypi
index 44607357..c818460 100644
--- a/content/content_shell.gypi
+++ b/content/content_shell.gypi
@@ -5,8 +5,8 @@
{
'targets': [
{
- 'target_name': 'content_shell',
- 'type': 'executable',
+ 'target_name': 'content_shell_lib',
+ 'type': 'static_library',
'defines!': ['CONTENT_IMPLEMENTATION'],
'variables': {
'chromium_code': 1,
@@ -65,7 +65,8 @@
'shell/shell_content_utility_client.h',
'shell/shell_download_manager_delegate.cc',
'shell/shell_download_manager_delegate.h',
- 'shell/shell_main.cc',
+ 'shell/shell_main_delegate.cc',
+ 'shell/shell_main_delegate.h',
'shell/shell_resource_context.cc',
'shell/shell_resource_context.h',
'shell/shell_url_request_context_getter.cc',
@@ -86,19 +87,6 @@
'resource_include_dirs': [
'<(SHARED_INTERMEDIATE_DIR)/webkit',
],
- 'sources': [
- 'shell/resource.h',
- 'shell/shell.rc',
- # TODO: It would be nice to have these pulled in
- # automatically from direct_dependent_settings in
- # their various targets (net.gyp:net_resources, etc.),
- # but that causes errors in other targets when
- # resulting .res files get referenced multiple times.
- '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc',
- '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc',
- '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc',
- '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.rc',
- ],
'dependencies': [
'<(DEPTH)/net/net.gyp:net_resources',
'<(DEPTH)/webkit/support/webkit_support.gyp:webkit_resources',
@@ -116,5 +104,45 @@
}],
],
},
+ {
+ 'target_name': 'content_shell',
+ 'type': 'executable',
+ 'defines!': ['CONTENT_IMPLEMENTATION'],
+ 'variables': {
+ 'chromium_code': 1,
+ },
+ 'dependencies': [
+ 'content_shell_lib',
+ ],
+ 'include_dirs': [
+ '..',
+ ],
+ 'sources': [
+ 'shell/shell_main.cc',
+ ],
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'SubSystem': '2', # Set /SUBSYSTEM:WINDOWS
+ },
+ },
+ 'conditions': [
+ ['OS=="win" and win_use_allocator_shim==1', {
+ 'dependencies': [
+ '../base/allocator/allocator.gyp:allocator',
+ ],
+ }],
+ ['OS=="win"', {
+ 'configurations': {
+ 'Debug_Base': {
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
+ },
+ },
+ },
+ },
+ }],
+ ],
+ },
],
}
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index ea9500f..bf45a0e 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -220,9 +220,11 @@
'content_gpu',
'content_plugin',
'content_renderer',
+ 'content_shell_lib',
'test_support_content',
'../base/base.gyp:test_support_base',
'../net/net.gyp:net_test_support',
+ '../skia/skia.gyp:skia',
'../testing/gtest.gyp:gtest',
'../ui/ui.gyp:ui',
'../webkit/support/webkit_support.gyp:glue',
@@ -242,14 +244,42 @@
],
'conditions': [
['OS=="win"', {
- 'dependencies': [
- '../sandbox/sandbox.gyp:sandbox',
- ],
'link_settings': {
'libraries': [
'-lcomctl32.lib',
],
},
+ 'resource_include_dirs': [
+ '<(SHARED_INTERMEDIATE_DIR)/webkit',
+ ],
+ 'sources': [
+ 'shell/resource.h',
+ 'shell/shell.rc',
+ # TODO: It would be nice to have these pulled in
+ # automatically from direct_dependent_settings in
+ # their various targets (net.gyp:net_resources, etc.),
+ # but that causes errors in other targets when
+ # resulting .res files get referenced multiple times.
+ '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.rc',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.rc',
+ ],
+ 'dependencies': [
+ '<(DEPTH)/net/net.gyp:net_resources',
+ '<(DEPTH)/webkit/support/webkit_support.gyp:webkit_resources',
+ '<(DEPTH)/webkit/support/webkit_support.gyp:webkit_strings',
+ '../sandbox/sandbox.gyp:sandbox',
+ ],
+ 'configurations': {
+ 'Debug_Base': {
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'LinkIncremental': '<(msvs_large_module_debug_link_mode)',
+ },
+ },
+ },
+ },
}],
['OS=="win" and win_use_allocator_shim==1', {
'dependencies': [
diff --git a/content/shell/shell_main.cc b/content/shell/shell_main.cc
index c5a9227..d6b2dde 100644
--- a/content/shell/shell_main.cc
+++ b/content/shell/shell_main.cc
@@ -4,69 +4,13 @@
#include "content/app/content_main.h"
-#include "base/command_line.h"
-#include "base/memory/scoped_ptr.h"
-#include "content/app/content_main_delegate.h"
-#include "content/common/content_switches.h"
-#include "content/shell/shell_content_browser_client.h"
-#include "content/shell/shell_content_client.h"
-#include "content/shell/shell_content_plugin_client.h"
-#include "content/shell/shell_content_renderer_client.h"
-#include "content/shell/shell_content_utility_client.h"
+#include "content/shell/shell_main_delegate.h"
#include "sandbox/src/sandbox_types.h"
#if defined(OS_WIN)
#include "content/app/startup_helper_win.h"
#endif
-namespace {
-
-class ShellMainDelegate : public content::ContentMainDelegate {
- public:
- virtual void PreSandboxStartup() OVERRIDE {
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- std::string process_type =
- command_line.GetSwitchValueASCII(switches::kProcessType);
-
- content::SetContentClient(&content_client_);
- InitializeShellContentClient(process_type);
- }
-
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
- virtual void ZygoteForked() OVERRIDE {
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- std::string process_type =
- command_line.GetSwitchValueASCII(switches::kProcessType);
- InitializeShellContentClient(process_type);
- }
-#endif
-
- private:
- void InitializeShellContentClient(const std::string& process_type) {
- if (process_type.empty()) {
- browser_client_.reset(new content::ShellContentBrowserClient);
- content::GetContentClient()->set_browser(browser_client_.get());
- } else if (process_type == switches::kRendererProcess) {
- renderer_client_.reset(new content::ShellContentRendererClient);
- content::GetContentClient()->set_renderer(renderer_client_.get());
- } else if (process_type == switches::kPluginProcess) {
- plugin_client_.reset(new content::ShellContentPluginClient);
- content::GetContentClient()->set_plugin(plugin_client_.get());
- } else if (process_type == switches::kUtilityProcess) {
- utility_client_.reset(new content::ShellContentUtilityClient);
- content::GetContentClient()->set_utility(utility_client_.get());
- }
- }
-
- scoped_ptr<content::ShellContentBrowserClient> browser_client_;
- scoped_ptr<content::ShellContentRendererClient> renderer_client_;
- scoped_ptr<content::ShellContentPluginClient> plugin_client_;
- scoped_ptr<content::ShellContentUtilityClient> utility_client_;
- content::ShellContentClient content_client_;
-};
-
-} // namespace
-
#if defined(OS_WIN)
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
diff --git a/content/shell/shell_main_delegate.cc b/content/shell/shell_main_delegate.cc
new file mode 100644
index 0000000..0cd3f9f
--- /dev/null
+++ b/content/shell/shell_main_delegate.cc
@@ -0,0 +1,53 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/shell/shell_main_delegate.h"
+
+#include "base/command_line.h"
+#include "content/common/content_switches.h"
+#include "content/shell/shell_content_browser_client.h"
+#include "content/shell/shell_content_plugin_client.h"
+#include "content/shell/shell_content_renderer_client.h"
+#include "content/shell/shell_content_utility_client.h"
+
+ShellMainDelegate::ShellMainDelegate() {
+}
+
+ShellMainDelegate::~ShellMainDelegate() {
+}
+
+void ShellMainDelegate::PreSandboxStartup() {
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ std::string process_type =
+ command_line.GetSwitchValueASCII(switches::kProcessType);
+
+ content::SetContentClient(&content_client_);
+ InitializeShellContentClient(process_type);
+}
+
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+void ShellMainDelegate::ZygoteForked() {
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ std::string process_type =
+ command_line.GetSwitchValueASCII(switches::kProcessType);
+ InitializeShellContentClient(process_type);
+}
+#endif
+
+void ShellMainDelegate::InitializeShellContentClient(
+ const std::string& process_type) {
+ if (process_type.empty()) {
+ browser_client_.reset(new content::ShellContentBrowserClient);
+ content::GetContentClient()->set_browser(browser_client_.get());
+ } else if (process_type == switches::kRendererProcess) {
+ renderer_client_.reset(new content::ShellContentRendererClient);
+ content::GetContentClient()->set_renderer(renderer_client_.get());
+ } else if (process_type == switches::kPluginProcess) {
+ plugin_client_.reset(new content::ShellContentPluginClient);
+ content::GetContentClient()->set_plugin(plugin_client_.get());
+ } else if (process_type == switches::kUtilityProcess) {
+ utility_client_.reset(new content::ShellContentUtilityClient);
+ content::GetContentClient()->set_utility(utility_client_.get());
+ }
+} \ No newline at end of file
diff --git a/content/shell/shell_main_delegate.h b/content/shell/shell_main_delegate.h
new file mode 100644
index 0000000..a150688
--- /dev/null
+++ b/content/shell/shell_main_delegate.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_SHELL_SHELL_MAIN_DELEGATE_H_
+#define CONTENT_SHELL_SHELL_MAIN_DELEGATE_H_
+#pragma once
+
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/app/content_main_delegate.h"
+#include "content/shell/shell_content_client.h"
+
+namespace content {
+class ShellContentBrowserClient;
+class ShellContentRendererClient;
+class ShellContentPluginClient;
+class ShellContentUtilityClient;
+} // namespace content
+
+class ShellMainDelegate : public content::ContentMainDelegate {
+ public:
+ ShellMainDelegate();
+ virtual ~ShellMainDelegate();
+
+ virtual void PreSandboxStartup() OVERRIDE;
+
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+ virtual void ZygoteForked() OVERRIDE;
+#endif
+
+ private:
+ void InitializeShellContentClient(const std::string& process_type);
+
+ scoped_ptr<content::ShellContentBrowserClient> browser_client_;
+ scoped_ptr<content::ShellContentRendererClient> renderer_client_;
+ scoped_ptr<content::ShellContentPluginClient> plugin_client_;
+ scoped_ptr<content::ShellContentUtilityClient> utility_client_;
+ content::ShellContentClient content_client_;
+
+ DISALLOW_COPY_AND_ASSIGN(ShellMainDelegate);
+};
+
+#endif // CONTENT_SHELL_SHELL_MAIN_DELEGATE_H_ \ No newline at end of file
diff --git a/content/test/content_browser_test.cc b/content/test/content_browser_test.cc
index f43c011..2f97e0e 100644
--- a/content/test/content_browser_test.cc
+++ b/content/test/content_browser_test.cc
@@ -7,6 +7,8 @@
#include "base/debug/stack_trace.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/message_loop.h"
+#include "content/shell/shell.h"
+#include "content/shell/shell_main_delegate.h"
#include "content/test/test_content_client.h"
ContentBrowserTest::ContentBrowserTest() {
@@ -17,11 +19,8 @@ ContentBrowserTest::~ContentBrowserTest() {
void ContentBrowserTest::SetUp() {
DCHECK(!content::GetContentClient());
- content_client_.reset(new TestContentClient);
- content::SetContentClient(content_client_.get());
-
- content_browser_client_.reset(new content::MockContentBrowserClient());
- content_client_->set_browser(content_browser_client_.get());
+ shell_main_delegate_.reset(new ShellMainDelegate);
+ shell_main_delegate_->PreSandboxStartup();
BrowserTestBase::SetUp();
}
@@ -29,11 +28,7 @@ void ContentBrowserTest::SetUp() {
void ContentBrowserTest::TearDown() {
BrowserTestBase::TearDown();
- DCHECK_EQ(content_client_.get(), content::GetContentClient());
- content::SetContentClient(NULL);
- content_client_.reset();
-
- content_browser_client_.reset();
+ shell_main_delegate_.reset();
}
#if defined(OS_POSIX)
diff --git a/content/test/content_browser_test.h b/content/test/content_browser_test.h
index c3410f5..7626b3b 100644
--- a/content/test/content_browser_test.h
+++ b/content/test/content_browser_test.h
@@ -7,13 +7,9 @@
#pragma once
#include "base/memory/scoped_ptr.h"
-#include "content/browser/mock_content_browser_client.h"
#include "content/test/browser_test_base.h"
-namespace content {
-class ContentBrowserClient;
-class ContentClient;
-}
+class ShellMainDelegate;
class ContentBrowserTest : public BrowserTestBase {
protected:
@@ -28,8 +24,7 @@ class ContentBrowserTest : public BrowserTestBase {
virtual void RunTestOnMainThreadLoop() OVERRIDE;
private:
- scoped_ptr<content::ContentClient> content_client_;
- scoped_ptr<content::ContentBrowserClient> content_browser_client_;
+ scoped_ptr<ShellMainDelegate> shell_main_delegate_;
};
#endif // CONTENT_TEST_CONTENT_BROWSER_TEST_H_
diff --git a/content/test/content_test_launcher.cc b/content/test/content_test_launcher.cc
index 5e1ba50..0fe5ba5 100644
--- a/content/test/content_test_launcher.cc
+++ b/content/test/content_test_launcher.cc
@@ -4,10 +4,20 @@
#include "content/test/test_launcher.h"
+#include "base/base_paths.h"
#include "base/command_line.h"
#include "base/logging.h"
+#include "base/path_service.h"
#include "base/scoped_temp_dir.h"
-#include "content/test/content_test_suite.h"
+#include "base/test/test_suite.h"
+#include "content/app/content_main.h"
+#include "content/common/content_switches.h"
+#include "content/shell/shell_main_delegate.h"
+
+#if defined(OS_WIN)
+#include "content/app/startup_helper_win.h"
+#include "sandbox/src/sandbox_types.h"
+#endif // defined(OS_WIN)
class ContentTestLauncherDelegate : public test_launcher::TestLauncherDelegate {
public:
@@ -21,26 +31,31 @@ class ContentTestLauncherDelegate : public test_launcher::TestLauncherDelegate {
}
virtual bool Run(int argc, char** argv, int* return_code) OVERRIDE {
+#if defined(OS_WIN)
CommandLine* command_line = CommandLine::ForCurrentProcess();
-
- // TODO(pkasting): This "single_process vs. single-process" design is
- // terrible UI. Instead, there should be some sort of signal flag on the
- // command line, with all subsequent arguments passed through to the
- // underlying browser.
- if (command_line->HasSwitch(test_launcher::kSingleProcessTestsFlag) ||
- command_line->HasSwitch(
- test_launcher::kSingleProcessTestsAndChromeFlag) ||
- command_line->HasSwitch(test_launcher::kGTestListTestsFlag) ||
- command_line->HasSwitch(test_launcher::kGTestHelpFlag)) {
- *return_code = ContentTestSuite(argc, argv).Run();
+ if (command_line->HasSwitch(switches::kProcessType)) {
+ sandbox::SandboxInterfaceInfo sandbox_info = {0};
+ content::InitializeSandboxInfo(&sandbox_info);
+ ShellMainDelegate delegate;
+ *return_code =
+ content::ContentMain(GetModuleHandle(NULL), &sandbox_info, &delegate);
return true;
}
+#endif // defined(OS_WIN)
return false;
}
+ virtual int RunTestSuite(int argc, char** argv) OVERRIDE {
+ return base::TestSuite(argc, argv).Run();
+ }
+
virtual bool AdjustChildProcessCommandLine(
CommandLine* command_line) OVERRIDE {
+ FilePath file_exe;
+ if (!PathService::Get(base::FILE_EXE, &file_exe))
+ return false;
+ command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, file_exe);
return true;
}
diff --git a/content/test/test_launcher.cc b/content/test/test_launcher.cc
index 4b44763..d2492c3 100644
--- a/content/test/test_launcher.cc
+++ b/content/test/test_launcher.cc
@@ -27,6 +27,14 @@
#include "net/base/escape.h"
#include "testing/gtest/include/gtest/gtest.h"
+#if defined(OS_WIN)
+#include "base/base_switches.h"
+#include "content/common/sandbox_policy.h"
+#include "sandbox/src/dep.h"
+#include "sandbox/src/sandbox_factory.h"
+#include "sandbox/src/sandbox_types.h"
+#endif
+
namespace test_launcher {
namespace {
@@ -550,10 +558,38 @@ int LaunchTests(TestLauncherDelegate* launcher_delegate,
return 0;
}
+ // TODO(pkasting): This "single_process vs. single-process" design is
+ // terrible UI. Instead, there should be some sort of signal flag on the
+ // command line, with all subsequent arguments passed through to the
+ // underlying browser.
+ if (command_line->HasSwitch(kSingleProcessTestsFlag) ||
+ command_line->HasSwitch(kSingleProcessTestsAndChromeFlag) ||
+ command_line->HasSwitch(kGTestListTestsFlag) ||
+ command_line->HasSwitch(kGTestHelpFlag)) {
+#if defined(OS_WIN)
+ if (command_line->HasSwitch(kSingleProcessTestsFlag)) {
+ // This is the browser process, so setup the sandbox broker.
+ sandbox::BrokerServices* broker_services =
+ sandbox::SandboxFactory::GetBrokerServices();
+ if (broker_services) {
+ sandbox::InitBrokerServices(broker_services);
+ // Precreate the desktop and window station used by the renderers.
+ sandbox::TargetPolicy* policy = broker_services->CreatePolicy();
+ sandbox::ResultCode result = policy->CreateAlternateDesktop(true);
+ CHECK(sandbox::SBOX_ERROR_FAILED_TO_SWITCH_BACK_WINSTATION != result);
+ policy->Release();
+ }
+ }
+#endif
+ return launcher_delegate->RunTestSuite(argc, argv);
+ }
+
int return_code = 0;
if (launcher_delegate->Run(argc, argv, &return_code))
return return_code;
+ base::AtExitManager at_exit;
+
int32 total_shards;
int32 shard_index;
bool should_shard = ShouldShard(&total_shards, &shard_index);
diff --git a/content/test/test_launcher.h b/content/test/test_launcher.h
index a6adb41..b7c2fdf 100644
--- a/content/test/test_launcher.h
+++ b/content/test/test_launcher.h
@@ -29,6 +29,7 @@ class TestLauncherDelegate {
public:
virtual void EarlyInitialize() = 0;
virtual bool Run(int argc, char** argv, int* return_code) = 0;
+ virtual int RunTestSuite(int argc, char** argv) = 0;
virtual bool AdjustChildProcessCommandLine(CommandLine* command_line) = 0;
protected: