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

Unified Diff: headless/test/headless_browser_test.cc

Issue 2035733002: headless: Implement screenshot capturing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses reviewer comments. Created 4 years, 6 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') | no next file » | 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
index d308fbead5842407acbc9488a97a1262e48dcc4c..2b6ec614f19eed1cbc6b89268b58e427c21ba19c 100644
--- a/headless/test/headless_browser_test.cc
+++ b/headless/test/headless_browser_test.cc
@@ -19,6 +19,8 @@
#include "headless/public/headless_devtools_client.h"
#include "headless/public/headless_devtools_target.h"
#include "headless/public/headless_web_contents.h"
+#include "ui/gfx/geometry/size.h"
+#include "url/gurl.h"
namespace headless {
namespace {
@@ -173,4 +175,29 @@ void HeadlessBrowserTest::FinishAsynchronousTest() {
run_loop_->Quit();
}
+HeadlessAsyncDevTooledBrowserTest::HeadlessAsyncDevTooledBrowserTest()
+ : web_contents_(nullptr),
+ devtools_client_(HeadlessDevToolsClient::Create()) {}
+
+HeadlessAsyncDevTooledBrowserTest::~HeadlessAsyncDevTooledBrowserTest() {}
+
+void HeadlessAsyncDevTooledBrowserTest::DevToolsTargetReady() {
+ EXPECT_TRUE(web_contents_->GetDevToolsTarget());
+ web_contents_->GetDevToolsTarget()->AttachClient(devtools_client_.get());
+ RunDevTooledTest();
+}
+
+void HeadlessAsyncDevTooledBrowserTest::RunTest() {
+ web_contents_ =
+ browser()->CreateWebContents(GURL("about:blank"), gfx::Size(800, 600));
+ web_contents_->AddObserver(this);
+
+ RunAsynchronousTest();
+
+ web_contents_->GetDevToolsTarget()->DetachClient(devtools_client_.get());
+ web_contents_->RemoveObserver(this);
+ web_contents_->Close();
+ web_contents_ = nullptr;
+}
+
} // namespace headless
« no previous file with comments | « headless/test/headless_browser_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698