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> |
| 8 |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
10 #include "base/threading/thread_restrictions.h" | 12 #include "base/threading/thread_restrictions.h" |
11 #include "content/public/browser/browser_main_runner.h" | 13 #include "content/public/browser/browser_main_runner.h" |
12 #include "content/shell/shell.h" | 14 #include "content/shell/shell.h" |
13 #include "content/shell/shell_browser_context.h" | 15 #include "content/shell/shell_browser_context.h" |
14 #include "content/shell/shell_content_browser_client.h" | 16 #include "content/shell/shell_content_browser_client.h" |
15 #include "content/shell/shell_switches.h" | 17 #include "content/shell/shell_switches.h" |
16 #include "webkit/support/webkit_support.h" | 18 #include "webkit/support/webkit_support.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 #if defined(OS_ANDROID) | 62 #if defined(OS_ANDROID) |
61 DCHECK(exit_code < 0); | 63 DCHECK(exit_code < 0); |
62 | 64 |
63 // Return 0 so that we do NOT trigger the default behavior. On Android, the | 65 // Return 0 so that we do NOT trigger the default behavior. On Android, the |
64 // UI message loop is managed by the Java application. | 66 // UI message loop is managed by the Java application. |
65 return 0; | 67 return 0; |
66 #else | 68 #else |
67 if (exit_code >= 0) | 69 if (exit_code >= 0) |
68 return exit_code; | 70 return exit_code; |
69 | 71 |
| 72 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 73 switches::kCheckLayoutTestSysDeps)) { |
| 74 return 0; |
| 75 } |
| 76 |
70 bool layout_test_mode = | 77 bool layout_test_mode = |
71 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree); | 78 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree); |
72 | 79 |
73 if (layout_test_mode) { | 80 if (layout_test_mode) { |
74 char test_string[2048]; | 81 char test_string[2048]; |
75 content::ShellBrowserContext* browser_context = | 82 content::ShellBrowserContext* browser_context = |
76 static_cast<content::ShellContentBrowserClient*>( | 83 static_cast<content::ShellContentBrowserClient*>( |
77 content::GetContentClient()->browser())->browser_context(); | 84 content::GetContentClient()->browser())->browser_context(); |
78 | 85 |
79 while (fgets(test_string, sizeof(test_string), stdin)) { | 86 while (fgets(test_string, sizeof(test_string), stdin)) { |
80 char *new_line_position = strchr(test_string, '\n'); | 87 char *new_line_position = strchr(test_string, '\n'); |
81 if (new_line_position) | 88 if (new_line_position) |
82 *new_line_position = '\0'; | 89 *new_line_position = '\0'; |
83 if (test_string[0] == '\0') | 90 if (test_string[0] == '\0') |
84 continue; | 91 continue; |
85 if (!strcmp(test_string, "QUIT")) | 92 |
86 break; | |
87 content::Shell::CreateNewWindow(browser_context, | 93 content::Shell::CreateNewWindow(browser_context, |
88 GetURLForLayoutTest(test_string), | 94 GetURLForLayoutTest(test_string), |
89 NULL, | 95 NULL, |
90 MSG_ROUTING_NONE, | 96 MSG_ROUTING_NONE, |
91 NULL); | 97 NULL); |
92 main_runner_->Run(); | 98 main_runner_->Run(); |
93 | 99 |
94 content::Shell::CloseAllWindows(); | 100 content::Shell::CloseAllWindows(); |
| 101 |
| 102 // Test footer. |
| 103 std::cout << "#EOF\n"; |
| 104 std::cout.flush(); |
| 105 |
95 } | 106 } |
96 exit_code = 0; | 107 exit_code = 0; |
97 } else { | 108 } else { |
98 exit_code = main_runner_->Run(); | 109 exit_code = main_runner_->Run(); |
99 } | 110 } |
100 | 111 |
101 main_runner_->Shutdown(); | 112 main_runner_->Shutdown(); |
102 | 113 |
103 return exit_code; | 114 return exit_code; |
104 #endif | 115 #endif |
105 } | 116 } |
OLD | NEW |