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/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 int exit_code) { | 202 int exit_code) { |
203 if (status == base::TERMINATION_STATUS_NORMAL_TERMINATION) | 203 if (status == base::TERMINATION_STATUS_NORMAL_TERMINATION) |
204 return; | 204 return; |
205 | 205 |
206 FAIL() << "Abnormal renderer termination"; | 206 FAIL() << "Abnormal renderer termination"; |
207 FinishAsynchronousTest(); | 207 FinishAsynchronousTest(); |
208 render_process_exited_ = true; | 208 render_process_exited_ = true; |
209 } | 209 } |
210 | 210 |
211 void HeadlessAsyncDevTooledBrowserTest::RunTest() { | 211 void HeadlessAsyncDevTooledBrowserTest::RunTest() { |
212 browser_context_ = browser()->CreateBrowserContextBuilder().Build(); | 212 browser_context_ = browser() |
| 213 ->CreateBrowserContextBuilder() |
| 214 .SetProtocolHandlers(GetProtocolHandlers()) |
| 215 .Build(); |
213 browser()->SetDefaultBrowserContext(browser_context_); | 216 browser()->SetDefaultBrowserContext(browser_context_); |
214 | 217 |
215 web_contents_ = browser_context_->CreateWebContentsBuilder().Build(); | 218 web_contents_ = browser_context_->CreateWebContentsBuilder().Build(); |
216 web_contents_->AddObserver(this); | 219 web_contents_->AddObserver(this); |
217 | 220 |
218 RunAsynchronousTest(); | 221 RunAsynchronousTest(); |
219 | 222 |
220 if (!render_process_exited_) | 223 if (!render_process_exited_) |
221 web_contents_->GetDevToolsTarget()->DetachClient(devtools_client_.get()); | 224 web_contents_->GetDevToolsTarget()->DetachClient(devtools_client_.get()); |
222 web_contents_->RemoveObserver(this); | 225 web_contents_->RemoveObserver(this); |
223 web_contents_->Close(); | 226 web_contents_->Close(); |
224 web_contents_ = nullptr; | 227 web_contents_ = nullptr; |
225 browser_context_->Close(); | 228 browser_context_->Close(); |
226 browser_context_ = nullptr; | 229 browser_context_ = nullptr; |
227 } | 230 } |
228 | 231 |
| 232 ProtocolHandlerMap HeadlessAsyncDevTooledBrowserTest::GetProtocolHandlers() { |
| 233 return ProtocolHandlerMap(); |
| 234 } |
| 235 |
229 } // namespace headless | 236 } // namespace headless |
OLD | NEW |