OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "headless/test/headless_browser_test.h" | |
6 | |
7 #include "base/files/file_path.h" | |
8 #include "base/message_loop/message_loop.h" | |
9 #include "content/public/browser/render_process_host.h" | |
10 #include "headless/lib/browser/headless_browser_impl.h" | |
11 #include "headless/lib/headless_content_main_delegate.h" | |
12 | |
13 namespace headless { | |
14 | |
15 HeadlessBrowserTest::HeadlessBrowserTest() { | |
16 base::FilePath headless_test_data(FILE_PATH_LITERAL("headless/test/data")); | |
17 CreateTestServer(headless_test_data); | |
18 } | |
19 | |
20 HeadlessBrowserTest::~HeadlessBrowserTest() {} | |
21 | |
22 void HeadlessBrowserTest::SetUpOnMainThread() {} | |
23 | |
24 void HeadlessBrowserTest::TearDownOnMainThread() { | |
25 browser()->Shutdown(); | |
26 } | |
27 | |
28 void HeadlessBrowserTest::RunTestOnMainThreadLoop() { | |
29 // Pump startup related events. | |
30 base::MessageLoopForUI::current()->RunUntilIdle(); | |
Ryan Sleevi
2016/02/25 22:04:37
Does this need to be as base::MessageLoopForUI::cu
Sami
2016/02/26 18:49:16
I only used MessageLoopForUI for the side-effect D
| |
31 | |
32 SetUpOnMainThread(); | |
33 RunTestOnMainThread(); | |
34 TearDownOnMainThread(); | |
35 | |
36 for (content::RenderProcessHost::iterator i( | |
37 content::RenderProcessHost::AllHostsIterator()); | |
38 !i.IsAtEnd(); i.Advance()) { | |
39 i.GetCurrentValue()->FastShutdownIfPossible(); | |
40 } | |
41 } | |
42 | |
43 HeadlessBrowser* HeadlessBrowserTest::browser() const { | |
44 return HeadlessContentMainDelegate::GetInstance()->browser(); | |
45 } | |
46 | |
47 } // namespace headless | |
OLD | NEW |