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

Unified Diff: headless/lib/headless_browser_browsertest.cc

Issue 2199773002: headless: make initial screen/window sizes configurable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix constexpr, reference to screen_size in test. Created 4 years, 4 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/lib/browser/headless_web_contents_impl.cc ('k') | headless/public/headless_browser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/headless_browser_browsertest.cc
diff --git a/headless/lib/headless_browser_browsertest.cc b/headless/lib/headless_browser_browsertest.cc
index 75ae5133006aef82ba6f7c8568817cf9c256f47c..b40aa28665dc992991c9b17c678bf6f6db59f1ce 100644
--- a/headless/lib/headless_browser_browsertest.cc
+++ b/headless/lib/headless_browser_browsertest.cc
@@ -164,14 +164,49 @@ IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, WebGLSupported) {
browser()->CreateWebContentsBuilder().Build();
bool webgl_supported;
- EXPECT_TRUE(EvaluateScript(
- web_contents,
- "(document.createElement('canvas').getContext('webgl')"
- " instanceof WebGLRenderingContext)")
+ EXPECT_TRUE(
+ EvaluateScript(web_contents,
+ "(document.createElement('canvas').getContext('webgl')"
+ " instanceof WebGLRenderingContext)")
+ ->GetResult()
+ ->GetValue()
+ ->GetAsBoolean(&webgl_supported));
+ EXPECT_TRUE(webgl_supported);
+}
+
+IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, DefaultSizes) {
+ HeadlessWebContents* web_contents =
+ browser()->CreateWebContentsBuilder().Build();
+
+ HeadlessBrowser::Options::Builder builder;
+ const HeadlessBrowser::Options kDefaultOptions = builder.Build();
+
+ int screen_width;
+ int screen_height;
+ int window_width;
+ int window_height;
+
+ EXPECT_TRUE(EvaluateScript(web_contents, "screen.width")
->GetResult()
->GetValue()
- ->GetAsBoolean(&webgl_supported));
- EXPECT_TRUE(webgl_supported);
+ ->GetAsInteger(&screen_width));
+ EXPECT_TRUE(EvaluateScript(web_contents, "screen.height")
+ ->GetResult()
+ ->GetValue()
+ ->GetAsInteger(&screen_height));
+ EXPECT_TRUE(EvaluateScript(web_contents, "window.innerWidth")
+ ->GetResult()
+ ->GetValue()
+ ->GetAsInteger(&window_width));
+ EXPECT_TRUE(EvaluateScript(web_contents, "window.innerHeight")
+ ->GetResult()
+ ->GetValue()
+ ->GetAsInteger(&window_height));
+
+ EXPECT_EQ(kDefaultOptions.window_size.width(), screen_width);
+ EXPECT_EQ(kDefaultOptions.window_size.height(), screen_height);
+ EXPECT_EQ(kDefaultOptions.window_size.width(), window_width);
+ EXPECT_EQ(kDefaultOptions.window_size.height(), window_height);
}
} // namespace headless
« no previous file with comments | « headless/lib/browser/headless_web_contents_impl.cc ('k') | headless/public/headless_browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698