| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "headless/test/headless_browser_test.h" | 5 #include "headless/test/headless_browser_test.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 CHECK(PathService::Get(base::DIR_EXE, &dir_exe_path)); | 130 CHECK(PathService::Get(base::DIR_EXE, &dir_exe_path)); |
| 131 dir_exe_path = dir_exe_path.Append("../../"); | 131 dir_exe_path = dir_exe_path.Append("../../"); |
| 132 CHECK(PathService::Override(base::DIR_SOURCE_ROOT, dir_exe_path)); | 132 CHECK(PathService::Override(base::DIR_SOURCE_ROOT, dir_exe_path)); |
| 133 #endif // defined(OS_MACOSX) | 133 #endif // defined(OS_MACOSX) |
| 134 base::FilePath headless_test_data(FILE_PATH_LITERAL("headless/test/data")); | 134 base::FilePath headless_test_data(FILE_PATH_LITERAL("headless/test/data")); |
| 135 CreateTestServer(headless_test_data); | 135 CreateTestServer(headless_test_data); |
| 136 } | 136 } |
| 137 | 137 |
| 138 HeadlessBrowserTest::~HeadlessBrowserTest() {} | 138 HeadlessBrowserTest::~HeadlessBrowserTest() {} |
| 139 | 139 |
| 140 void HeadlessBrowserTest::SetUpOnMainThread() {} | 140 void HeadlessBrowserTest::PreRunTestOnMainThread() { |
| 141 | |
| 142 void HeadlessBrowserTest::TearDownOnMainThread() { | |
| 143 browser()->Shutdown(); | |
| 144 } | |
| 145 | |
| 146 void HeadlessBrowserTest::RunTestOnMainThreadLoop() { | |
| 147 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 141 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 148 | 142 |
| 149 // Pump startup related events. | 143 // Pump startup related events. |
| 150 base::RunLoop().RunUntilIdle(); | 144 base::RunLoop().RunUntilIdle(); |
| 145 } |
| 151 | 146 |
| 152 SetUpOnMainThread(); | 147 void HeadlessBrowserTest::PostRunTestOnMainThread() { |
| 153 RunTestOnMainThread(); | 148 browser()->Shutdown(); |
| 154 TearDownOnMainThread(); | |
| 155 | |
| 156 for (content::RenderProcessHost::iterator i( | 149 for (content::RenderProcessHost::iterator i( |
| 157 content::RenderProcessHost::AllHostsIterator()); | 150 content::RenderProcessHost::AllHostsIterator()); |
| 158 !i.IsAtEnd(); i.Advance()) { | 151 !i.IsAtEnd(); i.Advance()) { |
| 159 i.GetCurrentValue()->FastShutdownIfPossible(); | 152 i.GetCurrentValue()->FastShutdownIfPossible(); |
| 160 } | 153 } |
| 161 } | 154 } |
| 162 | 155 |
| 163 HeadlessBrowser* HeadlessBrowserTest::browser() const { | 156 HeadlessBrowser* HeadlessBrowserTest::browser() const { |
| 164 return HeadlessContentMainDelegate::GetInstance()->browser(); | 157 return HeadlessContentMainDelegate::GetInstance()->browser(); |
| 165 } | 158 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 | 246 |
| 254 ProtocolHandlerMap HeadlessAsyncDevTooledBrowserTest::GetProtocolHandlers() { | 247 ProtocolHandlerMap HeadlessAsyncDevTooledBrowserTest::GetProtocolHandlers() { |
| 255 return ProtocolHandlerMap(); | 248 return ProtocolHandlerMap(); |
| 256 } | 249 } |
| 257 | 250 |
| 258 bool HeadlessAsyncDevTooledBrowserTest::GetCreateTabSocket() { | 251 bool HeadlessAsyncDevTooledBrowserTest::GetCreateTabSocket() { |
| 259 return false; | 252 return false; |
| 260 } | 253 } |
| 261 | 254 |
| 262 } // namespace headless | 255 } // namespace headless |
| OLD | NEW |