Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: headless/test/headless_browser_test.cc

Issue 1674263002: headless: Initial headless embedder API implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fine, no console logging Mr. Presubmit. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « headless/test/headless_browser_test.h ('k') | headless/test/headless_test_launcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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/browser_thread.h"
10 #include "content/public/browser/render_process_host.h"
11 #include "headless/lib/browser/headless_browser_impl.h"
12 #include "headless/lib/headless_content_main_delegate.h"
13
14 namespace headless {
15
16 HeadlessBrowserTest::HeadlessBrowserTest() {
17 base::FilePath headless_test_data(FILE_PATH_LITERAL("headless/test/data"));
18 CreateTestServer(headless_test_data);
19 }
20
21 HeadlessBrowserTest::~HeadlessBrowserTest() {}
22
23 void HeadlessBrowserTest::SetUpOnMainThread() {}
24
25 void HeadlessBrowserTest::TearDownOnMainThread() {
26 browser()->Shutdown();
27 }
28
29 void HeadlessBrowserTest::RunTestOnMainThreadLoop() {
30 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
31
32 // Pump startup related events.
33 base::MessageLoop::current()->RunUntilIdle();
34
35 SetUpOnMainThread();
36 RunTestOnMainThread();
37 TearDownOnMainThread();
38
39 for (content::RenderProcessHost::iterator i(
40 content::RenderProcessHost::AllHostsIterator());
41 !i.IsAtEnd(); i.Advance()) {
42 i.GetCurrentValue()->FastShutdownIfPossible();
43 }
44 }
45
46 HeadlessBrowser* HeadlessBrowserTest::browser() const {
47 return HeadlessContentMainDelegate::GetInstance()->browser();
48 }
49
50 } // namespace headless
OLDNEW
« no previous file with comments | « headless/test/headless_browser_test.h ('k') | headless/test/headless_test_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698