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 "content/shell/shell_browser_main.h" | 5 #include "content/shell/shell_browser_main.h" |
6 | 6 |
7 #include <iostream> | 7 #include <iostream> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/strings/sys_string_conversions.h" | 16 #include "base/strings/sys_string_conversions.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/threading/thread_restrictions.h" | 18 #include "base/threading/thread_restrictions.h" |
19 #include "content/public/browser/browser_main_runner.h" | 19 #include "content/public/browser/browser_main_runner.h" |
| 20 #include "content/public/common/startup_task_runner.h" |
20 #include "content/shell/common/shell_switches.h" | 21 #include "content/shell/common/shell_switches.h" |
21 #include "content/shell/common/webkit_test_helpers.h" | 22 #include "content/shell/common/webkit_test_helpers.h" |
22 #include "content/shell/shell.h" | 23 #include "content/shell/shell.h" |
23 #include "content/shell/webkit_test_controller.h" | 24 #include "content/shell/webkit_test_controller.h" |
24 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
25 #include "webkit/support/webkit_support.h" | 26 #include "webkit/support/webkit_support.h" |
26 | 27 |
27 #if defined(OS_ANDROID) | 28 #if defined(OS_ANDROID) |
28 #include "base/run_loop.h" | 29 #include "base/run_loop.h" |
29 #include "content/shell/shell_layout_tests_android.h" | 30 #include "content/shell/shell_layout_tests_android.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 CHECK(browser_context_path_for_layout_tests.CreateUniqueTempDir()); | 121 CHECK(browser_context_path_for_layout_tests.CreateUniqueTempDir()); |
121 CHECK(!browser_context_path_for_layout_tests.path().MaybeAsASCII().empty()); | 122 CHECK(!browser_context_path_for_layout_tests.path().MaybeAsASCII().empty()); |
122 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 123 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
123 switches::kContentShellDataPath, | 124 switches::kContentShellDataPath, |
124 browser_context_path_for_layout_tests.path().MaybeAsASCII()); | 125 browser_context_path_for_layout_tests.path().MaybeAsASCII()); |
125 | 126 |
126 #if defined(OS_ANDROID) | 127 #if defined(OS_ANDROID) |
127 content::EnsureInitializeForAndroidLayoutTests(); | 128 content::EnsureInitializeForAndroidLayoutTests(); |
128 #endif | 129 #endif |
129 } | 130 } |
| 131 scoped_refptr<content::StartupTaskRunner> startup_task_runner = |
| 132 make_scoped_refptr(new content::StartupTaskRunner( |
| 133 content::StartupTaskRunner::IMMEDIATE, NULL)); |
130 | 134 |
131 int exit_code = main_runner->Initialize(parameters); | 135 int exit_code = main_runner->Initialize(parameters, startup_task_runner); |
132 DCHECK_LT(exit_code, 0) | 136 DCHECK_LT(exit_code, 0) |
133 << "BrowserMainRunner::Initialize failed in ShellBrowserMain"; | 137 << "BrowserMainRunner::Initialize failed in ShellBrowserMain"; |
134 | 138 |
135 if (exit_code >= 0) | 139 if (exit_code >= 0) |
136 return exit_code; | 140 return exit_code; |
137 | 141 |
138 if (CommandLine::ForCurrentProcess()->HasSwitch( | 142 if (CommandLine::ForCurrentProcess()->HasSwitch( |
139 switches::kCheckLayoutTestSysDeps)) { | 143 switches::kCheckLayoutTestSysDeps)) { |
140 base::MessageLoop::current()->PostTask(FROM_HERE, | 144 base::MessageLoop::current()->PostTask(FROM_HERE, |
141 base::MessageLoop::QuitClosure()); | 145 base::MessageLoop::QuitClosure()); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 209 |
206 #if !defined(OS_ANDROID) | 210 #if !defined(OS_ANDROID) |
207 if (!layout_test_mode) | 211 if (!layout_test_mode) |
208 exit_code = main_runner->Run(); | 212 exit_code = main_runner->Run(); |
209 | 213 |
210 main_runner->Shutdown(); | 214 main_runner->Shutdown(); |
211 #endif | 215 #endif |
212 | 216 |
213 return exit_code; | 217 return exit_code; |
214 } | 218 } |
OLD | NEW |