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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <memory> 5 #include <memory>
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "content/public/test/browser_test.h" 9 #include "content/public/test/browser_test.h"
10 #include "headless/public/domains/page.h" 10 #include "headless/public/domains/page.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 ->GetValue() 157 ->GetValue()
158 ->GetAsString(&inner_html)); 158 ->GetAsString(&inner_html));
159 EXPECT_EQ(kResponseBody, inner_html); 159 EXPECT_EQ(kResponseBody, inner_html);
160 } 160 }
161 161
162 IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, WebGLSupported) { 162 IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, WebGLSupported) {
163 HeadlessWebContents* web_contents = 163 HeadlessWebContents* web_contents =
164 browser()->CreateWebContentsBuilder().Build(); 164 browser()->CreateWebContentsBuilder().Build();
165 165
166 bool webgl_supported; 166 bool webgl_supported;
167 EXPECT_TRUE(EvaluateScript( 167 EXPECT_TRUE(
168 web_contents, 168 EvaluateScript(web_contents,
169 "(document.createElement('canvas').getContext('webgl')" 169 "(document.createElement('canvas').getContext('webgl')"
170 " instanceof WebGLRenderingContext)") 170 " instanceof WebGLRenderingContext)")
171 ->GetResult() 171 ->GetResult()
172 ->GetValue() 172 ->GetValue()
173 ->GetAsBoolean(&webgl_supported)); 173 ->GetAsBoolean(&webgl_supported));
174 EXPECT_TRUE(webgl_supported); 174 EXPECT_TRUE(webgl_supported);
175 } 175 }
176 176
177 IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, DefaultSizes) {
178 HeadlessWebContents* web_contents =
179 browser()->CreateWebContentsBuilder().Build();
180
181 HeadlessBrowser::Options::Builder builder;
182 const HeadlessBrowser::Options kDefaultOptions = builder.Build();
183
184 int screen_width;
185 int screen_height;
186 int window_width;
187 int window_height;
188
189 EXPECT_TRUE(EvaluateScript(web_contents, "screen.width")
190 ->GetResult()
191 ->GetValue()
192 ->GetAsInteger(&screen_width));
193 EXPECT_TRUE(EvaluateScript(web_contents, "screen.height")
194 ->GetResult()
195 ->GetValue()
196 ->GetAsInteger(&screen_height));
197 EXPECT_TRUE(EvaluateScript(web_contents, "window.innerWidth")
198 ->GetResult()
199 ->GetValue()
200 ->GetAsInteger(&window_width));
201 EXPECT_TRUE(EvaluateScript(web_contents, "window.innerHeight")
202 ->GetResult()
203 ->GetValue()
204 ->GetAsInteger(&window_height));
205
206 EXPECT_EQ(kDefaultOptions.window_size.width(), screen_width);
207 EXPECT_EQ(kDefaultOptions.window_size.height(), screen_height);
208 EXPECT_EQ(kDefaultOptions.window_size.width(), window_width);
209 EXPECT_EQ(kDefaultOptions.window_size.height(), window_height);
210 }
211
177 } // namespace headless 212 } // namespace headless
OLDNEW
« 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