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

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: Fix shutdown memory leak. 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
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/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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698