| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/layout_test/layout_test_browser_main.h" | 5 #include "content/shell/browser/layout_test/layout_test_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/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
| 12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/location.h" |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/message_loop/message_loop.h" | 16 #include "base/single_thread_task_runner.h" |
| 16 #include "base/strings/sys_string_conversions.h" | 17 #include "base/strings/sys_string_conversions.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/thread_task_runner_handle.h" |
| 18 #include "base/threading/thread_restrictions.h" | 20 #include "base/threading/thread_restrictions.h" |
| 19 #include "content/public/browser/browser_main_runner.h" | 21 #include "content/public/browser/browser_main_runner.h" |
| 20 #include "content/public/common/url_constants.h" | 22 #include "content/public/common/url_constants.h" |
| 21 #include "content/shell/browser/blink_test_controller.h" | 23 #include "content/shell/browser/blink_test_controller.h" |
| 22 #include "content/shell/browser/shell.h" | 24 #include "content/shell/browser/shell.h" |
| 23 #include "content/shell/common/shell_switches.h" | 25 #include "content/shell/common/shell_switches.h" |
| 24 #include "content/shell/renderer/layout_test/blink_test_helpers.h" | 26 #include "content/shell/renderer/layout_test/blink_test_helpers.h" |
| 25 #include "net/base/filename_util.h" | 27 #include "net/base/filename_util.h" |
| 26 | 28 |
| 27 #if defined(OS_ANDROID) | 29 #if defined(OS_ANDROID) |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 bool ran_at_least_once = false; | 165 bool ran_at_least_once = false; |
| 164 | 166 |
| 165 std::cout << "#READY\n"; | 167 std::cout << "#READY\n"; |
| 166 std::cout.flush(); | 168 std::cout.flush(); |
| 167 | 169 |
| 168 while (GetNextTest(args, &command_line_position, &test_string)) { | 170 while (GetNextTest(args, &command_line_position, &test_string)) { |
| 169 if (!RunOneTest(test_string, &ran_at_least_once, main_runner)) | 171 if (!RunOneTest(test_string, &ran_at_least_once, main_runner)) |
| 170 break; | 172 break; |
| 171 } | 173 } |
| 172 if (!ran_at_least_once) { | 174 if (!ran_at_least_once) { |
| 173 base::MessageLoop::current()->PostTask(FROM_HERE, | 175 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 174 base::MessageLoop::QuitClosure()); | 176 FROM_HERE, base::MessageLoop::QuitClosure()); |
| 175 main_runner->Run(); | 177 main_runner->Run(); |
| 176 } | 178 } |
| 177 | 179 |
| 178 #if defined(OS_ANDROID) | 180 #if defined(OS_ANDROID) |
| 179 // We need to execute 'main_runner->Shutdown()' before the test_controller | 181 // We need to execute 'main_runner->Shutdown()' before the test_controller |
| 180 // destructs when running on Android, and after it destructs when running | 182 // destructs when running on Android, and after it destructs when running |
| 181 // anywhere else. | 183 // anywhere else. |
| 182 main_runner->Shutdown(); | 184 main_runner->Shutdown(); |
| 183 #endif | 185 #endif |
| 184 | 186 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 205 | 207 |
| 206 int exit_code = main_runner->Initialize(parameters); | 208 int exit_code = main_runner->Initialize(parameters); |
| 207 DCHECK_LT(exit_code, 0) | 209 DCHECK_LT(exit_code, 0) |
| 208 << "BrowserMainRunner::Initialize failed in LayoutTestBrowserMain"; | 210 << "BrowserMainRunner::Initialize failed in LayoutTestBrowserMain"; |
| 209 | 211 |
| 210 if (exit_code >= 0) | 212 if (exit_code >= 0) |
| 211 return exit_code; | 213 return exit_code; |
| 212 | 214 |
| 213 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 215 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 214 switches::kCheckLayoutTestSysDeps)) { | 216 switches::kCheckLayoutTestSysDeps)) { |
| 215 base::MessageLoop::current()->PostTask(FROM_HERE, | 217 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 216 base::MessageLoop::QuitClosure()); | 218 FROM_HERE, base::MessageLoop::QuitClosure()); |
| 217 main_runner->Run(); | 219 main_runner->Run(); |
| 218 content::Shell::CloseAllWindows(); | 220 content::Shell::CloseAllWindows(); |
| 219 main_runner->Shutdown(); | 221 main_runner->Shutdown(); |
| 220 return 0; | 222 return 0; |
| 221 } | 223 } |
| 222 | 224 |
| 223 exit_code = RunTests(main_runner); | 225 exit_code = RunTests(main_runner); |
| 224 | 226 |
| 225 #if !defined(OS_ANDROID) | 227 #if !defined(OS_ANDROID) |
| 226 main_runner->Shutdown(); | 228 main_runner->Shutdown(); |
| 227 #endif | 229 #endif |
| 228 | 230 |
| 229 return exit_code; | 231 return exit_code; |
| 230 } | 232 } |
| OLD | NEW |