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

Unified 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, 10 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/test/headless_browser_test.cc
diff --git a/headless/test/headless_browser_test.cc b/headless/test/headless_browser_test.cc
new file mode 100644
index 0000000000000000000000000000000000000000..555616a8af7072dfb5795203b9a7766f92a81b48
--- /dev/null
+++ b/headless/test/headless_browser_test.cc
@@ -0,0 +1,50 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "headless/test/headless_browser_test.h"
+
+#include "base/files/file_path.h"
+#include "base/message_loop/message_loop.h"
+#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/render_process_host.h"
+#include "headless/lib/browser/headless_browser_impl.h"
+#include "headless/lib/headless_content_main_delegate.h"
+
+namespace headless {
+
+HeadlessBrowserTest::HeadlessBrowserTest() {
+ base::FilePath headless_test_data(FILE_PATH_LITERAL("headless/test/data"));
+ CreateTestServer(headless_test_data);
+}
+
+HeadlessBrowserTest::~HeadlessBrowserTest() {}
+
+void HeadlessBrowserTest::SetUpOnMainThread() {}
+
+void HeadlessBrowserTest::TearDownOnMainThread() {
+ browser()->Shutdown();
+}
+
+void HeadlessBrowserTest::RunTestOnMainThreadLoop() {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+
+ // Pump startup related events.
+ base::MessageLoop::current()->RunUntilIdle();
+
+ SetUpOnMainThread();
+ RunTestOnMainThread();
+ TearDownOnMainThread();
+
+ for (content::RenderProcessHost::iterator i(
+ content::RenderProcessHost::AllHostsIterator());
+ !i.IsAtEnd(); i.Advance()) {
+ i.GetCurrentValue()->FastShutdownIfPossible();
+ }
+}
+
+HeadlessBrowser* HeadlessBrowserTest::browser() const {
+ return HeadlessContentMainDelegate::GetInstance()->browser();
+}
+
+} // namespace headless
« 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