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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
10 #include "content/public/browser/browser_main_runner.h" | 10 #include "content/public/browser/browser_main_runner.h" |
11 #include "content/shell/shell.h" | 11 #include "content/shell/shell.h" |
12 #include "content/shell/shell_browser_context.h" | 12 #include "content/shell/shell_browser_context.h" |
13 #include "content/shell/shell_content_browser_client.h" | 13 #include "content/shell/shell_content_browser_client.h" |
14 #include "content/shell/shell_switches.h" | 14 #include "content/shell/shell_switches.h" |
15 #include "webkit/support/webkit_support.h" | 15 #include "webkit/support/webkit_support.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 GURL GetURLForLayoutTest(const char* test_name) { | 19 GURL GetURLForLayoutTest(const char* test_name) { |
20 #if defined(OS_ANDROID) | |
21 // DumpRenderTree is not currently supported for Android using the content | |
22 // shell. | |
Yaron
2012/04/19 00:35:34
Add NOTIMPLEMENTED()
Ted C
2012/04/19 01:17:07
Done.
| |
23 return GURL::EmptyGURL(); | |
24 #else | |
20 std::string path_or_url = test_name; | 25 std::string path_or_url = test_name; |
21 std::string pixel_hash; | 26 std::string pixel_hash; |
22 std::string timeout; | 27 std::string timeout; |
23 std::string::size_type separator_position = path_or_url.find(' '); | 28 std::string::size_type separator_position = path_or_url.find(' '); |
24 if (separator_position != std::string::npos) { | 29 if (separator_position != std::string::npos) { |
25 timeout = path_or_url.substr(separator_position + 1); | 30 timeout = path_or_url.substr(separator_position + 1); |
26 path_or_url.erase(separator_position); | 31 path_or_url.erase(separator_position); |
27 separator_position = path_or_url.find(' '); | 32 separator_position = path_or_url.find(' '); |
28 if (separator_position != std::string::npos) { | 33 if (separator_position != std::string::npos) { |
29 pixel_hash = timeout.substr(separator_position + 1); | 34 pixel_hash = timeout.substr(separator_position + 1); |
30 timeout.erase(separator_position); | 35 timeout.erase(separator_position); |
31 } | 36 } |
32 } | 37 } |
33 // TODO(jochen): use pixel_hash and timeout. | 38 // TODO(jochen): use pixel_hash and timeout. |
34 GURL test_url = webkit_support::CreateURLForPathOrURL(path_or_url); | 39 GURL test_url = webkit_support::CreateURLForPathOrURL(path_or_url); |
35 { | 40 { |
36 // We're outside of the message loop here, and this is a test. | 41 // We're outside of the message loop here, and this is a test. |
37 base::ThreadRestrictions::ScopedAllowIO allow_io; | 42 base::ThreadRestrictions::ScopedAllowIO allow_io; |
38 webkit_support::SetCurrentDirectoryForFileURL(test_url); | 43 webkit_support::SetCurrentDirectoryForFileURL(test_url); |
39 } | 44 } |
40 return test_url; | 45 return test_url; |
46 #endif | |
41 } | 47 } |
42 | 48 |
43 } // namespace | 49 } // namespace |
44 | 50 |
45 // Main routine for running as the Browser process. | 51 // Main routine for running as the Browser process. |
46 int ShellBrowserMain(const content::MainFunctionParams& parameters) { | 52 int ShellBrowserMain(const content::MainFunctionParams& parameters) { |
47 scoped_ptr<content::BrowserMainRunner> main_runner_( | 53 scoped_ptr<content::BrowserMainRunner> main_runner_( |
48 content::BrowserMainRunner::Create()); | 54 content::BrowserMainRunner::Create()); |
49 | 55 |
50 int exit_code = main_runner_->Initialize(parameters); | 56 int exit_code = main_runner_->Initialize(parameters); |
(...skipping 28 matching lines...) Expand all Loading... | |
79 } | 85 } |
80 exit_code = 0; | 86 exit_code = 0; |
81 } else { | 87 } else { |
82 exit_code = main_runner_->Run(); | 88 exit_code = main_runner_->Run(); |
83 } | 89 } |
84 | 90 |
85 main_runner_->Shutdown(); | 91 main_runner_->Shutdown(); |
86 | 92 |
87 return exit_code; | 93 return exit_code; |
88 } | 94 } |
OLD | NEW |