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" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 base::CommandLine::ForCurrentProcess()->GetArgs(); | 82 base::CommandLine::ForCurrentProcess()->GetArgs(); |
83 test_runner::TestInfoExtractor test_extractor(args); | 83 test_runner::TestInfoExtractor test_extractor(args); |
84 bool ran_at_least_once = false; | 84 bool ran_at_least_once = false; |
85 scoped_ptr<test_runner::TestInfo> test_info; | 85 scoped_ptr<test_runner::TestInfo> test_info; |
86 while ((test_info = test_extractor.GetNextTest())) { | 86 while ((test_info = test_extractor.GetNextTest())) { |
87 if (!RunOneTest(*test_info, &ran_at_least_once, main_runner)) | 87 if (!RunOneTest(*test_info, &ran_at_least_once, main_runner)) |
88 break; | 88 break; |
89 } | 89 } |
90 if (!ran_at_least_once) { | 90 if (!ran_at_least_once) { |
91 base::ThreadTaskRunnerHandle::Get()->PostTask( | 91 base::ThreadTaskRunnerHandle::Get()->PostTask( |
92 FROM_HERE, base::MessageLoop::QuitClosure()); | 92 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
93 main_runner->Run(); | 93 main_runner->Run(); |
94 } | 94 } |
95 | 95 |
96 #if defined(OS_ANDROID) | 96 #if defined(OS_ANDROID) |
97 // We need to execute 'main_runner->Shutdown()' before the test_controller | 97 // We need to execute 'main_runner->Shutdown()' before the test_controller |
98 // destructs when running on Android, and after it destructs when running | 98 // destructs when running on Android, and after it destructs when running |
99 // anywhere else. | 99 // anywhere else. |
100 main_runner->Shutdown(); | 100 main_runner->Shutdown(); |
101 #endif | 101 #endif |
102 | 102 |
(...skipping 21 matching lines...) Expand all Loading... |
124 int exit_code = main_runner->Initialize(parameters); | 124 int exit_code = main_runner->Initialize(parameters); |
125 DCHECK_LT(exit_code, 0) | 125 DCHECK_LT(exit_code, 0) |
126 << "BrowserMainRunner::Initialize failed in LayoutTestBrowserMain"; | 126 << "BrowserMainRunner::Initialize failed in LayoutTestBrowserMain"; |
127 | 127 |
128 if (exit_code >= 0) | 128 if (exit_code >= 0) |
129 return exit_code; | 129 return exit_code; |
130 | 130 |
131 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 131 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
132 switches::kCheckLayoutTestSysDeps)) { | 132 switches::kCheckLayoutTestSysDeps)) { |
133 base::ThreadTaskRunnerHandle::Get()->PostTask( | 133 base::ThreadTaskRunnerHandle::Get()->PostTask( |
134 FROM_HERE, base::MessageLoop::QuitClosure()); | 134 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
135 main_runner->Run(); | 135 main_runner->Run(); |
136 content::Shell::CloseAllWindows(); | 136 content::Shell::CloseAllWindows(); |
137 main_runner->Shutdown(); | 137 main_runner->Shutdown(); |
138 return 0; | 138 return 0; |
139 } | 139 } |
140 | 140 |
141 exit_code = RunTests(main_runner); | 141 exit_code = RunTests(main_runner); |
142 | 142 |
143 #if !defined(OS_ANDROID) | 143 #if !defined(OS_ANDROID) |
144 main_runner->Shutdown(); | 144 main_runner->Shutdown(); |
145 #endif | 145 #endif |
146 | 146 |
147 return exit_code; | 147 return exit_code; |
148 } | 148 } |
OLD | NEW |