2 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #include "core/frame/FrameView.h"
34 #include "core/frame/LocalFrame.h"
35 #include "core/frame/PageScaleConstraints.h"
36 #include "core/frame/Settings.h"
37 #include "core/page/Page.h"
38 #include "platform/Length.h"
39 #include "platform/geometry/IntPoint.h"
40 #include "platform/geometry/IntRect.h"
41 #include "platform/geometry/IntSize.h"
42 #include "platform/scroll/ScrollbarTheme.h"
43 #include "platform/testing/URLTestHelpers.h"
44 #include "platform/testing/UnitTestHelpers.h"
45 #include "public/platform/Platform.h"
46 #include "public/platform/WebUnitTestSupport.h"
47 #include "public/web/WebConsoleMessage.h"
48 #include "public/web/WebFrame.h"
49 #include "public/web/WebScriptSource.h"
50 #include "public/web/WebSettings.h"
51 #include "public/web/WebViewClient.h"
52 #include "web/tests/FrameTestHelpers.h"
53 #include <gtest/gtest.h>
58 using blink::FrameTestHelpers::UseMockScrollbarSettings
;
59 using blink::testing::runPendingTasks
;
61 class ViewportTest
: public ::testing::Test
{
64 : m_baseURL("http://www.test.com/")
65 , m_chromeURL("chrome://")
69 ~ViewportTest() override
71 Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
74 void registerMockedHttpURLLoad(const std::string
& fileName
)
76 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL
.c_str()), WebString::fromUTF8(fileName
.c_str()));
79 void registerMockedChromeURLLoad(const std::string
& fileName
)
81 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_chromeURL
.c_str()), WebString::fromUTF8(fileName
.c_str()));
84 void executeScript(WebFrame
* frame
, const WebString
& code
)
86 frame
->executeScript(WebScriptSource(code
));
90 std::string m_baseURL
;
91 std::string m_chromeURL
;
94 static void setViewportSettings(WebSettings
* settings
)
96 settings
->setViewportEnabled(true);
97 settings
->setViewportMetaEnabled(true);
98 settings
->setMainFrameResizesAreOrientationChanges(true);
101 static PageScaleConstraints
runViewportTest(Page
* page
, int initialWidth
, int initialHeight
)
103 IntSize
initialViewportSize(initialWidth
, initialHeight
);
104 toLocalFrame(page
->mainFrame())->view()->setFrameRect(IntRect(IntPoint::zero(), initialViewportSize
));
105 ViewportDescription description
= page
->viewportDescription();
106 PageScaleConstraints constraints
= description
.resolve(initialViewportSize
, Length(980, blink::Fixed
));
108 constraints
.fitToContentsWidth(constraints
.layoutSize
.width(), initialWidth
);
109 constraints
.resolveAutoInitialScale();
113 TEST_F(ViewportTest
, viewport1
)
115 UseMockScrollbarSettings mockScrollbarSettings
;
116 registerMockedHttpURLLoad("viewport/viewport-1.html");
118 FrameTestHelpers::WebViewHelper webViewHelper
;
119 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-1.html", true, 0, 0, setViewportSettings
);
121 Page
* page
= webViewHelper
.webViewImpl()->page();
122 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
124 EXPECT_EQ(320, constraints
.layoutSize
.width());
125 EXPECT_EQ(352, constraints
.layoutSize
.height());
126 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
127 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
128 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
129 EXPECT_TRUE(page
->viewportDescription().userZoom
);
132 TEST_F(ViewportTest
, viewport2
)
134 UseMockScrollbarSettings mockScrollbarSettings
;
135 registerMockedHttpURLLoad("viewport/viewport-2.html");
137 FrameTestHelpers::WebViewHelper webViewHelper
;
138 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-2.html", true, 0, 0, setViewportSettings
);
140 Page
* page
= webViewHelper
.webViewImpl()->page();
141 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
143 EXPECT_EQ(980, constraints
.layoutSize
.width());
144 EXPECT_EQ(352, constraints
.layoutSize
.height());
145 EXPECT_NEAR(0.32f
, constraints
.initialScale
, 0.01f
);
146 EXPECT_NEAR(0.32f
, constraints
.minimumScale
, 0.01f
);
147 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
148 EXPECT_TRUE(page
->viewportDescription().userZoom
);
151 TEST_F(ViewportTest
, viewport3
)
153 UseMockScrollbarSettings mockScrollbarSettings
;
154 registerMockedHttpURLLoad("viewport/viewport-3.html");
156 FrameTestHelpers::WebViewHelper webViewHelper
;
157 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-3.html", true, 0, 0, setViewportSettings
);
159 Page
* page
= webViewHelper
.webViewImpl()->page();
160 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
162 EXPECT_EQ(320, constraints
.layoutSize
.width());
163 EXPECT_EQ(352, constraints
.layoutSize
.height());
164 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
165 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
166 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
167 EXPECT_TRUE(page
->viewportDescription().userZoom
);
170 TEST_F(ViewportTest
, viewport4
)
172 UseMockScrollbarSettings mockScrollbarSettings
;
173 registerMockedHttpURLLoad("viewport/viewport-4.html");
175 FrameTestHelpers::WebViewHelper webViewHelper
;
176 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-4.html", true, 0, 0, setViewportSettings
);
178 Page
* page
= webViewHelper
.webViewImpl()->page();
179 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
181 EXPECT_EQ(160, constraints
.layoutSize
.width());
182 EXPECT_EQ(176, constraints
.layoutSize
.height());
183 EXPECT_NEAR(2.0f
, constraints
.initialScale
, 0.01f
);
184 EXPECT_NEAR(2.0f
, constraints
.minimumScale
, 0.01f
);
185 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
186 EXPECT_TRUE(page
->viewportDescription().userZoom
);
189 TEST_F(ViewportTest
, viewport5
)
191 UseMockScrollbarSettings mockScrollbarSettings
;
192 registerMockedHttpURLLoad("viewport/viewport-5.html");
194 FrameTestHelpers::WebViewHelper webViewHelper
;
195 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-5.html", true, 0, 0, setViewportSettings
);
197 Page
* page
= webViewHelper
.webViewImpl()->page();
198 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
200 EXPECT_EQ(640, constraints
.layoutSize
.width());
201 EXPECT_EQ(704, constraints
.layoutSize
.height());
202 EXPECT_NEAR(0.5f
, constraints
.initialScale
, 0.01f
);
203 EXPECT_NEAR(0.5f
, constraints
.minimumScale
, 0.01f
);
204 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
205 EXPECT_TRUE(page
->viewportDescription().userZoom
);
208 TEST_F(ViewportTest
, viewport6
)
210 UseMockScrollbarSettings mockScrollbarSettings
;
211 registerMockedHttpURLLoad("viewport/viewport-6.html");
213 FrameTestHelpers::WebViewHelper webViewHelper
;
214 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-6.html", true, 0, 0, setViewportSettings
);
216 Page
* page
= webViewHelper
.webViewImpl()->page();
217 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
219 EXPECT_EQ(200, constraints
.layoutSize
.width());
220 EXPECT_EQ(220, constraints
.layoutSize
.height());
221 EXPECT_NEAR(1.6f
, constraints
.initialScale
, 0.01f
);
222 EXPECT_NEAR(1.6f
, constraints
.minimumScale
, 0.01f
);
223 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
224 EXPECT_TRUE(page
->viewportDescription().userZoom
);
227 TEST_F(ViewportTest
, viewport7
)
229 UseMockScrollbarSettings mockScrollbarSettings
;
230 registerMockedHttpURLLoad("viewport/viewport-7.html");
232 FrameTestHelpers::WebViewHelper webViewHelper
;
233 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-7.html", true, 0, 0, setViewportSettings
);
235 Page
* page
= webViewHelper
.webViewImpl()->page();
236 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
238 EXPECT_EQ(1280, constraints
.layoutSize
.width());
239 EXPECT_EQ(1408, constraints
.layoutSize
.height());
240 EXPECT_NEAR(0.25f
, constraints
.initialScale
, 0.01f
);
241 EXPECT_NEAR(0.25f
, constraints
.minimumScale
, 0.01f
);
242 EXPECT_NEAR(0.25f
, constraints
.maximumScale
, 0.01f
);
243 EXPECT_TRUE(page
->viewportDescription().userZoom
);
246 TEST_F(ViewportTest
, viewport8
)
248 UseMockScrollbarSettings mockScrollbarSettings
;
249 registerMockedHttpURLLoad("viewport/viewport-8.html");
251 FrameTestHelpers::WebViewHelper webViewHelper
;
252 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-8.html", true, 0, 0, setViewportSettings
);
254 Page
* page
= webViewHelper
.webViewImpl()->page();
255 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
257 EXPECT_EQ(1280, constraints
.layoutSize
.width());
258 EXPECT_EQ(1408, constraints
.layoutSize
.height());
259 EXPECT_NEAR(0.25f
, constraints
.initialScale
, 0.01f
);
260 EXPECT_NEAR(0.25f
, constraints
.minimumScale
, 0.01f
);
261 EXPECT_NEAR(0.25f
, constraints
.maximumScale
, 0.01f
);
262 EXPECT_TRUE(page
->viewportDescription().userZoom
);
265 TEST_F(ViewportTest
, viewport9
)
267 UseMockScrollbarSettings mockScrollbarSettings
;
268 registerMockedHttpURLLoad("viewport/viewport-9.html");
270 FrameTestHelpers::WebViewHelper webViewHelper
;
271 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-9.html", true, 0, 0, setViewportSettings
);
273 Page
* page
= webViewHelper
.webViewImpl()->page();
274 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
276 EXPECT_EQ(1280, constraints
.layoutSize
.width());
277 EXPECT_EQ(1408, constraints
.layoutSize
.height());
278 EXPECT_NEAR(0.25f
, constraints
.initialScale
, 0.01f
);
279 EXPECT_NEAR(0.25f
, constraints
.minimumScale
, 0.01f
);
280 EXPECT_NEAR(0.25f
, constraints
.maximumScale
, 0.01f
);
281 EXPECT_TRUE(page
->viewportDescription().userZoom
);
284 TEST_F(ViewportTest
, viewport10
)
286 UseMockScrollbarSettings mockScrollbarSettings
;
287 registerMockedHttpURLLoad("viewport/viewport-10.html");
289 FrameTestHelpers::WebViewHelper webViewHelper
;
290 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-10.html", true, 0, 0, setViewportSettings
);
292 Page
* page
= webViewHelper
.webViewImpl()->page();
293 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
295 EXPECT_EQ(1280, constraints
.layoutSize
.width());
296 EXPECT_EQ(1408, constraints
.layoutSize
.height());
297 EXPECT_NEAR(0.25f
, constraints
.initialScale
, 0.01f
);
298 EXPECT_NEAR(0.25f
, constraints
.minimumScale
, 0.01f
);
299 EXPECT_NEAR(0.25f
, constraints
.maximumScale
, 0.01f
);
300 EXPECT_TRUE(page
->viewportDescription().userZoom
);
303 TEST_F(ViewportTest
, viewport11
)
305 UseMockScrollbarSettings mockScrollbarSettings
;
306 registerMockedHttpURLLoad("viewport/viewport-11.html");
308 FrameTestHelpers::WebViewHelper webViewHelper
;
309 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-11.html", true, 0, 0, setViewportSettings
);
311 Page
* page
= webViewHelper
.webViewImpl()->page();
312 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
314 EXPECT_EQ(980, constraints
.layoutSize
.width());
315 EXPECT_EQ(1078, constraints
.layoutSize
.height());
316 EXPECT_NEAR(0.32f
, constraints
.initialScale
, 0.01f
);
317 EXPECT_NEAR(0.32f
, constraints
.minimumScale
, 0.01f
);
318 EXPECT_NEAR(0.5f
, constraints
.maximumScale
, 0.01f
);
319 EXPECT_TRUE(page
->viewportDescription().userZoom
);
322 TEST_F(ViewportTest
, viewport12
)
324 UseMockScrollbarSettings mockScrollbarSettings
;
325 registerMockedHttpURLLoad("viewport/viewport-12.html");
327 FrameTestHelpers::WebViewHelper webViewHelper
;
328 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-12.html", true, 0, 0, setViewportSettings
);
330 Page
* page
= webViewHelper
.webViewImpl()->page();
331 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
333 EXPECT_EQ(640, constraints
.layoutSize
.width());
334 EXPECT_EQ(704, constraints
.layoutSize
.height());
335 EXPECT_NEAR(0.5f
, constraints
.initialScale
, 0.01f
);
336 EXPECT_NEAR(0.5f
, constraints
.minimumScale
, 0.01f
);
337 EXPECT_NEAR(0.5f
, constraints
.maximumScale
, 0.01f
);
338 EXPECT_TRUE(page
->viewportDescription().userZoom
);
341 TEST_F(ViewportTest
, viewport13
)
343 UseMockScrollbarSettings mockScrollbarSettings
;
344 registerMockedHttpURLLoad("viewport/viewport-13.html");
346 FrameTestHelpers::WebViewHelper webViewHelper
;
347 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-13.html", true, 0, 0, setViewportSettings
);
349 Page
* page
= webViewHelper
.webViewImpl()->page();
350 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
352 EXPECT_EQ(1280, constraints
.layoutSize
.width());
353 EXPECT_EQ(1408, constraints
.layoutSize
.height());
354 EXPECT_NEAR(0.25f
, constraints
.initialScale
, 0.01f
);
355 EXPECT_NEAR(0.25f
, constraints
.minimumScale
, 0.01f
);
356 EXPECT_NEAR(0.5f
, constraints
.maximumScale
, 0.01f
);
357 EXPECT_TRUE(page
->viewportDescription().userZoom
);
360 TEST_F(ViewportTest
, viewport14
)
362 UseMockScrollbarSettings mockScrollbarSettings
;
363 registerMockedHttpURLLoad("viewport/viewport-14.html");
365 FrameTestHelpers::WebViewHelper webViewHelper
;
366 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-14.html", true, 0, 0, setViewportSettings
);
368 Page
* page
= webViewHelper
.webViewImpl()->page();
369 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
371 EXPECT_EQ(320, constraints
.layoutSize
.width());
372 EXPECT_EQ(352, constraints
.layoutSize
.height());
373 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
374 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
375 EXPECT_NEAR(1.0f
, constraints
.maximumScale
, 0.01f
);
376 EXPECT_TRUE(page
->viewportDescription().userZoom
);
379 TEST_F(ViewportTest
, viewport15
)
381 UseMockScrollbarSettings mockScrollbarSettings
;
382 registerMockedHttpURLLoad("viewport/viewport-15.html");
384 FrameTestHelpers::WebViewHelper webViewHelper
;
385 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-15.html", true, 0, 0, setViewportSettings
);
387 Page
* page
= webViewHelper
.webViewImpl()->page();
388 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
390 EXPECT_EQ(980, constraints
.layoutSize
.width());
391 EXPECT_EQ(1078, constraints
.layoutSize
.height());
392 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
393 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
394 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
395 EXPECT_TRUE(page
->viewportDescription().userZoom
);
398 TEST_F(ViewportTest
, viewport16
)
400 UseMockScrollbarSettings mockScrollbarSettings
;
401 registerMockedHttpURLLoad("viewport/viewport-16.html");
403 FrameTestHelpers::WebViewHelper webViewHelper
;
404 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-16.html", true, 0, 0, setViewportSettings
);
406 Page
* page
= webViewHelper
.webViewImpl()->page();
407 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
409 EXPECT_EQ(980, constraints
.layoutSize
.width());
410 EXPECT_EQ(1078, constraints
.layoutSize
.height());
411 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
412 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
413 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
414 EXPECT_TRUE(page
->viewportDescription().userZoom
);
417 TEST_F(ViewportTest
, viewport17
)
419 UseMockScrollbarSettings mockScrollbarSettings
;
420 registerMockedHttpURLLoad("viewport/viewport-17.html");
422 FrameTestHelpers::WebViewHelper webViewHelper
;
423 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-17.html", true, 0, 0, setViewportSettings
);
425 Page
* page
= webViewHelper
.webViewImpl()->page();
426 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
428 EXPECT_EQ(980, constraints
.layoutSize
.width());
429 EXPECT_EQ(1078, constraints
.layoutSize
.height());
430 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
431 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
432 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
433 EXPECT_TRUE(page
->viewportDescription().userZoom
);
436 TEST_F(ViewportTest
, viewport18
)
438 UseMockScrollbarSettings mockScrollbarSettings
;
439 registerMockedHttpURLLoad("viewport/viewport-18.html");
441 FrameTestHelpers::WebViewHelper webViewHelper
;
442 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-18.html", true, 0, 0, setViewportSettings
);
444 Page
* page
= webViewHelper
.webViewImpl()->page();
445 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
447 EXPECT_EQ(64, constraints
.layoutSize
.width());
448 EXPECT_NEAR(70.4, constraints
.layoutSize
.height(), 0.01f
);
449 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
450 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
451 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
452 EXPECT_TRUE(page
->viewportDescription().userZoom
);
455 TEST_F(ViewportTest
, viewport19
)
457 UseMockScrollbarSettings mockScrollbarSettings
;
458 registerMockedHttpURLLoad("viewport/viewport-19.html");
460 FrameTestHelpers::WebViewHelper webViewHelper
;
461 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-19.html", true, 0, 0, setViewportSettings
);
463 Page
* page
= webViewHelper
.webViewImpl()->page();
464 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
466 EXPECT_EQ(160, constraints
.layoutSize
.width());
467 EXPECT_EQ(176, constraints
.layoutSize
.height());
468 EXPECT_NEAR(2.0f
, constraints
.initialScale
, 0.01f
);
469 EXPECT_NEAR(2.0f
, constraints
.minimumScale
, 0.01f
);
470 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
471 EXPECT_TRUE(page
->viewportDescription().userZoom
);
474 TEST_F(ViewportTest
, viewport20
)
476 UseMockScrollbarSettings mockScrollbarSettings
;
477 registerMockedHttpURLLoad("viewport/viewport-20.html");
479 FrameTestHelpers::WebViewHelper webViewHelper
;
480 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-20.html", true, 0, 0, setViewportSettings
);
482 Page
* page
= webViewHelper
.webViewImpl()->page();
483 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
485 EXPECT_EQ(980, constraints
.layoutSize
.width());
486 EXPECT_EQ(1078, constraints
.layoutSize
.height());
487 EXPECT_NEAR(10.0f
, constraints
.initialScale
, 0.01f
);
488 EXPECT_NEAR(10.0f
, constraints
.minimumScale
, 0.01f
);
489 EXPECT_NEAR(10.0f
, constraints
.maximumScale
, 0.01f
);
490 EXPECT_TRUE(page
->viewportDescription().userZoom
);
493 TEST_F(ViewportTest
, viewport21
)
495 UseMockScrollbarSettings mockScrollbarSettings
;
496 registerMockedHttpURLLoad("viewport/viewport-21.html");
498 FrameTestHelpers::WebViewHelper webViewHelper
;
499 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-21.html", true, 0, 0, setViewportSettings
);
501 Page
* page
= webViewHelper
.webViewImpl()->page();
502 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
504 EXPECT_EQ(980, constraints
.layoutSize
.width());
505 EXPECT_EQ(1078, constraints
.layoutSize
.height());
506 EXPECT_NEAR(10.0f
, constraints
.initialScale
, 0.01f
);
507 EXPECT_NEAR(10.0f
, constraints
.minimumScale
, 0.01f
);
508 EXPECT_NEAR(10.0f
, constraints
.maximumScale
, 0.01f
);
509 EXPECT_TRUE(page
->viewportDescription().userZoom
);
512 TEST_F(ViewportTest
, viewport22
)
514 UseMockScrollbarSettings mockScrollbarSettings
;
515 registerMockedHttpURLLoad("viewport/viewport-22.html");
517 FrameTestHelpers::WebViewHelper webViewHelper
;
518 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-22.html", true, 0, 0, setViewportSettings
);
520 Page
* page
= webViewHelper
.webViewImpl()->page();
521 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
523 EXPECT_EQ(980, constraints
.layoutSize
.width());
524 EXPECT_EQ(1078, constraints
.layoutSize
.height());
525 EXPECT_NEAR(10.0f
, constraints
.initialScale
, 0.01f
);
526 EXPECT_NEAR(10.0f
, constraints
.minimumScale
, 0.01f
);
527 EXPECT_NEAR(10.0f
, constraints
.maximumScale
, 0.01f
);
528 EXPECT_TRUE(page
->viewportDescription().userZoom
);
531 TEST_F(ViewportTest
, viewport23
)
533 UseMockScrollbarSettings mockScrollbarSettings
;
534 registerMockedHttpURLLoad("viewport/viewport-23.html");
536 FrameTestHelpers::WebViewHelper webViewHelper
;
537 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-23.html", true, 0, 0, setViewportSettings
);
539 Page
* page
= webViewHelper
.webViewImpl()->page();
540 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
542 EXPECT_EQ(980, constraints
.layoutSize
.width());
543 EXPECT_EQ(1078, constraints
.layoutSize
.height());
544 EXPECT_NEAR(3.0f
, constraints
.initialScale
, 0.01f
);
545 EXPECT_NEAR(3.0f
, constraints
.minimumScale
, 0.01f
);
546 EXPECT_NEAR(3.0f
, constraints
.maximumScale
, 0.01f
);
547 EXPECT_TRUE(page
->viewportDescription().userZoom
);
550 TEST_F(ViewportTest
, viewport24
)
552 UseMockScrollbarSettings mockScrollbarSettings
;
553 registerMockedHttpURLLoad("viewport/viewport-24.html");
555 FrameTestHelpers::WebViewHelper webViewHelper
;
556 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-24.html", true, 0, 0, setViewportSettings
);
558 Page
* page
= webViewHelper
.webViewImpl()->page();
559 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
561 EXPECT_EQ(980, constraints
.layoutSize
.width());
562 EXPECT_EQ(1078, constraints
.layoutSize
.height());
563 EXPECT_NEAR(4.0f
, constraints
.initialScale
, 0.01f
);
564 EXPECT_NEAR(4.0f
, constraints
.minimumScale
, 0.01f
);
565 EXPECT_NEAR(4.0f
, constraints
.maximumScale
, 0.01f
);
566 EXPECT_TRUE(page
->viewportDescription().userZoom
);
569 TEST_F(ViewportTest
, viewport25
)
571 UseMockScrollbarSettings mockScrollbarSettings
;
572 registerMockedHttpURLLoad("viewport/viewport-25.html");
574 FrameTestHelpers::WebViewHelper webViewHelper
;
575 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-25.html", true, 0, 0, setViewportSettings
);
577 Page
* page
= webViewHelper
.webViewImpl()->page();
578 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
580 EXPECT_EQ(980, constraints
.layoutSize
.width());
581 EXPECT_EQ(1078, constraints
.layoutSize
.height());
582 EXPECT_NEAR(10.0f
, constraints
.initialScale
, 0.01f
);
583 EXPECT_NEAR(10.0f
, constraints
.minimumScale
, 0.01f
);
584 EXPECT_NEAR(10.0f
, constraints
.maximumScale
, 0.01f
);
585 EXPECT_TRUE(page
->viewportDescription().userZoom
);
588 TEST_F(ViewportTest
, viewport26
)
590 UseMockScrollbarSettings mockScrollbarSettings
;
591 registerMockedHttpURLLoad("viewport/viewport-26.html");
593 FrameTestHelpers::WebViewHelper webViewHelper
;
594 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-26.html", true, 0, 0, setViewportSettings
);
596 Page
* page
= webViewHelper
.webViewImpl()->page();
597 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
599 EXPECT_EQ(980, constraints
.layoutSize
.width());
600 EXPECT_EQ(1078, constraints
.layoutSize
.height());
601 EXPECT_NEAR(8.0f
, constraints
.initialScale
, 0.01f
);
602 EXPECT_NEAR(8.0f
, constraints
.minimumScale
, 0.01f
);
603 EXPECT_NEAR(9.0f
, constraints
.maximumScale
, 0.01f
);
604 EXPECT_TRUE(page
->viewportDescription().userZoom
);
607 TEST_F(ViewportTest
, viewport27
)
609 UseMockScrollbarSettings mockScrollbarSettings
;
610 registerMockedHttpURLLoad("viewport/viewport-27.html");
612 FrameTestHelpers::WebViewHelper webViewHelper
;
613 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-27.html", true, 0, 0, setViewportSettings
);
615 Page
* page
= webViewHelper
.webViewImpl()->page();
616 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
618 EXPECT_EQ(980, constraints
.layoutSize
.width());
619 EXPECT_EQ(1078, constraints
.layoutSize
.height());
620 EXPECT_NEAR(0.32f
, constraints
.initialScale
, 0.01f
);
621 EXPECT_NEAR(0.32f
, constraints
.minimumScale
, 0.01f
);
622 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
623 EXPECT_TRUE(page
->viewportDescription().userZoom
);
626 TEST_F(ViewportTest
, viewport28
)
628 UseMockScrollbarSettings mockScrollbarSettings
;
629 registerMockedHttpURLLoad("viewport/viewport-28.html");
631 FrameTestHelpers::WebViewHelper webViewHelper
;
632 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-28.html", true, 0, 0, setViewportSettings
);
634 Page
* page
= webViewHelper
.webViewImpl()->page();
635 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
637 EXPECT_EQ(352, constraints
.layoutSize
.width());
638 EXPECT_NEAR(387.2, constraints
.layoutSize
.height(), 0.01);
639 EXPECT_NEAR(0.91f
, constraints
.initialScale
, 0.01f
);
640 EXPECT_NEAR(0.91f
, constraints
.minimumScale
, 0.01f
);
641 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
642 EXPECT_TRUE(page
->viewportDescription().userZoom
);
645 TEST_F(ViewportTest
, viewport29
)
647 UseMockScrollbarSettings mockScrollbarSettings
;
648 registerMockedHttpURLLoad("viewport/viewport-29.html");
650 FrameTestHelpers::WebViewHelper webViewHelper
;
651 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-29.html", true, 0, 0, setViewportSettings
);
653 Page
* page
= webViewHelper
.webViewImpl()->page();
654 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
656 EXPECT_EQ(700, constraints
.layoutSize
.width());
657 EXPECT_EQ(770, constraints
.layoutSize
.height());
658 EXPECT_NEAR(0.46f
, constraints
.initialScale
, 0.01f
);
659 EXPECT_NEAR(0.46f
, constraints
.minimumScale
, 0.01f
);
660 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
661 EXPECT_TRUE(page
->viewportDescription().userZoom
);
664 TEST_F(ViewportTest
, viewport30
)
666 UseMockScrollbarSettings mockScrollbarSettings
;
667 registerMockedHttpURLLoad("viewport/viewport-30.html");
669 FrameTestHelpers::WebViewHelper webViewHelper
;
670 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-30.html", true, 0, 0, setViewportSettings
);
672 Page
* page
= webViewHelper
.webViewImpl()->page();
673 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
675 EXPECT_EQ(200, constraints
.layoutSize
.width());
676 EXPECT_EQ(220, constraints
.layoutSize
.height());
677 EXPECT_NEAR(1.6f
, constraints
.initialScale
, 0.01f
);
678 EXPECT_NEAR(1.6f
, constraints
.minimumScale
, 0.01f
);
679 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
680 EXPECT_TRUE(page
->viewportDescription().userZoom
);
683 TEST_F(ViewportTest
, viewport31
)
685 UseMockScrollbarSettings mockScrollbarSettings
;
686 registerMockedHttpURLLoad("viewport/viewport-31.html");
688 FrameTestHelpers::WebViewHelper webViewHelper
;
689 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-31.html", true, 0, 0, setViewportSettings
);
691 Page
* page
= webViewHelper
.webViewImpl()->page();
692 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
694 EXPECT_EQ(980, constraints
.layoutSize
.width());
695 EXPECT_EQ(700, constraints
.layoutSize
.height());
696 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
697 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
698 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
699 EXPECT_TRUE(page
->viewportDescription().userZoom
);
702 TEST_F(ViewportTest
, viewport32
)
704 UseMockScrollbarSettings mockScrollbarSettings
;
705 registerMockedHttpURLLoad("viewport/viewport-32.html");
707 FrameTestHelpers::WebViewHelper webViewHelper
;
708 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-32.html", true, 0, 0, setViewportSettings
);
710 Page
* page
= webViewHelper
.webViewImpl()->page();
711 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
713 EXPECT_EQ(980, constraints
.layoutSize
.width());
714 EXPECT_EQ(200, constraints
.layoutSize
.height());
715 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
716 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
717 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
718 EXPECT_TRUE(page
->viewportDescription().userZoom
);
721 TEST_F(ViewportTest
, viewport33
)
723 UseMockScrollbarSettings mockScrollbarSettings
;
724 registerMockedHttpURLLoad("viewport/viewport-33.html");
726 FrameTestHelpers::WebViewHelper webViewHelper
;
727 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-33.html", true, 0, 0, setViewportSettings
);
729 Page
* page
= webViewHelper
.webViewImpl()->page();
730 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
732 EXPECT_EQ(320, constraints
.layoutSize
.width());
733 EXPECT_EQ(352, constraints
.layoutSize
.height());
734 EXPECT_NEAR(2.0f
, constraints
.initialScale
, 0.01f
);
735 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
736 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
737 EXPECT_TRUE(page
->viewportDescription().userZoom
);
740 TEST_F(ViewportTest
, viewport34
)
742 UseMockScrollbarSettings mockScrollbarSettings
;
743 registerMockedHttpURLLoad("viewport/viewport-34.html");
745 FrameTestHelpers::WebViewHelper webViewHelper
;
746 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-34.html", true, 0, 0, setViewportSettings
);
748 Page
* page
= webViewHelper
.webViewImpl()->page();
749 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
751 EXPECT_EQ(640, constraints
.layoutSize
.width());
752 EXPECT_EQ(704, constraints
.layoutSize
.height());
753 EXPECT_NEAR(0.5f
, constraints
.initialScale
, 0.01f
);
754 EXPECT_NEAR(0.5f
, constraints
.minimumScale
, 0.01f
);
755 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
756 EXPECT_TRUE(page
->viewportDescription().userZoom
);
759 TEST_F(ViewportTest
, viewport35
)
761 UseMockScrollbarSettings mockScrollbarSettings
;
762 registerMockedHttpURLLoad("viewport/viewport-35.html");
764 FrameTestHelpers::WebViewHelper webViewHelper
;
765 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-35.html", true, 0, 0, setViewportSettings
);
767 Page
* page
= webViewHelper
.webViewImpl()->page();
768 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
770 EXPECT_EQ(1280, constraints
.layoutSize
.width());
771 EXPECT_EQ(1408, constraints
.layoutSize
.height());
772 EXPECT_NEAR(0.25f
, constraints
.initialScale
, 0.01f
);
773 EXPECT_NEAR(0.25f
, constraints
.minimumScale
, 0.01f
);
774 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
775 EXPECT_TRUE(page
->viewportDescription().userZoom
);
778 TEST_F(ViewportTest
, viewport36
)
780 UseMockScrollbarSettings mockScrollbarSettings
;
781 registerMockedHttpURLLoad("viewport/viewport-36.html");
783 FrameTestHelpers::WebViewHelper webViewHelper
;
784 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-36.html", true, 0, 0, setViewportSettings
);
786 Page
* page
= webViewHelper
.webViewImpl()->page();
787 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
789 EXPECT_NEAR(636.36, constraints
.layoutSize
.width(), 0.01f
);
790 EXPECT_EQ(700, constraints
.layoutSize
.height());
791 EXPECT_NEAR(1.6f
, constraints
.initialScale
, 0.01f
);
792 EXPECT_NEAR(0.50f
, constraints
.minimumScale
, 0.01f
);
793 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
794 EXPECT_TRUE(page
->viewportDescription().userZoom
);
797 TEST_F(ViewportTest
, viewport37
)
799 UseMockScrollbarSettings mockScrollbarSettings
;
800 registerMockedHttpURLLoad("viewport/viewport-37.html");
802 FrameTestHelpers::WebViewHelper webViewHelper
;
803 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-37.html", true, 0, 0, setViewportSettings
);
805 Page
* page
= webViewHelper
.webViewImpl()->page();
806 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
808 EXPECT_EQ(320, constraints
.layoutSize
.width());
809 EXPECT_EQ(352, constraints
.layoutSize
.height());
810 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
811 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
812 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
813 EXPECT_TRUE(page
->viewportDescription().userZoom
);
816 TEST_F(ViewportTest
, viewport38
)
818 UseMockScrollbarSettings mockScrollbarSettings
;
819 registerMockedHttpURLLoad("viewport/viewport-38.html");
821 FrameTestHelpers::WebViewHelper webViewHelper
;
822 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-38.html", true, 0, 0, setViewportSettings
);
824 Page
* page
= webViewHelper
.webViewImpl()->page();
825 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
827 EXPECT_EQ(640, constraints
.layoutSize
.width());
828 EXPECT_EQ(704, constraints
.layoutSize
.height());
829 EXPECT_NEAR(0.5f
, constraints
.initialScale
, 0.01f
);
830 EXPECT_NEAR(0.5f
, constraints
.minimumScale
, 0.01f
);
831 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
832 EXPECT_TRUE(page
->viewportDescription().userZoom
);
835 TEST_F(ViewportTest
, viewport39
)
837 UseMockScrollbarSettings mockScrollbarSettings
;
838 registerMockedHttpURLLoad("viewport/viewport-39.html");
840 FrameTestHelpers::WebViewHelper webViewHelper
;
841 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-39.html", true, 0, 0, setViewportSettings
);
843 Page
* page
= webViewHelper
.webViewImpl()->page();
844 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
846 EXPECT_EQ(200, constraints
.layoutSize
.width());
847 EXPECT_EQ(700, constraints
.layoutSize
.height());
848 EXPECT_NEAR(1.6f
, constraints
.initialScale
, 0.01f
);
849 EXPECT_NEAR(1.6f
, constraints
.minimumScale
, 0.01f
);
850 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
851 EXPECT_TRUE(page
->viewportDescription().userZoom
);
854 TEST_F(ViewportTest
, viewport40
)
856 UseMockScrollbarSettings mockScrollbarSettings
;
857 registerMockedHttpURLLoad("viewport/viewport-40.html");
859 FrameTestHelpers::WebViewHelper webViewHelper
;
860 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-40.html", true, 0, 0, setViewportSettings
);
862 Page
* page
= webViewHelper
.webViewImpl()->page();
863 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
865 EXPECT_EQ(700, constraints
.layoutSize
.width());
866 EXPECT_EQ(352, constraints
.layoutSize
.height());
867 EXPECT_NEAR(0.46f
, constraints
.initialScale
, 0.01f
);
868 EXPECT_NEAR(0.46f
, constraints
.minimumScale
, 0.01f
);
869 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
870 EXPECT_TRUE(page
->viewportDescription().userZoom
);
873 TEST_F(ViewportTest
, viewport41
)
875 UseMockScrollbarSettings mockScrollbarSettings
;
876 registerMockedHttpURLLoad("viewport/viewport-41.html");
878 FrameTestHelpers::WebViewHelper webViewHelper
;
879 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-41.html", true, 0, 0, setViewportSettings
);
881 Page
* page
= webViewHelper
.webViewImpl()->page();
882 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
884 EXPECT_EQ(1000, constraints
.layoutSize
.width());
885 EXPECT_EQ(704, constraints
.layoutSize
.height());
886 EXPECT_NEAR(0.5f
, constraints
.initialScale
, 0.01f
);
887 EXPECT_NEAR(0.32f
, constraints
.minimumScale
, 0.01f
);
888 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
889 EXPECT_TRUE(page
->viewportDescription().userZoom
);
892 TEST_F(ViewportTest
, viewport42
)
894 UseMockScrollbarSettings mockScrollbarSettings
;
895 registerMockedHttpURLLoad("viewport/viewport-42.html");
897 FrameTestHelpers::WebViewHelper webViewHelper
;
898 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-42.html", true, 0, 0, setViewportSettings
);
900 Page
* page
= webViewHelper
.webViewImpl()->page();
901 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
903 EXPECT_EQ(320, constraints
.layoutSize
.width());
904 EXPECT_EQ(1000, constraints
.layoutSize
.height());
905 EXPECT_NEAR(2.0f
, constraints
.initialScale
, 0.01f
);
906 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
907 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
908 EXPECT_TRUE(page
->viewportDescription().userZoom
);
911 TEST_F(ViewportTest
, viewport43
)
913 UseMockScrollbarSettings mockScrollbarSettings
;
914 registerMockedHttpURLLoad("viewport/viewport-43.html");
916 FrameTestHelpers::WebViewHelper webViewHelper
;
917 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-43.html", true, 0, 0, setViewportSettings
);
919 Page
* page
= webViewHelper
.webViewImpl()->page();
920 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
922 EXPECT_EQ(64, constraints
.layoutSize
.width());
923 EXPECT_NEAR(70.4, constraints
.layoutSize
.height(), 0.01f
);
924 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
925 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
926 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
927 EXPECT_TRUE(page
->viewportDescription().userZoom
);
930 TEST_F(ViewportTest
, viewport44
)
932 UseMockScrollbarSettings mockScrollbarSettings
;
933 registerMockedHttpURLLoad("viewport/viewport-44.html");
935 FrameTestHelpers::WebViewHelper webViewHelper
;
936 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-44.html", true, 0, 0, setViewportSettings
);
938 Page
* page
= webViewHelper
.webViewImpl()->page();
939 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
941 EXPECT_EQ(10000, constraints
.layoutSize
.width());
942 EXPECT_EQ(10000, constraints
.layoutSize
.height());
943 EXPECT_NEAR(0.25f
, constraints
.initialScale
, 0.01f
);
944 EXPECT_NEAR(0.25f
, constraints
.minimumScale
, 0.01f
);
945 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
946 EXPECT_TRUE(page
->viewportDescription().userZoom
);
949 TEST_F(ViewportTest
, viewport45
)
951 UseMockScrollbarSettings mockScrollbarSettings
;
952 registerMockedHttpURLLoad("viewport/viewport-45.html");
954 FrameTestHelpers::WebViewHelper webViewHelper
;
955 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-45.html", true, 0, 0, setViewportSettings
);
957 Page
* page
= webViewHelper
.webViewImpl()->page();
958 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
960 EXPECT_EQ(3200, constraints
.layoutSize
.width());
961 EXPECT_EQ(3520, constraints
.layoutSize
.height());
962 EXPECT_NEAR(0.1f
, constraints
.initialScale
, 0.01f
);
963 EXPECT_NEAR(0.1f
, constraints
.minimumScale
, 0.01f
);
964 EXPECT_NEAR(0.1f
, constraints
.maximumScale
, 0.01f
);
965 EXPECT_TRUE(page
->viewportDescription().userZoom
);
968 TEST_F(ViewportTest
, viewport46
)
970 UseMockScrollbarSettings mockScrollbarSettings
;
971 registerMockedHttpURLLoad("viewport/viewport-46.html");
973 FrameTestHelpers::WebViewHelper webViewHelper
;
974 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-46.html", true, 0, 0, setViewportSettings
);
976 Page
* page
= webViewHelper
.webViewImpl()->page();
977 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
979 EXPECT_EQ(32, constraints
.layoutSize
.width());
980 EXPECT_NEAR(35.2, constraints
.layoutSize
.height(), 0.01f
);
981 EXPECT_NEAR(10.0f
, constraints
.initialScale
, 0.01f
);
982 EXPECT_NEAR(10.0f
, constraints
.minimumScale
, 0.01f
);
983 EXPECT_NEAR(10.0f
, constraints
.maximumScale
, 0.01f
);
984 EXPECT_TRUE(page
->viewportDescription().userZoom
);
987 TEST_F(ViewportTest
, viewport47
)
989 UseMockScrollbarSettings mockScrollbarSettings
;
990 registerMockedHttpURLLoad("viewport/viewport-47.html");
992 FrameTestHelpers::WebViewHelper webViewHelper
;
993 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-47.html", true, 0, 0, setViewportSettings
);
995 Page
* page
= webViewHelper
.webViewImpl()->page();
996 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
998 EXPECT_EQ(320, constraints
.layoutSize
.width());
999 EXPECT_EQ(3000, constraints
.layoutSize
.height());
1000 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
1001 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
1002 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1003 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1006 TEST_F(ViewportTest
, viewport48
)
1008 UseMockScrollbarSettings mockScrollbarSettings
;
1009 registerMockedHttpURLLoad("viewport/viewport-48.html");
1011 FrameTestHelpers::WebViewHelper webViewHelper
;
1012 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-48.html", true, 0, 0, setViewportSettings
);
1014 Page
* page
= webViewHelper
.webViewImpl()->page();
1015 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1017 EXPECT_EQ(3000, constraints
.layoutSize
.width());
1018 EXPECT_EQ(352, constraints
.layoutSize
.height());
1019 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
1020 EXPECT_NEAR(0.25f
, constraints
.minimumScale
, 0.01f
);
1021 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1022 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1025 TEST_F(ViewportTest
, viewport49
)
1027 UseMockScrollbarSettings mockScrollbarSettings
;
1028 registerMockedHttpURLLoad("viewport/viewport-49.html");
1030 FrameTestHelpers::WebViewHelper webViewHelper
;
1031 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-49.html", true, 0, 0, setViewportSettings
);
1033 Page
* page
= webViewHelper
.webViewImpl()->page();
1034 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1036 EXPECT_EQ(320, constraints
.layoutSize
.width());
1037 EXPECT_EQ(352, constraints
.layoutSize
.height());
1038 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
1039 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
1040 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1041 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1044 TEST_F(ViewportTest
, viewport50
)
1046 UseMockScrollbarSettings mockScrollbarSettings
;
1047 registerMockedHttpURLLoad("viewport/viewport-50.html");
1049 FrameTestHelpers::WebViewHelper webViewHelper
;
1050 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-50.html", true, 0, 0, setViewportSettings
);
1052 Page
* page
= webViewHelper
.webViewImpl()->page();
1053 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1055 EXPECT_EQ(980, constraints
.layoutSize
.width());
1056 EXPECT_EQ(1078, constraints
.layoutSize
.height());
1057 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
1058 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
1059 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1060 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1063 TEST_F(ViewportTest
, viewport51
)
1065 UseMockScrollbarSettings mockScrollbarSettings
;
1066 registerMockedHttpURLLoad("viewport/viewport-51.html");
1068 FrameTestHelpers::WebViewHelper webViewHelper
;
1069 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-51.html", true, 0, 0, setViewportSettings
);
1071 Page
* page
= webViewHelper
.webViewImpl()->page();
1072 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1074 EXPECT_EQ(980, constraints
.layoutSize
.width());
1075 EXPECT_EQ(1078, constraints
.layoutSize
.height());
1076 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
1077 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
1078 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1079 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1082 TEST_F(ViewportTest
, viewport52
)
1084 UseMockScrollbarSettings mockScrollbarSettings
;
1085 registerMockedHttpURLLoad("viewport/viewport-52.html");
1087 FrameTestHelpers::WebViewHelper webViewHelper
;
1088 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-52.html", true, 0, 0, setViewportSettings
);
1090 Page
* page
= webViewHelper
.webViewImpl()->page();
1091 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1093 EXPECT_EQ(64, constraints
.layoutSize
.width());
1094 EXPECT_NEAR(70.4, constraints
.layoutSize
.height(), 0.01f
);
1095 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
1096 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
1097 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1098 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1101 TEST_F(ViewportTest
, viewport53
)
1103 UseMockScrollbarSettings mockScrollbarSettings
;
1104 registerMockedHttpURLLoad("viewport/viewport-53.html");
1106 FrameTestHelpers::WebViewHelper webViewHelper
;
1107 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-53.html", true, 0, 0, setViewportSettings
);
1109 Page
* page
= webViewHelper
.webViewImpl()->page();
1110 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1112 EXPECT_EQ(980, constraints
.layoutSize
.width());
1113 EXPECT_NEAR(70.4, constraints
.layoutSize
.height(), 0.01f
);
1114 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
1115 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
1116 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1117 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1120 TEST_F(ViewportTest
, viewport54
)
1122 UseMockScrollbarSettings mockScrollbarSettings
;
1123 registerMockedHttpURLLoad("viewport/viewport-54.html");
1125 FrameTestHelpers::WebViewHelper webViewHelper
;
1126 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-54.html", true, 0, 0, setViewportSettings
);
1128 Page
* page
= webViewHelper
.webViewImpl()->page();
1129 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1131 EXPECT_EQ(64, constraints
.layoutSize
.width());
1132 EXPECT_NEAR(70.4, constraints
.layoutSize
.height(), 0.01f
);
1133 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
1134 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
1135 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1136 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1139 TEST_F(ViewportTest
, viewport55
)
1141 UseMockScrollbarSettings mockScrollbarSettings
;
1142 registerMockedHttpURLLoad("viewport/viewport-55.html");
1144 FrameTestHelpers::WebViewHelper webViewHelper
;
1145 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-55.html", true, 0, 0, setViewportSettings
);
1147 Page
* page
= webViewHelper
.webViewImpl()->page();
1148 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1150 EXPECT_EQ(64, constraints
.layoutSize
.width());
1151 EXPECT_NEAR(70.4, constraints
.layoutSize
.height(), 0.01f
);
1152 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
1153 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
1154 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1155 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1158 TEST_F(ViewportTest
, viewport56
)
1160 UseMockScrollbarSettings mockScrollbarSettings
;
1161 registerMockedHttpURLLoad("viewport/viewport-56.html");
1163 FrameTestHelpers::WebViewHelper webViewHelper
;
1164 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-56.html", true, 0, 0, setViewportSettings
);
1166 Page
* page
= webViewHelper
.webViewImpl()->page();
1167 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1169 EXPECT_EQ(980, constraints
.layoutSize
.width());
1170 EXPECT_EQ(1078, constraints
.layoutSize
.height());
1171 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
1172 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
1173 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1174 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1177 TEST_F(ViewportTest
, viewport57
)
1179 UseMockScrollbarSettings mockScrollbarSettings
;
1180 registerMockedHttpURLLoad("viewport/viewport-57.html");
1182 FrameTestHelpers::WebViewHelper webViewHelper
;
1183 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-57.html", true, 0, 0, setViewportSettings
);
1185 Page
* page
= webViewHelper
.webViewImpl()->page();
1186 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1188 EXPECT_EQ(320, constraints
.layoutSize
.width());
1189 EXPECT_EQ(352, constraints
.layoutSize
.height());
1190 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
1191 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
1192 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1193 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1196 TEST_F(ViewportTest
, viewport58
)
1198 UseMockScrollbarSettings mockScrollbarSettings
;
1199 registerMockedHttpURLLoad("viewport/viewport-58.html");
1201 FrameTestHelpers::WebViewHelper webViewHelper
;
1202 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-58.html", true, 0, 0, setViewportSettings
);
1204 Page
* page
= webViewHelper
.webViewImpl()->page();
1205 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1207 EXPECT_EQ(3200, constraints
.layoutSize
.width());
1208 EXPECT_EQ(3520, constraints
.layoutSize
.height());
1209 EXPECT_NEAR(0.1f
, constraints
.initialScale
, 0.01f
);
1210 EXPECT_NEAR(0.1f
, constraints
.minimumScale
, 0.01f
);
1211 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1212 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1215 TEST_F(ViewportTest
, viewport59
)
1217 UseMockScrollbarSettings mockScrollbarSettings
;
1218 registerMockedHttpURLLoad("viewport/viewport-59.html");
1220 FrameTestHelpers::WebViewHelper webViewHelper
;
1221 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-59.html", true, 0, 0, setViewportSettings
);
1223 Page
* page
= webViewHelper
.webViewImpl()->page();
1224 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1226 EXPECT_EQ(320, constraints
.layoutSize
.width());
1227 EXPECT_EQ(352, constraints
.layoutSize
.height());
1228 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
1229 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
1230 EXPECT_NEAR(1.0f
, constraints
.maximumScale
, 0.01f
);
1231 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1234 TEST_F(ViewportTest
, viewport60
)
1236 UseMockScrollbarSettings mockScrollbarSettings
;
1237 registerMockedHttpURLLoad("viewport/viewport-60.html");
1239 FrameTestHelpers::WebViewHelper webViewHelper
;
1240 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-60.html", true, 0, 0, setViewportSettings
);
1242 Page
* page
= webViewHelper
.webViewImpl()->page();
1243 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1245 EXPECT_EQ(32, constraints
.layoutSize
.width());
1246 EXPECT_NEAR(35.2, constraints
.layoutSize
.height(), 0.01f
);
1247 EXPECT_NEAR(10.0f
, constraints
.initialScale
, 0.01f
);
1248 EXPECT_NEAR(10.0f
, constraints
.minimumScale
, 0.01f
);
1249 EXPECT_NEAR(10.0f
, constraints
.maximumScale
, 0.01f
);
1250 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1253 TEST_F(ViewportTest
, viewport61
)
1255 UseMockScrollbarSettings mockScrollbarSettings
;
1256 registerMockedHttpURLLoad("viewport/viewport-61.html");
1258 FrameTestHelpers::WebViewHelper webViewHelper
;
1259 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-61.html", true, 0, 0, setViewportSettings
);
1261 Page
* page
= webViewHelper
.webViewImpl()->page();
1262 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1264 EXPECT_EQ(320, constraints
.layoutSize
.width());
1265 EXPECT_EQ(352, constraints
.layoutSize
.height());
1266 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
1267 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
1268 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1269 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1272 TEST_F(ViewportTest
, viewport62
)
1274 UseMockScrollbarSettings mockScrollbarSettings
;
1275 registerMockedHttpURLLoad("viewport/viewport-62.html");
1277 FrameTestHelpers::WebViewHelper webViewHelper
;
1278 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-62.html", true, 0, 0, setViewportSettings
);
1280 Page
* page
= webViewHelper
.webViewImpl()->page();
1281 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1283 EXPECT_EQ(320, constraints
.layoutSize
.width());
1284 EXPECT_EQ(352, constraints
.layoutSize
.height());
1285 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
1286 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
1287 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1288 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1291 TEST_F(ViewportTest
, viewport63
)
1293 UseMockScrollbarSettings mockScrollbarSettings
;
1294 registerMockedHttpURLLoad("viewport/viewport-63.html");
1296 FrameTestHelpers::WebViewHelper webViewHelper
;
1297 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-63.html", true, 0, 0, setViewportSettings
);
1299 Page
* page
= webViewHelper
.webViewImpl()->page();
1300 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1302 EXPECT_EQ(320, constraints
.layoutSize
.width());
1303 EXPECT_EQ(352, constraints
.layoutSize
.height());
1304 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
1305 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
1306 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1307 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1310 TEST_F(ViewportTest
, viewport64
)
1312 UseMockScrollbarSettings mockScrollbarSettings
;
1313 registerMockedHttpURLLoad("viewport/viewport-64.html");
1315 FrameTestHelpers::WebViewHelper webViewHelper
;
1316 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-64.html", true, 0, 0, setViewportSettings
);
1318 Page
* page
= webViewHelper
.webViewImpl()->page();
1319 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1321 EXPECT_EQ(320, constraints
.layoutSize
.width());
1322 EXPECT_EQ(352, constraints
.layoutSize
.height());
1323 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
1324 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
1325 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1326 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1329 TEST_F(ViewportTest
, viewport65
)
1331 UseMockScrollbarSettings mockScrollbarSettings
;
1332 registerMockedHttpURLLoad("viewport/viewport-65.html");
1334 FrameTestHelpers::WebViewHelper webViewHelper
;
1335 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-65.html", true, 0, 0, setViewportSettings
);
1337 Page
* page
= webViewHelper
.webViewImpl()->page();
1338 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1340 EXPECT_EQ(100, constraints
.layoutSize
.width());
1341 EXPECT_EQ(110, constraints
.layoutSize
.height());
1342 EXPECT_NEAR(3.2f
, constraints
.initialScale
, 0.01f
);
1343 EXPECT_NEAR(3.2f
, constraints
.minimumScale
, 0.01f
);
1344 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1345 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1348 TEST_F(ViewportTest
, viewport66
)
1350 UseMockScrollbarSettings mockScrollbarSettings
;
1351 registerMockedHttpURLLoad("viewport/viewport-66.html");
1353 FrameTestHelpers::WebViewHelper webViewHelper
;
1354 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-66.html", true, 0, 0, setViewportSettings
);
1356 Page
* page
= webViewHelper
.webViewImpl()->page();
1357 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1359 EXPECT_EQ(100, constraints
.layoutSize
.width());
1360 EXPECT_EQ(110, constraints
.layoutSize
.height());
1361 EXPECT_NEAR(3.2f
, constraints
.initialScale
, 0.01f
);
1362 EXPECT_NEAR(3.2f
, constraints
.minimumScale
, 0.01f
);
1363 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1364 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1367 TEST_F(ViewportTest
, viewport67
)
1369 UseMockScrollbarSettings mockScrollbarSettings
;
1370 registerMockedHttpURLLoad("viewport/viewport-67.html");
1372 FrameTestHelpers::WebViewHelper webViewHelper
;
1373 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-67.html", true, 0, 0, setViewportSettings
);
1375 Page
* page
= webViewHelper
.webViewImpl()->page();
1376 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1378 EXPECT_EQ(320, constraints
.layoutSize
.width());
1379 EXPECT_EQ(352, constraints
.layoutSize
.height());
1380 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
1381 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
1382 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1383 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1386 TEST_F(ViewportTest
, viewport68
)
1388 UseMockScrollbarSettings mockScrollbarSettings
;
1389 registerMockedHttpURLLoad("viewport/viewport-68.html");
1391 FrameTestHelpers::WebViewHelper webViewHelper
;
1392 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-68.html", true, 0, 0, setViewportSettings
);
1394 Page
* page
= webViewHelper
.webViewImpl()->page();
1395 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1397 EXPECT_EQ(320, constraints
.layoutSize
.width());
1398 EXPECT_EQ(352, constraints
.layoutSize
.height());
1399 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
1400 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
1401 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1402 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1405 TEST_F(ViewportTest
, viewport69
)
1407 UseMockScrollbarSettings mockScrollbarSettings
;
1408 registerMockedHttpURLLoad("viewport/viewport-69.html");
1410 FrameTestHelpers::WebViewHelper webViewHelper
;
1411 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-69.html", true, 0, 0, setViewportSettings
);
1413 Page
* page
= webViewHelper
.webViewImpl()->page();
1414 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1416 EXPECT_EQ(100, constraints
.layoutSize
.width());
1417 EXPECT_EQ(110, constraints
.layoutSize
.height());
1418 EXPECT_NEAR(3.2f
, constraints
.initialScale
, 0.01f
);
1419 EXPECT_NEAR(3.2f
, constraints
.minimumScale
, 0.01f
);
1420 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1421 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1424 TEST_F(ViewportTest
, viewport70
)
1426 UseMockScrollbarSettings mockScrollbarSettings
;
1427 registerMockedHttpURLLoad("viewport/viewport-70.html");
1429 FrameTestHelpers::WebViewHelper webViewHelper
;
1430 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-70.html", true, 0, 0, setViewportSettings
);
1432 Page
* page
= webViewHelper
.webViewImpl()->page();
1433 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1435 EXPECT_EQ(100, constraints
.layoutSize
.width());
1436 EXPECT_EQ(110, constraints
.layoutSize
.height());
1437 EXPECT_NEAR(3.2f
, constraints
.initialScale
, 0.01f
);
1438 EXPECT_NEAR(3.2f
, constraints
.minimumScale
, 0.01f
);
1439 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1440 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1443 TEST_F(ViewportTest
, viewport71
)
1445 UseMockScrollbarSettings mockScrollbarSettings
;
1446 registerMockedHttpURLLoad("viewport/viewport-71.html");
1448 FrameTestHelpers::WebViewHelper webViewHelper
;
1449 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-71.html", true, 0, 0, setViewportSettings
);
1451 Page
* page
= webViewHelper
.webViewImpl()->page();
1452 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1454 EXPECT_EQ(320, constraints
.layoutSize
.width());
1455 EXPECT_EQ(352, constraints
.layoutSize
.height());
1456 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
1457 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
1458 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1459 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1462 TEST_F(ViewportTest
, viewport72
)
1464 UseMockScrollbarSettings mockScrollbarSettings
;
1465 registerMockedHttpURLLoad("viewport/viewport-72.html");
1467 FrameTestHelpers::WebViewHelper webViewHelper
;
1468 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-72.html", true, 0, 0, setViewportSettings
);
1470 Page
* page
= webViewHelper
.webViewImpl()->page();
1471 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1473 EXPECT_EQ(100, constraints
.layoutSize
.width());
1474 EXPECT_EQ(110, constraints
.layoutSize
.height());
1475 EXPECT_NEAR(3.2f
, constraints
.initialScale
, 0.01f
);
1476 EXPECT_NEAR(3.2f
, constraints
.minimumScale
, 0.01f
);
1477 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1478 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1481 TEST_F(ViewportTest
, viewport73
)
1483 UseMockScrollbarSettings mockScrollbarSettings
;
1484 registerMockedHttpURLLoad("viewport/viewport-73.html");
1486 FrameTestHelpers::WebViewHelper webViewHelper
;
1487 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-73.html", true, 0, 0, setViewportSettings
);
1489 Page
* page
= webViewHelper
.webViewImpl()->page();
1490 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1492 EXPECT_EQ(100, constraints
.layoutSize
.width());
1493 EXPECT_EQ(110, constraints
.layoutSize
.height());
1494 EXPECT_NEAR(3.2f
, constraints
.initialScale
, 0.01f
);
1495 EXPECT_NEAR(3.2f
, constraints
.minimumScale
, 0.01f
);
1496 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1497 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1500 TEST_F(ViewportTest
, viewport74
)
1502 UseMockScrollbarSettings mockScrollbarSettings
;
1503 registerMockedHttpURLLoad("viewport/viewport-74.html");
1505 FrameTestHelpers::WebViewHelper webViewHelper
;
1506 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-74.html", true, 0, 0, setViewportSettings
);
1508 Page
* page
= webViewHelper
.webViewImpl()->page();
1509 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1511 EXPECT_EQ(100, constraints
.layoutSize
.width());
1512 EXPECT_EQ(110, constraints
.layoutSize
.height());
1513 EXPECT_NEAR(3.2f
, constraints
.initialScale
, 0.01f
);
1514 EXPECT_NEAR(3.2f
, constraints
.minimumScale
, 0.01f
);
1515 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1516 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1519 TEST_F(ViewportTest
, viewport75
)
1521 UseMockScrollbarSettings mockScrollbarSettings
;
1522 registerMockedHttpURLLoad("viewport/viewport-75.html");
1524 FrameTestHelpers::WebViewHelper webViewHelper
;
1525 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-75.html", true, 0, 0, setViewportSettings
);
1527 Page
* page
= webViewHelper
.webViewImpl()->page();
1528 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1530 EXPECT_EQ(64, constraints
.layoutSize
.width());
1531 EXPECT_NEAR(70.4, constraints
.layoutSize
.height(), 0.01f
);
1532 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
1533 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
1534 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1535 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1538 TEST_F(ViewportTest
, viewport76
)
1540 UseMockScrollbarSettings mockScrollbarSettings
;
1541 registerMockedHttpURLLoad("viewport/viewport-76.html");
1543 FrameTestHelpers::WebViewHelper webViewHelper
;
1544 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-76.html", true, 0, 0, setViewportSettings
);
1546 Page
* page
= webViewHelper
.webViewImpl()->page();
1547 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1549 EXPECT_EQ(32, constraints
.layoutSize
.width());
1550 EXPECT_NEAR(35.2, constraints
.layoutSize
.height(), 0.01);
1551 EXPECT_NEAR(10.0f
, constraints
.initialScale
, 0.01f
);
1552 EXPECT_NEAR(10.0f
, constraints
.minimumScale
, 0.01f
);
1553 EXPECT_NEAR(10.0f
, constraints
.maximumScale
, 0.01f
);
1554 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1557 TEST_F(ViewportTest
, viewport77
)
1559 UseMockScrollbarSettings mockScrollbarSettings
;
1560 registerMockedHttpURLLoad("viewport/viewport-77.html");
1562 FrameTestHelpers::WebViewHelper webViewHelper
;
1563 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-77.html", true, 0, 0, setViewportSettings
);
1565 Page
* page
= webViewHelper
.webViewImpl()->page();
1566 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1568 EXPECT_EQ(1280, constraints
.layoutSize
.width());
1569 EXPECT_EQ(1408, constraints
.layoutSize
.height());
1570 EXPECT_NEAR(0.25f
, constraints
.initialScale
, 0.01f
);
1571 EXPECT_NEAR(0.25f
, constraints
.minimumScale
, 0.01f
);
1572 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1573 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1576 TEST_F(ViewportTest
, viewport78
)
1578 UseMockScrollbarSettings mockScrollbarSettings
;
1579 registerMockedHttpURLLoad("viewport/viewport-78.html");
1581 FrameTestHelpers::WebViewHelper webViewHelper
;
1582 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-78.html", true, 0, 0, setViewportSettings
);
1584 Page
* page
= webViewHelper
.webViewImpl()->page();
1585 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1587 EXPECT_EQ(100, constraints
.layoutSize
.width());
1588 EXPECT_EQ(110, constraints
.layoutSize
.height());
1589 EXPECT_NEAR(3.2f
, constraints
.initialScale
, 0.01f
);
1590 EXPECT_NEAR(3.2f
, constraints
.minimumScale
, 0.01f
);
1591 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1592 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1595 TEST_F(ViewportTest
, viewport79
)
1597 UseMockScrollbarSettings mockScrollbarSettings
;
1598 registerMockedHttpURLLoad("viewport/viewport-79.html");
1600 FrameTestHelpers::WebViewHelper webViewHelper
;
1601 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-79.html", true, 0, 0, setViewportSettings
);
1603 Page
* page
= webViewHelper
.webViewImpl()->page();
1604 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1606 EXPECT_EQ(320, constraints
.layoutSize
.width());
1607 EXPECT_EQ(352, constraints
.layoutSize
.height());
1608 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
1609 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
1610 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1611 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1614 TEST_F(ViewportTest
, viewport80
)
1616 UseMockScrollbarSettings mockScrollbarSettings
;
1617 registerMockedHttpURLLoad("viewport/viewport-80.html");
1619 FrameTestHelpers::WebViewHelper webViewHelper
;
1620 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-80.html", true, 0, 0, setViewportSettings
);
1622 Page
* page
= webViewHelper
.webViewImpl()->page();
1623 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1625 EXPECT_EQ(320, constraints
.layoutSize
.width());
1626 EXPECT_EQ(352, constraints
.layoutSize
.height());
1627 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
1628 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
1629 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1630 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1633 TEST_F(ViewportTest
, viewport81
)
1635 UseMockScrollbarSettings mockScrollbarSettings
;
1636 registerMockedHttpURLLoad("viewport/viewport-81.html");
1638 FrameTestHelpers::WebViewHelper webViewHelper
;
1639 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-81.html", true, 0, 0, setViewportSettings
);
1641 Page
* page
= webViewHelper
.webViewImpl()->page();
1642 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1644 EXPECT_EQ(3000, constraints
.layoutSize
.width());
1645 EXPECT_EQ(3300, constraints
.layoutSize
.height());
1646 EXPECT_NEAR(0.25f
, constraints
.initialScale
, 0.01f
);
1647 EXPECT_NEAR(0.25f
, constraints
.minimumScale
, 0.01f
);
1648 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1649 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1652 TEST_F(ViewportTest
, viewport82
)
1654 UseMockScrollbarSettings mockScrollbarSettings
;
1655 registerMockedHttpURLLoad("viewport/viewport-82.html");
1657 FrameTestHelpers::WebViewHelper webViewHelper
;
1658 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-82.html", true, 0, 0, setViewportSettings
);
1660 Page
* page
= webViewHelper
.webViewImpl()->page();
1661 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1663 EXPECT_EQ(400, constraints
.layoutSize
.width());
1664 EXPECT_EQ(440, constraints
.layoutSize
.height());
1665 EXPECT_NEAR(0.8f
, constraints
.initialScale
, 0.01f
);
1666 EXPECT_NEAR(0.8f
, constraints
.minimumScale
, 0.01f
);
1667 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1668 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1671 TEST_F(ViewportTest
, viewport83
)
1673 UseMockScrollbarSettings mockScrollbarSettings
;
1674 registerMockedHttpURLLoad("viewport/viewport-83.html");
1676 FrameTestHelpers::WebViewHelper webViewHelper
;
1677 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-83.html", true, 0, 0, setViewportSettings
);
1679 Page
* page
= webViewHelper
.webViewImpl()->page();
1680 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1682 EXPECT_EQ(64, constraints
.layoutSize
.width());
1683 EXPECT_NEAR(70.4, constraints
.layoutSize
.height(), 0.01f
);
1684 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
1685 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
1686 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1687 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1690 TEST_F(ViewportTest
, viewport84
)
1692 UseMockScrollbarSettings mockScrollbarSettings
;
1693 registerMockedHttpURLLoad("viewport/viewport-84.html");
1695 FrameTestHelpers::WebViewHelper webViewHelper
;
1696 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-84.html", true, 0, 0, setViewportSettings
);
1698 Page
* page
= webViewHelper
.webViewImpl()->page();
1699 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1701 EXPECT_EQ(64, constraints
.layoutSize
.width());
1702 EXPECT_EQ(480, constraints
.layoutSize
.height());
1703 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
1704 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
1705 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1706 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1709 TEST_F(ViewportTest
, viewport85
)
1711 UseMockScrollbarSettings mockScrollbarSettings
;
1712 registerMockedHttpURLLoad("viewport/viewport-85.html");
1714 FrameTestHelpers::WebViewHelper webViewHelper
;
1715 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-85.html", true, 0, 0, setViewportSettings
);
1717 Page
* page
= webViewHelper
.webViewImpl()->page();
1718 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1720 EXPECT_EQ(540, constraints
.layoutSize
.width());
1721 EXPECT_EQ(594, constraints
.layoutSize
.height());
1722 EXPECT_NEAR(0.59f
, constraints
.initialScale
, 0.01f
);
1723 EXPECT_NEAR(0.59f
, constraints
.minimumScale
, 0.01f
);
1724 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1725 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1728 TEST_F(ViewportTest
, viewport86
)
1730 UseMockScrollbarSettings mockScrollbarSettings
;
1731 registerMockedHttpURLLoad("viewport/viewport-86.html");
1733 FrameTestHelpers::WebViewHelper webViewHelper
;
1734 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-86.html", true, 0, 0, setViewportSettings
);
1736 Page
* page
= webViewHelper
.webViewImpl()->page();
1737 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1739 EXPECT_NEAR(457.14, constraints
.layoutSize
.width(), 0.01f
);
1740 EXPECT_NEAR(502.86, constraints
.layoutSize
.height(), 0.01f
);
1741 EXPECT_NEAR(0.7f
, constraints
.initialScale
, 0.01f
);
1742 EXPECT_NEAR(0.7f
, constraints
.minimumScale
, 0.01f
);
1743 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1744 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1747 TEST_F(ViewportTest
, viewport87
)
1749 UseMockScrollbarSettings mockScrollbarSettings
;
1750 registerMockedHttpURLLoad("viewport/viewport-87.html");
1752 FrameTestHelpers::WebViewHelper webViewHelper
;
1753 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-87.html", true, 0, 0, setViewportSettings
);
1755 Page
* page
= webViewHelper
.webViewImpl()->page();
1756 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1758 EXPECT_EQ(64, constraints
.layoutSize
.width());
1759 EXPECT_NEAR(70.4, constraints
.layoutSize
.height(), 0.01f
);
1760 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
1761 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
1762 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1763 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1766 TEST_F(ViewportTest
, viewport88
)
1768 UseMockScrollbarSettings mockScrollbarSettings
;
1769 registerMockedHttpURLLoad("viewport/viewport-88.html");
1771 FrameTestHelpers::WebViewHelper webViewHelper
;
1772 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-88.html", true, 0, 0, setViewportSettings
);
1774 Page
* page
= webViewHelper
.webViewImpl()->page();
1775 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1777 EXPECT_EQ(980, constraints
.layoutSize
.width());
1778 EXPECT_EQ(1078, constraints
.layoutSize
.height());
1779 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
1780 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
1781 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1782 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1785 TEST_F(ViewportTest
, viewport90
)
1787 UseMockScrollbarSettings mockScrollbarSettings
;
1788 registerMockedHttpURLLoad("viewport/viewport-90.html");
1790 FrameTestHelpers::WebViewHelper webViewHelper
;
1791 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-90.html", true, 0, 0, setViewportSettings
);
1793 Page
* page
= webViewHelper
.webViewImpl()->page();
1794 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1796 EXPECT_EQ(700, constraints
.layoutSize
.width());
1797 EXPECT_EQ(770, constraints
.layoutSize
.height());
1798 EXPECT_NEAR(0.5f
, constraints
.initialScale
, 0.01f
);
1799 EXPECT_NEAR(0.46f
, constraints
.minimumScale
, 0.01f
);
1800 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1801 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1804 TEST_F(ViewportTest
, viewport100
)
1806 UseMockScrollbarSettings mockScrollbarSettings
;
1807 registerMockedHttpURLLoad("viewport/viewport-100.html");
1809 FrameTestHelpers::WebViewHelper webViewHelper
;
1810 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-100.html", true, 0, 0, setViewportSettings
);
1812 Page
* page
= webViewHelper
.webViewImpl()->page();
1813 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1815 EXPECT_EQ(400, constraints
.layoutSize
.width());
1816 EXPECT_EQ(440, constraints
.layoutSize
.height());
1817 EXPECT_NEAR(0.8f
, constraints
.initialScale
, 0.01f
);
1818 EXPECT_NEAR(0.8f
, constraints
.minimumScale
, 0.01f
);
1819 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1820 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1823 TEST_F(ViewportTest
, viewport101
)
1825 UseMockScrollbarSettings mockScrollbarSettings
;
1826 registerMockedHttpURLLoad("viewport/viewport-101.html");
1828 FrameTestHelpers::WebViewHelper webViewHelper
;
1829 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-101.html", true, 0, 0, setViewportSettings
);
1831 Page
* page
= webViewHelper
.webViewImpl()->page();
1832 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1834 EXPECT_EQ(400, constraints
.layoutSize
.width());
1835 EXPECT_EQ(440, constraints
.layoutSize
.height());
1836 EXPECT_NEAR(0.8f
, constraints
.initialScale
, 0.01f
);
1837 EXPECT_NEAR(0.8f
, constraints
.minimumScale
, 0.01f
);
1838 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1839 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1842 TEST_F(ViewportTest
, viewport102
)
1844 UseMockScrollbarSettings mockScrollbarSettings
;
1845 registerMockedHttpURLLoad("viewport/viewport-102.html");
1847 FrameTestHelpers::WebViewHelper webViewHelper
;
1848 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-102.html", true, 0, 0, setViewportSettings
);
1850 Page
* page
= webViewHelper
.webViewImpl()->page();
1851 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1853 EXPECT_EQ(400, constraints
.layoutSize
.width());
1854 EXPECT_EQ(440, constraints
.layoutSize
.height());
1855 EXPECT_NEAR(0.8f
, constraints
.initialScale
, 0.01f
);
1856 EXPECT_NEAR(0.8f
, constraints
.minimumScale
, 0.01f
);
1857 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1858 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1861 TEST_F(ViewportTest
, viewport103
)
1863 UseMockScrollbarSettings mockScrollbarSettings
;
1864 registerMockedHttpURLLoad("viewport/viewport-103.html");
1866 FrameTestHelpers::WebViewHelper webViewHelper
;
1867 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-103.html", true, 0, 0, setViewportSettings
);
1869 Page
* page
= webViewHelper
.webViewImpl()->page();
1870 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1872 EXPECT_EQ(400, constraints
.layoutSize
.width());
1873 EXPECT_EQ(440, constraints
.layoutSize
.height());
1874 EXPECT_NEAR(0.8f
, constraints
.initialScale
, 0.01f
);
1875 EXPECT_NEAR(0.8f
, constraints
.minimumScale
, 0.01f
);
1876 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1877 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1880 TEST_F(ViewportTest
, viewport104
)
1882 UseMockScrollbarSettings mockScrollbarSettings
;
1883 registerMockedHttpURLLoad("viewport/viewport-104.html");
1885 FrameTestHelpers::WebViewHelper webViewHelper
;
1886 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-104.html", true, 0, 0, setViewportSettings
);
1888 Page
* page
= webViewHelper
.webViewImpl()->page();
1889 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1891 EXPECT_EQ(980, constraints
.layoutSize
.width());
1892 EXPECT_EQ(1078, constraints
.layoutSize
.height());
1893 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
1894 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
1895 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1896 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1899 TEST_F(ViewportTest
, viewport105
)
1901 UseMockScrollbarSettings mockScrollbarSettings
;
1902 registerMockedHttpURLLoad("viewport/viewport-105.html");
1904 FrameTestHelpers::WebViewHelper webViewHelper
;
1905 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-105.html", true, 0, 0, setViewportSettings
);
1907 Page
* page
= webViewHelper
.webViewImpl()->page();
1908 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1910 EXPECT_EQ(980, constraints
.layoutSize
.width());
1911 EXPECT_EQ(1078, constraints
.layoutSize
.height());
1912 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
1913 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
1914 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1915 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1918 TEST_F(ViewportTest
, viewport106
)
1920 UseMockScrollbarSettings mockScrollbarSettings
;
1921 registerMockedHttpURLLoad("viewport/viewport-106.html");
1923 FrameTestHelpers::WebViewHelper webViewHelper
;
1924 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-106.html", true, 0, 0, setViewportSettings
);
1926 Page
* page
= webViewHelper
.webViewImpl()->page();
1927 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1929 EXPECT_EQ(980, constraints
.layoutSize
.width());
1930 EXPECT_EQ(1078, constraints
.layoutSize
.height());
1931 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
1932 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
1933 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1934 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1937 TEST_F(ViewportTest
, viewport107
)
1939 UseMockScrollbarSettings mockScrollbarSettings
;
1940 registerMockedHttpURLLoad("viewport/viewport-107.html");
1942 FrameTestHelpers::WebViewHelper webViewHelper
;
1943 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-107.html", true, 0, 0, setViewportSettings
);
1945 Page
* page
= webViewHelper
.webViewImpl()->page();
1946 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1948 EXPECT_EQ(980, constraints
.layoutSize
.width());
1949 EXPECT_EQ(1078, constraints
.layoutSize
.height());
1950 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
1951 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
1952 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1953 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1956 TEST_F(ViewportTest
, viewport108
)
1958 UseMockScrollbarSettings mockScrollbarSettings
;
1959 registerMockedHttpURLLoad("viewport/viewport-108.html");
1961 FrameTestHelpers::WebViewHelper webViewHelper
;
1962 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-108.html", true, 0, 0, setViewportSettings
);
1964 Page
* page
= webViewHelper
.webViewImpl()->page();
1965 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1967 EXPECT_EQ(980, constraints
.layoutSize
.width());
1968 EXPECT_EQ(1078, constraints
.layoutSize
.height());
1969 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
1970 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
1971 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1972 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1975 TEST_F(ViewportTest
, viewport109
)
1977 UseMockScrollbarSettings mockScrollbarSettings
;
1978 registerMockedHttpURLLoad("viewport/viewport-109.html");
1980 FrameTestHelpers::WebViewHelper webViewHelper
;
1981 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-109.html", true, 0, 0, setViewportSettings
);
1983 Page
* page
= webViewHelper
.webViewImpl()->page();
1984 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
1986 EXPECT_EQ(980, constraints
.layoutSize
.width());
1987 EXPECT_EQ(1078, constraints
.layoutSize
.height());
1988 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
1989 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
1990 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
1991 EXPECT_TRUE(page
->viewportDescription().userZoom
);
1994 TEST_F(ViewportTest
, viewport110
)
1996 UseMockScrollbarSettings mockScrollbarSettings
;
1997 registerMockedHttpURLLoad("viewport/viewport-110.html");
1999 FrameTestHelpers::WebViewHelper webViewHelper
;
2000 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-110.html", true, 0, 0, setViewportSettings
);
2002 Page
* page
= webViewHelper
.webViewImpl()->page();
2003 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2005 EXPECT_EQ(980, constraints
.layoutSize
.width());
2006 EXPECT_EQ(1078, constraints
.layoutSize
.height());
2007 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
2008 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
2009 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2010 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2013 TEST_F(ViewportTest
, viewport111
)
2015 UseMockScrollbarSettings mockScrollbarSettings
;
2016 registerMockedHttpURLLoad("viewport/viewport-111.html");
2018 FrameTestHelpers::WebViewHelper webViewHelper
;
2019 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-111.html", true, 0, 0, setViewportSettings
);
2021 Page
* page
= webViewHelper
.webViewImpl()->page();
2022 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2024 EXPECT_EQ(980, constraints
.layoutSize
.width());
2025 EXPECT_EQ(1078, constraints
.layoutSize
.height());
2026 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
2027 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
2028 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2029 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2032 TEST_F(ViewportTest
, viewport112
)
2034 UseMockScrollbarSettings mockScrollbarSettings
;
2035 registerMockedHttpURLLoad("viewport/viewport-112.html");
2037 FrameTestHelpers::WebViewHelper webViewHelper
;
2038 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-112.html", true, 0, 0, setViewportSettings
);
2040 Page
* page
= webViewHelper
.webViewImpl()->page();
2041 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2043 EXPECT_EQ(400, constraints
.layoutSize
.width());
2044 EXPECT_EQ(440, constraints
.layoutSize
.height());
2045 EXPECT_NEAR(0.8f
, constraints
.initialScale
, 0.01f
);
2046 EXPECT_NEAR(0.8f
, constraints
.minimumScale
, 0.01f
);
2047 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2048 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2051 TEST_F(ViewportTest
, viewport113
)
2053 UseMockScrollbarSettings mockScrollbarSettings
;
2054 registerMockedHttpURLLoad("viewport/viewport-113.html");
2056 FrameTestHelpers::WebViewHelper webViewHelper
;
2057 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-113.html", true, 0, 0, setViewportSettings
);
2059 Page
* page
= webViewHelper
.webViewImpl()->page();
2060 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2062 EXPECT_EQ(980, constraints
.layoutSize
.width());
2063 EXPECT_EQ(1078, constraints
.layoutSize
.height());
2064 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
2065 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
2066 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2067 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2070 TEST_F(ViewportTest
, viewport114
)
2072 UseMockScrollbarSettings mockScrollbarSettings
;
2073 registerMockedHttpURLLoad("viewport/viewport-114.html");
2075 FrameTestHelpers::WebViewHelper webViewHelper
;
2076 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-114.html", true, 0, 0, setViewportSettings
);
2078 Page
* page
= webViewHelper
.webViewImpl()->page();
2079 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2081 EXPECT_EQ(980, constraints
.layoutSize
.width());
2082 EXPECT_EQ(1078, constraints
.layoutSize
.height());
2083 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
2084 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
2085 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2086 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2089 TEST_F(ViewportTest
, viewport115
)
2091 UseMockScrollbarSettings mockScrollbarSettings
;
2092 registerMockedHttpURLLoad("viewport/viewport-115.html");
2094 FrameTestHelpers::WebViewHelper webViewHelper
;
2095 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-115.html", true, 0, 0, setViewportSettings
);
2097 Page
* page
= webViewHelper
.webViewImpl()->page();
2098 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2100 EXPECT_EQ(400, constraints
.layoutSize
.width());
2101 EXPECT_EQ(440, constraints
.layoutSize
.height());
2102 EXPECT_NEAR(0.8f
, constraints
.initialScale
, 0.01f
);
2103 EXPECT_NEAR(0.8f
, constraints
.minimumScale
, 0.01f
);
2104 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2105 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2108 TEST_F(ViewportTest
, viewport116
)
2110 UseMockScrollbarSettings mockScrollbarSettings
;
2111 registerMockedHttpURLLoad("viewport/viewport-116.html");
2113 FrameTestHelpers::WebViewHelper webViewHelper
;
2114 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-116.html", true, 0, 0, setViewportSettings
);
2116 Page
* page
= webViewHelper
.webViewImpl()->page();
2117 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2119 EXPECT_EQ(400, constraints
.layoutSize
.width());
2120 EXPECT_EQ(440, constraints
.layoutSize
.height());
2121 EXPECT_NEAR(0.8f
, constraints
.initialScale
, 0.01f
);
2122 EXPECT_NEAR(0.8f
, constraints
.minimumScale
, 0.01f
);
2123 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2124 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2127 TEST_F(ViewportTest
, viewport117
)
2129 UseMockScrollbarSettings mockScrollbarSettings
;
2130 registerMockedHttpURLLoad("viewport/viewport-117.html");
2132 FrameTestHelpers::WebViewHelper webViewHelper
;
2133 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-117.html", true, 0, 0, setViewportSettings
);
2135 Page
* page
= webViewHelper
.webViewImpl()->page();
2136 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2138 EXPECT_EQ(980, constraints
.layoutSize
.width());
2139 EXPECT_EQ(400, constraints
.layoutSize
.height());
2140 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
2141 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
2142 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2143 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2146 TEST_F(ViewportTest
, viewport118
)
2148 UseMockScrollbarSettings mockScrollbarSettings
;
2149 registerMockedHttpURLLoad("viewport/viewport-118.html");
2151 FrameTestHelpers::WebViewHelper webViewHelper
;
2152 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-118.html", true, 0, 0, setViewportSettings
);
2154 Page
* page
= webViewHelper
.webViewImpl()->page();
2155 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2157 EXPECT_EQ(320, constraints
.layoutSize
.width());
2158 EXPECT_EQ(352, constraints
.layoutSize
.height());
2159 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2160 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2161 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2162 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2165 TEST_F(ViewportTest
, viewport119
)
2167 UseMockScrollbarSettings mockScrollbarSettings
;
2168 registerMockedHttpURLLoad("viewport/viewport-119.html");
2170 FrameTestHelpers::WebViewHelper webViewHelper
;
2171 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-119.html", true, 0, 0, setViewportSettings
);
2173 Page
* page
= webViewHelper
.webViewImpl()->page();
2174 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2176 EXPECT_EQ(320, constraints
.layoutSize
.width());
2177 EXPECT_EQ(352, constraints
.layoutSize
.height());
2178 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2179 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2180 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2181 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2184 TEST_F(ViewportTest
, viewport120
)
2186 UseMockScrollbarSettings mockScrollbarSettings
;
2187 registerMockedHttpURLLoad("viewport/viewport-120.html");
2189 FrameTestHelpers::WebViewHelper webViewHelper
;
2190 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-120.html", true, 0, 0, setViewportSettings
);
2192 Page
* page
= webViewHelper
.webViewImpl()->page();
2193 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2195 EXPECT_EQ(320, constraints
.layoutSize
.width());
2196 EXPECT_EQ(352, constraints
.layoutSize
.height());
2197 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2198 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2199 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2200 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2203 TEST_F(ViewportTest
, viewport121
)
2205 UseMockScrollbarSettings mockScrollbarSettings
;
2206 registerMockedHttpURLLoad("viewport/viewport-121.html");
2208 FrameTestHelpers::WebViewHelper webViewHelper
;
2209 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-121.html", true, 0, 0, setViewportSettings
);
2211 Page
* page
= webViewHelper
.webViewImpl()->page();
2212 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2214 EXPECT_EQ(64, constraints
.layoutSize
.width());
2215 EXPECT_NEAR(70.4, constraints
.layoutSize
.height(), 0.01f
);
2216 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
2217 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
2218 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2219 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2222 TEST_F(ViewportTest
, viewport122
)
2224 UseMockScrollbarSettings mockScrollbarSettings
;
2225 registerMockedHttpURLLoad("viewport/viewport-122.html");
2227 FrameTestHelpers::WebViewHelper webViewHelper
;
2228 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-122.html", true, 0, 0, setViewportSettings
);
2230 Page
* page
= webViewHelper
.webViewImpl()->page();
2231 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2233 EXPECT_EQ(64, constraints
.layoutSize
.width());
2234 EXPECT_NEAR(70.4, constraints
.layoutSize
.height(), 0.01f
);
2235 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
2236 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
2237 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2238 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2241 TEST_F(ViewportTest
, viewport123
)
2243 UseMockScrollbarSettings mockScrollbarSettings
;
2244 registerMockedHttpURLLoad("viewport/viewport-123.html");
2246 FrameTestHelpers::WebViewHelper webViewHelper
;
2247 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-123.html", true, 0, 0, setViewportSettings
);
2249 Page
* page
= webViewHelper
.webViewImpl()->page();
2250 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2252 EXPECT_EQ(320, constraints
.layoutSize
.width());
2253 EXPECT_EQ(352, constraints
.layoutSize
.height());
2254 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2255 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2256 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2257 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2260 TEST_F(ViewportTest
, viewport124
)
2262 UseMockScrollbarSettings mockScrollbarSettings
;
2263 registerMockedHttpURLLoad("viewport/viewport-124.html");
2265 FrameTestHelpers::WebViewHelper webViewHelper
;
2266 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-124.html", true, 0, 0, setViewportSettings
);
2268 Page
* page
= webViewHelper
.webViewImpl()->page();
2269 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2271 EXPECT_EQ(320, constraints
.layoutSize
.width());
2272 EXPECT_EQ(352, constraints
.layoutSize
.height());
2273 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2274 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2275 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2276 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2279 TEST_F(ViewportTest
, viewport125
)
2281 UseMockScrollbarSettings mockScrollbarSettings
;
2282 registerMockedHttpURLLoad("viewport/viewport-125.html");
2284 FrameTestHelpers::WebViewHelper webViewHelper
;
2285 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-125.html", true, 0, 0, setViewportSettings
);
2287 Page
* page
= webViewHelper
.webViewImpl()->page();
2288 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2290 EXPECT_EQ(64, constraints
.layoutSize
.width());
2291 EXPECT_NEAR(70.4, constraints
.layoutSize
.height(), 0.01f
);
2292 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
2293 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
2294 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2295 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2298 TEST_F(ViewportTest
, viewport126
)
2300 UseMockScrollbarSettings mockScrollbarSettings
;
2301 registerMockedHttpURLLoad("viewport/viewport-126.html");
2303 FrameTestHelpers::WebViewHelper webViewHelper
;
2304 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-126.html", true, 0, 0, setViewportSettings
);
2306 Page
* page
= webViewHelper
.webViewImpl()->page();
2307 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2309 EXPECT_EQ(64, constraints
.layoutSize
.width());
2310 EXPECT_NEAR(70.4, constraints
.layoutSize
.height(), 0.01f
);
2311 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
2312 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
2313 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2314 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2317 TEST_F(ViewportTest
, viewport127
)
2319 UseMockScrollbarSettings mockScrollbarSettings
;
2320 registerMockedHttpURLLoad("viewport/viewport-127.html");
2322 FrameTestHelpers::WebViewHelper webViewHelper
;
2323 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-127.html", true, 0, 0, setViewportSettings
);
2325 Page
* page
= webViewHelper
.webViewImpl()->page();
2326 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2328 EXPECT_EQ(64, constraints
.layoutSize
.width());
2329 EXPECT_NEAR(70.4, constraints
.layoutSize
.height(), 0.01f
);
2330 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
2331 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
2332 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2333 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2336 TEST_F(ViewportTest
, viewport129
)
2338 UseMockScrollbarSettings mockScrollbarSettings
;
2339 registerMockedHttpURLLoad("viewport/viewport-129.html");
2341 FrameTestHelpers::WebViewHelper webViewHelper
;
2342 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-129.html", true, 0, 0, setViewportSettings
);
2344 Page
* page
= webViewHelper
.webViewImpl()->page();
2345 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2347 EXPECT_EQ(123, constraints
.layoutSize
.width());
2348 EXPECT_NEAR(135.3, constraints
.layoutSize
.height(), 0.01f
);
2349 EXPECT_NEAR(2.60f
, constraints
.initialScale
, 0.01f
);
2350 EXPECT_NEAR(2.60f
, constraints
.minimumScale
, 0.01f
);
2351 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2352 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2355 TEST_F(ViewportTest
, viewport130
)
2357 UseMockScrollbarSettings mockScrollbarSettings
;
2358 registerMockedHttpURLLoad("viewport/viewport-130.html");
2360 FrameTestHelpers::WebViewHelper webViewHelper
;
2361 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-130.html", true, 0, 0, setViewportSettings
);
2363 Page
* page
= webViewHelper
.webViewImpl()->page();
2364 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2366 EXPECT_EQ(320, constraints
.layoutSize
.width());
2367 EXPECT_EQ(352, constraints
.layoutSize
.height());
2368 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2369 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2370 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2371 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2374 TEST_F(ViewportTest
, viewport131
)
2376 UseMockScrollbarSettings mockScrollbarSettings
;
2377 registerMockedHttpURLLoad("viewport/viewport-131.html");
2379 FrameTestHelpers::WebViewHelper webViewHelper
;
2380 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-131.html", true, 0, 0, setViewportSettings
);
2382 Page
* page
= webViewHelper
.webViewImpl()->page();
2383 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2385 EXPECT_EQ(320, constraints
.layoutSize
.width());
2386 EXPECT_EQ(352, constraints
.layoutSize
.height());
2387 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2388 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2389 EXPECT_NEAR(1.0f
, constraints
.maximumScale
, 0.01f
);
2390 EXPECT_FALSE(page
->viewportDescription().userZoom
);
2393 TEST_F(ViewportTest
, viewport132
)
2395 UseMockScrollbarSettings mockScrollbarSettings
;
2396 registerMockedHttpURLLoad("viewport/viewport-132.html");
2398 FrameTestHelpers::WebViewHelper webViewHelper
;
2399 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-132.html", true, 0, 0, setViewportSettings
);
2401 Page
* page
= webViewHelper
.webViewImpl()->page();
2402 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2404 EXPECT_EQ(320, constraints
.layoutSize
.width());
2405 EXPECT_EQ(352, constraints
.layoutSize
.height());
2406 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2407 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2408 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2409 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2412 TEST_F(ViewportTest
, viewport133
)
2414 UseMockScrollbarSettings mockScrollbarSettings
;
2415 registerMockedHttpURLLoad("viewport/viewport-133.html");
2417 FrameTestHelpers::WebViewHelper webViewHelper
;
2418 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-133.html", true, 0, 0, setViewportSettings
);
2420 Page
* page
= webViewHelper
.webViewImpl()->page();
2421 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2423 EXPECT_EQ(980, constraints
.layoutSize
.width());
2424 EXPECT_EQ(1078, constraints
.layoutSize
.height());
2425 EXPECT_NEAR(10.0f
, constraints
.initialScale
, 0.01f
);
2426 EXPECT_NEAR(10.0f
, constraints
.minimumScale
, 0.01f
);
2427 EXPECT_NEAR(10.0f
, constraints
.maximumScale
, 0.01f
);
2428 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2431 TEST_F(ViewportTest
, viewport134
)
2433 UseMockScrollbarSettings mockScrollbarSettings
;
2434 registerMockedHttpURLLoad("viewport/viewport-134.html");
2436 FrameTestHelpers::WebViewHelper webViewHelper
;
2437 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-134.html", true, 0, 0, setViewportSettings
);
2439 Page
* page
= webViewHelper
.webViewImpl()->page();
2440 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2442 EXPECT_EQ(160, constraints
.layoutSize
.width());
2443 EXPECT_EQ(176, constraints
.layoutSize
.height());
2444 EXPECT_NEAR(2.0f
, constraints
.initialScale
, 0.01f
);
2445 EXPECT_NEAR(2.0f
, constraints
.minimumScale
, 0.01f
);
2446 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2447 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2450 TEST_F(ViewportTest
, viewport135
)
2452 UseMockScrollbarSettings mockScrollbarSettings
;
2453 registerMockedHttpURLLoad("viewport/viewport-135.html");
2455 FrameTestHelpers::WebViewHelper webViewHelper
;
2456 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-135.html", true, 0, 0, setViewportSettings
);
2458 Page
* page
= webViewHelper
.webViewImpl()->page();
2459 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2461 EXPECT_EQ(980, constraints
.layoutSize
.width());
2462 EXPECT_EQ(1078, constraints
.layoutSize
.height());
2463 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
2464 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
2465 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2466 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2469 TEST_F(ViewportTest
, viewport136
)
2471 UseMockScrollbarSettings mockScrollbarSettings
;
2472 registerMockedHttpURLLoad("viewport/viewport-136.html");
2474 FrameTestHelpers::WebViewHelper webViewHelper
;
2475 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-136.html", true, 0, 0, setViewportSettings
);
2477 Page
* page
= webViewHelper
.webViewImpl()->page();
2478 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2480 EXPECT_EQ(320, constraints
.layoutSize
.width());
2481 EXPECT_EQ(352, constraints
.layoutSize
.height());
2482 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2483 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2484 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2485 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2488 TEST_F(ViewportTest
, viewport137
)
2490 UseMockScrollbarSettings mockScrollbarSettings
;
2491 registerMockedHttpURLLoad("viewport/viewport-137.html");
2493 FrameTestHelpers::WebViewHelper webViewHelper
;
2494 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-137.html", true, 0, 0, setViewportSettings
);
2496 Page
* page
= webViewHelper
.webViewImpl()->page();
2497 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2499 EXPECT_EQ(980, constraints
.layoutSize
.width());
2500 EXPECT_EQ(1078, constraints
.layoutSize
.height());
2501 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
2502 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
2503 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2504 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2507 TEST_F(ViewportTest
, viewport138
)
2509 registerMockedHttpURLLoad("viewport/viewport-138.html");
2511 FrameTestHelpers::WebViewHelper webViewHelper
;
2512 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-138.html", true, 0, 0, setViewportSettings
);
2514 Page
* page
= webViewHelper
.webViewImpl()->page();
2515 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2517 EXPECT_NEAR(123.0f
, constraints
.layoutSize
.width(), 0.01);
2518 EXPECT_NEAR(135.3f
, constraints
.layoutSize
.height(), 0.01);
2519 EXPECT_NEAR(2.60f
, constraints
.initialScale
, 0.01f
);
2520 EXPECT_NEAR(2.60f
, constraints
.minimumScale
, 0.01f
);
2521 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2522 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2525 TEST_F(ViewportTest
, viewportLegacyHandheldFriendly
)
2527 UseMockScrollbarSettings mockScrollbarSettings
;
2528 registerMockedHttpURLLoad("viewport/viewport-legacy-handheldfriendly.html");
2530 FrameTestHelpers::WebViewHelper webViewHelper
;
2531 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-handheldfriendly.html", true, 0, 0, setViewportSettings
);
2533 Page
* page
= webViewHelper
.webViewImpl()->page();
2534 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2536 EXPECT_EQ(320, constraints
.layoutSize
.width());
2537 EXPECT_EQ(352, constraints
.layoutSize
.height());
2538 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2539 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2540 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2541 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2544 static void setQuirkViewportSettings(WebSettings
* settings
)
2546 setViewportSettings(settings
);
2548 // This quirk allows content attributes of meta viewport tags to be merged.
2549 settings
->setViewportMetaMergeContentQuirk(true);
2552 TEST_F(ViewportTest
, viewportLegacyMergeQuirk1
)
2554 UseMockScrollbarSettings mockScrollbarSettings
;
2555 registerMockedHttpURLLoad("viewport/viewport-legacy-merge-quirk-1.html");
2557 FrameTestHelpers::WebViewHelper webViewHelper
;
2558 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-merge-quirk-1.html", true, 0, 0, setQuirkViewportSettings
);
2560 Page
* page
= webViewHelper
.webViewImpl()->page();
2561 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2563 EXPECT_EQ(640, constraints
.layoutSize
.width());
2564 EXPECT_EQ(704, constraints
.layoutSize
.height());
2565 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2566 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2567 EXPECT_NEAR(1.0f
, constraints
.maximumScale
, 0.01f
);
2568 EXPECT_FALSE(page
->viewportDescription().userZoom
);
2571 TEST_F(ViewportTest
, viewportLegacyMergeQuirk2
)
2573 UseMockScrollbarSettings mockScrollbarSettings
;
2574 registerMockedHttpURLLoad("viewport/viewport-legacy-merge-quirk-2.html");
2576 FrameTestHelpers::WebViewHelper webViewHelper
;
2577 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-merge-quirk-2.html", true, 0, 0, setQuirkViewportSettings
);
2579 Page
* page
= webViewHelper
.webViewImpl()->page();
2581 // This quirk allows content attributes of meta viewport tags to be merged.
2582 page
->settings().setViewportMetaMergeContentQuirk(true);
2583 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2585 EXPECT_EQ(500, constraints
.layoutSize
.width());
2586 EXPECT_EQ(550, constraints
.layoutSize
.height());
2587 EXPECT_NEAR(2.0f
, constraints
.initialScale
, 0.01f
);
2588 EXPECT_NEAR(2.0f
, constraints
.minimumScale
, 0.01f
);
2589 EXPECT_NEAR(2.0f
, constraints
.maximumScale
, 0.01f
);
2590 EXPECT_FALSE(page
->viewportDescription().userZoom
);
2593 TEST_F(ViewportTest
, viewportLegacyMobileOptimizedMetaWithoutContent
)
2595 UseMockScrollbarSettings mockScrollbarSettings
;
2596 registerMockedHttpURLLoad("viewport/viewport-legacy-mobileoptimized.html");
2598 FrameTestHelpers::WebViewHelper webViewHelper
;
2599 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-mobileoptimized.html", true, 0, 0, setViewportSettings
);
2601 Page
* page
= webViewHelper
.webViewImpl()->page();
2603 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2605 EXPECT_EQ(320, constraints
.layoutSize
.width());
2606 EXPECT_EQ(352, constraints
.layoutSize
.height());
2607 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2608 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2609 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2610 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2613 TEST_F(ViewportTest
, viewportLegacyMobileOptimizedMetaWith0
)
2615 UseMockScrollbarSettings mockScrollbarSettings
;
2616 registerMockedHttpURLLoad("viewport/viewport-legacy-mobileoptimized-2.html");
2618 FrameTestHelpers::WebViewHelper webViewHelper
;
2619 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-mobileoptimized-2.html", true, 0, 0, setViewportSettings
);
2621 Page
* page
= webViewHelper
.webViewImpl()->page();
2623 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2625 EXPECT_EQ(320, constraints
.layoutSize
.width());
2626 EXPECT_EQ(352, constraints
.layoutSize
.height());
2627 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2628 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2629 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2630 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2633 TEST_F(ViewportTest
, viewportLegacyMobileOptimizedMetaWith400
)
2635 UseMockScrollbarSettings mockScrollbarSettings
;
2636 registerMockedHttpURLLoad("viewport/viewport-legacy-mobileoptimized-2.html");
2638 FrameTestHelpers::WebViewHelper webViewHelper
;
2639 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-mobileoptimized-2.html", true, 0, 0, setViewportSettings
);
2641 Page
* page
= webViewHelper
.webViewImpl()->page();
2643 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2645 EXPECT_EQ(320, constraints
.layoutSize
.width());
2646 EXPECT_EQ(352, constraints
.layoutSize
.height());
2647 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2648 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2649 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2650 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2653 TEST_F(ViewportTest
, viewportLegacyOrdering2
)
2655 UseMockScrollbarSettings mockScrollbarSettings
;
2656 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-2.html");
2658 FrameTestHelpers::WebViewHelper webViewHelper
;
2659 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-ordering-2.html", true, 0, 0, setViewportSettings
);
2661 Page
* page
= webViewHelper
.webViewImpl()->page();
2663 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2665 EXPECT_EQ(300, constraints
.layoutSize
.width());
2666 EXPECT_EQ(330, constraints
.layoutSize
.height());
2667 EXPECT_NEAR(1.07f
, constraints
.initialScale
, 0.01f
);
2668 EXPECT_NEAR(1.07f
, constraints
.minimumScale
, 0.01f
);
2669 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2670 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2673 TEST_F(ViewportTest
, viewportLegacyOrdering3
)
2675 UseMockScrollbarSettings mockScrollbarSettings
;
2676 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-3.html");
2678 FrameTestHelpers::WebViewHelper webViewHelper
;
2679 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-ordering-3.html", true, 0, 0, setViewportSettings
);
2681 Page
* page
= webViewHelper
.webViewImpl()->page();
2683 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2685 EXPECT_EQ(300, constraints
.layoutSize
.width());
2686 EXPECT_EQ(330, constraints
.layoutSize
.height());
2687 EXPECT_NEAR(1.07f
, constraints
.initialScale
, 0.01f
);
2688 EXPECT_NEAR(1.07f
, constraints
.minimumScale
, 0.01f
);
2689 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2690 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2693 TEST_F(ViewportTest
, viewportLegacyOrdering4
)
2695 UseMockScrollbarSettings mockScrollbarSettings
;
2696 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-4.html");
2698 FrameTestHelpers::WebViewHelper webViewHelper
;
2699 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-ordering-4.html", true, 0, 0, setViewportSettings
);
2701 Page
* page
= webViewHelper
.webViewImpl()->page();
2703 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2705 EXPECT_EQ(300, constraints
.layoutSize
.width());
2706 EXPECT_EQ(330, constraints
.layoutSize
.height());
2707 EXPECT_NEAR(1.07f
, constraints
.initialScale
, 0.01f
);
2708 EXPECT_NEAR(1.07f
, constraints
.minimumScale
, 0.01f
);
2709 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2710 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2713 TEST_F(ViewportTest
, viewportLegacyOrdering5
)
2715 UseMockScrollbarSettings mockScrollbarSettings
;
2716 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-5.html");
2718 FrameTestHelpers::WebViewHelper webViewHelper
;
2719 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-ordering-5.html", true, 0, 0, setViewportSettings
);
2721 Page
* page
= webViewHelper
.webViewImpl()->page();
2723 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2725 EXPECT_EQ(320, constraints
.layoutSize
.width());
2726 EXPECT_EQ(352, constraints
.layoutSize
.height());
2727 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2728 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2729 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2730 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2733 TEST_F(ViewportTest
, viewportLegacyOrdering6
)
2735 UseMockScrollbarSettings mockScrollbarSettings
;
2736 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-6.html");
2738 FrameTestHelpers::WebViewHelper webViewHelper
;
2739 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-ordering-6.html", true, 0, 0, setViewportSettings
);
2741 Page
* page
= webViewHelper
.webViewImpl()->page();
2743 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2745 EXPECT_EQ(320, constraints
.layoutSize
.width());
2746 EXPECT_EQ(352, constraints
.layoutSize
.height());
2747 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2748 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2749 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2750 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2753 TEST_F(ViewportTest
, viewportLegacyOrdering7
)
2755 UseMockScrollbarSettings mockScrollbarSettings
;
2756 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-7.html");
2758 FrameTestHelpers::WebViewHelper webViewHelper
;
2759 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-ordering-7.html", true, 0, 0, setViewportSettings
);
2761 Page
* page
= webViewHelper
.webViewImpl()->page();
2763 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2765 EXPECT_EQ(300, constraints
.layoutSize
.width());
2766 EXPECT_EQ(330, constraints
.layoutSize
.height());
2767 EXPECT_NEAR(1.07f
, constraints
.initialScale
, 0.01f
);
2768 EXPECT_NEAR(1.07f
, constraints
.minimumScale
, 0.01f
);
2769 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2770 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2773 TEST_F(ViewportTest
, viewportLegacyOrdering8
)
2775 UseMockScrollbarSettings mockScrollbarSettings
;
2776 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-8.html");
2778 FrameTestHelpers::WebViewHelper webViewHelper
;
2779 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-ordering-8.html", true, 0, 0, setViewportSettings
);
2781 Page
* page
= webViewHelper
.webViewImpl()->page();
2783 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2785 EXPECT_EQ(300, constraints
.layoutSize
.width());
2786 EXPECT_EQ(330, constraints
.layoutSize
.height());
2787 EXPECT_NEAR(1.07f
, constraints
.initialScale
, 0.01f
);
2788 EXPECT_NEAR(1.07f
, constraints
.minimumScale
, 0.01f
);
2789 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2790 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2793 TEST_F(ViewportTest
, viewportLegacyEmptyAtViewportDoesntOverrideViewportMeta
)
2795 UseMockScrollbarSettings mockScrollbarSettings
;
2796 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-10.html");
2798 FrameTestHelpers::WebViewHelper webViewHelper
;
2799 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-ordering-10.html", true, 0, 0, setViewportSettings
);
2801 Page
* page
= webViewHelper
.webViewImpl()->page();
2802 PageScaleConstraints constraints
= runViewportTest(page
, 800, 600);
2804 EXPECT_EQ(5000, constraints
.layoutSize
.width());
2807 TEST_F(ViewportTest
, viewportLegacyDefaultValueChangedByXHTMLMP
)
2809 UseMockScrollbarSettings mockScrollbarSettings
;
2810 registerMockedHttpURLLoad("viewport/viewport-legacy-xhtmlmp.html");
2812 FrameTestHelpers::WebViewHelper webViewHelper
;
2813 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-xhtmlmp.html", true, 0, 0, setViewportSettings
);
2815 Page
* page
= webViewHelper
.webViewImpl()->page();
2816 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2818 EXPECT_EQ(320, constraints
.layoutSize
.width());
2819 EXPECT_EQ(352, constraints
.layoutSize
.height());
2820 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2821 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2822 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2823 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2826 TEST_F(ViewportTest
, viewportLegacyDefaultValueChangedByXHTMLMPAndOverriddenByMeta
)
2828 UseMockScrollbarSettings mockScrollbarSettings
;
2829 registerMockedHttpURLLoad("viewport/viewport-legacy-xhtmlmp-misplaced-doctype.html");
2831 FrameTestHelpers::WebViewHelper webViewHelper
;
2832 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-xhtmlmp-misplaced-doctype.html", true, 0, 0, setViewportSettings
);
2834 Page
* page
= webViewHelper
.webViewImpl()->page();
2835 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2837 EXPECT_EQ(640, constraints
.layoutSize
.width());
2838 EXPECT_EQ(704, constraints
.layoutSize
.height());
2839 EXPECT_NEAR(0.5f
, constraints
.initialScale
, 0.01f
);
2840 EXPECT_NEAR(0.5f
, constraints
.minimumScale
, 0.01f
);
2841 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2842 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2845 TEST_F(ViewportTest
, viewportLegacyXHTMLMPOrdering
)
2847 UseMockScrollbarSettings mockScrollbarSettings
;
2848 registerMockedHttpURLLoad("viewport/viewport-legacy-xhtmlmp-ordering.html");
2850 FrameTestHelpers::WebViewHelper webViewHelper
;
2851 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-xhtmlmp-ordering.html", true, 0, 0, setViewportSettings
);
2853 Page
* page
= webViewHelper
.webViewImpl()->page();
2854 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2856 EXPECT_EQ(640, constraints
.layoutSize
.width());
2857 EXPECT_EQ(704, constraints
.layoutSize
.height());
2858 EXPECT_NEAR(0.5f
, constraints
.initialScale
, 0.01f
);
2859 EXPECT_NEAR(0.5f
, constraints
.minimumScale
, 0.01f
);
2860 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2861 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2864 TEST_F(ViewportTest
, viewportLegacyXHTMLMPRemoveAndAdd
)
2866 registerMockedHttpURLLoad("viewport/viewport-legacy-xhtmlmp.html");
2868 FrameTestHelpers::WebViewHelper webViewHelper
;
2869 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-legacy-xhtmlmp.html", true, 0, 0, setViewportSettings
);
2871 Page
* page
= webViewHelper
.webViewImpl()->page();
2872 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2874 EXPECT_EQ(320, constraints
.layoutSize
.width());
2875 EXPECT_EQ(352, constraints
.layoutSize
.height());
2876 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2877 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2878 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2879 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2881 executeScript(webViewHelper
.webViewImpl()->mainFrame(),
2882 "originalDoctype = document.doctype;"
2883 "document.removeChild(originalDoctype);");
2885 constraints
= runViewportTest(page
, 320, 352);
2887 EXPECT_EQ(320, constraints
.layoutSize
.width());
2888 EXPECT_EQ(352, constraints
.layoutSize
.height());
2889 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2890 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2891 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2892 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2894 executeScript(webViewHelper
.webViewImpl()->mainFrame(),
2895 "document.insertBefore(originalDoctype, document.firstChild);");
2897 constraints
= runViewportTest(page
, 320, 352);
2899 EXPECT_EQ(320, constraints
.layoutSize
.width());
2900 EXPECT_EQ(352, constraints
.layoutSize
.height());
2901 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2902 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2903 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
2904 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2907 TEST_F(ViewportTest
, viewportLimitsAdjustedForNoUserScale
)
2909 UseMockScrollbarSettings mockScrollbarSettings
;
2910 registerMockedHttpURLLoad("viewport/viewport-limits-adjusted-for-no-user-scale.html");
2912 FrameTestHelpers::WebViewHelper webViewHelper
;
2913 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-limits-adjusted-for-no-user-scale.html", true, 0, 0, setViewportSettings
);
2915 Page
* page
= webViewHelper
.webViewImpl()->page();
2917 EXPECT_FALSE(page
->viewportDescription().userZoom
);
2920 TEST_F(ViewportTest
, viewportLimitsAdjustedForNoUserScaleControl
)
2922 UseMockScrollbarSettings mockScrollbarSettings
;
2923 registerMockedHttpURLLoad("viewport/viewport-limits-adjusted-for-no-user-scale-control.html");
2925 FrameTestHelpers::WebViewHelper webViewHelper
;
2926 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-limits-adjusted-for-no-user-scale-control.html", true, 0, 0, setViewportSettings
);
2928 Page
* page
= webViewHelper
.webViewImpl()->page();
2930 EXPECT_TRUE(page
->viewportDescription().userZoom
);
2933 TEST_F(ViewportTest
, viewportTriggersGpuRasterization
)
2935 UseMockScrollbarSettings mockScrollbarSettings
;
2937 registerMockedHttpURLLoad("viewport/viewport-gpu-rasterization.html");
2938 FrameTestHelpers::WebViewHelper webViewHelper
;
2939 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-gpu-rasterization.html", true, 0, 0, setViewportSettings
);
2940 webViewHelper
.webView()->resize(WebSize(640, 480));
2941 EXPECT_TRUE(webViewHelper
.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
2943 registerMockedHttpURLLoad("viewport/viewport-gpu-rasterization-expanded-heuristics.html");
2944 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-gpu-rasterization-expanded-heuristics.html", true, 0, 0, setViewportSettings
);
2945 webViewHelper
.webView()->resize(WebSize(640, 480));
2946 EXPECT_TRUE(webViewHelper
.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
2948 registerMockedHttpURLLoad("viewport/viewport-inferred-values-do-not-trigger-gpu-rasterization.html");
2949 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-inferred-values-do-not-trigger-gpu-rasterization.html", true, 0, 0, setViewportSettings
);
2950 webViewHelper
.webView()->resize(WebSize(640, 480));
2951 EXPECT_FALSE(webViewHelper
.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
2953 registerMockedHttpURLLoad("viewport/viewport-1.html");
2954 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-1.html", true, 0, 0, setViewportSettings
);
2955 webViewHelper
.webView()->resize(WebSize(640, 480));
2956 EXPECT_FALSE(webViewHelper
.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
2958 registerMockedHttpURLLoad("viewport/viewport-15.html");
2959 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-15.html", true, 0, 0, setViewportSettings
);
2960 webViewHelper
.webView()->resize(WebSize(640, 480));
2961 EXPECT_FALSE(webViewHelper
.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
2963 registerMockedHttpURLLoad("viewport/viewport-130.html");
2964 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-130.html", true, 0, 0, setViewportSettings
);
2965 webViewHelper
.webView()->resize(WebSize(640, 480));
2966 EXPECT_FALSE(webViewHelper
.webViewImpl()->matchesHeuristicsForGpuRasterizationForTesting());
2969 class ConsoleMessageWebFrameClient
: public FrameTestHelpers::TestWebFrameClient
{
2971 virtual void didAddMessageToConsole(const WebConsoleMessage
& msg
, const WebString
& sourceName
, unsigned sourceLine
, const WebString
& stackTrace
)
2973 messages
.push_back(msg
);
2976 std::vector
<WebConsoleMessage
> messages
;
2979 TEST_F(ViewportTest
, viewportWarnings1
)
2981 ConsoleMessageWebFrameClient webFrameClient
;
2983 registerMockedHttpURLLoad("viewport/viewport-warnings-1.html");
2985 FrameTestHelpers::WebViewHelper webViewHelper
;
2986 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-warnings-1.html", true, &webFrameClient
, 0, setViewportSettings
);
2988 Page
* page
= webViewHelper
.webViewImpl()->page();
2989 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
2991 EXPECT_TRUE(webFrameClient
.messages
.empty());
2993 EXPECT_EQ(320, constraints
.layoutSize
.width());
2994 EXPECT_EQ(352, constraints
.layoutSize
.height());
2995 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
2996 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
2997 EXPECT_NEAR(2.0f
, constraints
.maximumScale
, 0.01f
);
2998 EXPECT_TRUE(page
->viewportDescription().userZoom
);
3001 TEST_F(ViewportTest
, viewportWarnings2
)
3003 ConsoleMessageWebFrameClient webFrameClient
;
3005 registerMockedHttpURLLoad("viewport/viewport-warnings-2.html");
3007 FrameTestHelpers::WebViewHelper webViewHelper
;
3008 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-warnings-2.html", true, &webFrameClient
, 0, setViewportSettings
);
3010 Page
* page
= webViewHelper
.webViewImpl()->page();
3011 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
3013 EXPECT_EQ(1U, webFrameClient
.messages
.size());
3014 EXPECT_EQ(WebConsoleMessage::LevelWarning
, webFrameClient
.messages
[0].level
);
3015 EXPECT_STREQ("The key \"wwidth\" is not recognized and ignored.", webFrameClient
.messages
[0].text
.utf8().c_str());
3017 EXPECT_EQ(980, constraints
.layoutSize
.width());
3018 EXPECT_EQ(1078, constraints
.layoutSize
.height());
3019 EXPECT_NEAR(0.33f
, constraints
.initialScale
, 0.01f
);
3020 EXPECT_NEAR(0.33f
, constraints
.minimumScale
, 0.01f
);
3021 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
3022 EXPECT_TRUE(page
->viewportDescription().userZoom
);
3025 TEST_F(ViewportTest
, viewportWarnings3
)
3027 ConsoleMessageWebFrameClient webFrameClient
;
3029 registerMockedHttpURLLoad("viewport/viewport-warnings-3.html");
3031 FrameTestHelpers::WebViewHelper webViewHelper
;
3032 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-warnings-3.html", true, &webFrameClient
, 0, setViewportSettings
);
3034 Page
* page
= webViewHelper
.webViewImpl()->page();
3035 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
3037 EXPECT_EQ(1U, webFrameClient
.messages
.size());
3038 EXPECT_EQ(WebConsoleMessage::LevelWarning
, webFrameClient
.messages
[0].level
);
3039 EXPECT_STREQ("The value \"unrecognized-width\" for key \"width\" is invalid, and has been ignored.",
3040 webFrameClient
.messages
[0].text
.utf8().c_str());
3042 EXPECT_NEAR(64.0f
, constraints
.layoutSize
.width(), 0.01);
3043 EXPECT_NEAR(70.4f
, constraints
.layoutSize
.height(), 0.01);
3044 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
3045 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
3046 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
3047 EXPECT_TRUE(page
->viewportDescription().userZoom
);
3050 TEST_F(ViewportTest
, viewportWarnings4
)
3052 ConsoleMessageWebFrameClient webFrameClient
;
3054 registerMockedHttpURLLoad("viewport/viewport-warnings-4.html");
3056 FrameTestHelpers::WebViewHelper webViewHelper
;
3057 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-warnings-4.html", true, &webFrameClient
, 0, setViewportSettings
);
3059 Page
* page
= webViewHelper
.webViewImpl()->page();
3060 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
3062 EXPECT_EQ(1U, webFrameClient
.messages
.size());
3063 EXPECT_EQ(WebConsoleMessage::LevelWarning
, webFrameClient
.messages
[0].level
);
3064 EXPECT_STREQ("The value \"123x456\" for key \"width\" was truncated to its numeric prefix.",
3065 webFrameClient
.messages
[0].text
.utf8().c_str());
3067 EXPECT_NEAR(123.0f
, constraints
.layoutSize
.width(), 0.01);
3068 EXPECT_NEAR(135.3f
, constraints
.layoutSize
.height(), 0.01);
3069 EXPECT_NEAR(2.60f
, constraints
.initialScale
, 0.01f
);
3070 EXPECT_NEAR(2.60f
, constraints
.minimumScale
, 0.01f
);
3071 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
3072 EXPECT_TRUE(page
->viewportDescription().userZoom
);
3075 TEST_F(ViewportTest
, viewportWarnings5
)
3077 ConsoleMessageWebFrameClient webFrameClient
;
3079 registerMockedHttpURLLoad("viewport/viewport-warnings-5.html");
3081 FrameTestHelpers::WebViewHelper webViewHelper
;
3082 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-warnings-5.html", true, &webFrameClient
, 0, setViewportSettings
);
3084 Page
* page
= webViewHelper
.webViewImpl()->page();
3085 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
3087 EXPECT_EQ(5U, webFrameClient
.messages
.size());
3089 EXPECT_EQ(WebConsoleMessage::LevelWarning
, webFrameClient
.messages
[0].level
);
3090 EXPECT_STREQ("The value \"device-width;\" for key \"width\" is invalid, and has been ignored.",
3091 webFrameClient
.messages
[0].text
.utf8().c_str());
3093 EXPECT_EQ(WebConsoleMessage::LevelWarning
, webFrameClient
.messages
[1].level
);
3094 EXPECT_STREQ("The value \"1.0;\" for key \"initial-scale\" was truncated to its numeric prefix.",
3095 webFrameClient
.messages
[1].text
.utf8().c_str());
3097 EXPECT_EQ(WebConsoleMessage::LevelWarning
, webFrameClient
.messages
[2].level
);
3098 EXPECT_STREQ("The value \"1.0;\" for key \"maximum-scale\" was truncated to its numeric prefix.",
3099 webFrameClient
.messages
[2].text
.utf8().c_str());
3101 EXPECT_EQ(WebConsoleMessage::LevelWarning
, webFrameClient
.messages
[3].level
);
3102 EXPECT_STREQ("The value \"0;\" for key \"user-scalable\" was truncated to its numeric prefix.",
3103 webFrameClient
.messages
[3].text
.utf8().c_str());
3105 EXPECT_EQ(WebConsoleMessage::LevelWarning
, webFrameClient
.messages
[4].level
);
3106 EXPECT_STREQ("Error parsing a meta element's content: ';' is not a valid key-value pair separator. Please use ',' instead.",
3107 webFrameClient
.messages
[4].text
.utf8().c_str());
3109 EXPECT_NEAR(320.0f
, constraints
.layoutSize
.width(), 0.01);
3110 EXPECT_NEAR(352.0f
, constraints
.layoutSize
.height(), 0.01);
3111 EXPECT_NEAR(1.0f
, constraints
.initialScale
, 0.01f
);
3112 EXPECT_NEAR(1.0f
, constraints
.minimumScale
, 0.01f
);
3113 EXPECT_NEAR(1.0f
, constraints
.maximumScale
, 0.01f
);
3114 EXPECT_FALSE(page
->viewportDescription().userZoom
);
3117 TEST_F(ViewportTest
, viewportWarnings6
)
3119 ConsoleMessageWebFrameClient webFrameClient
;
3121 registerMockedHttpURLLoad("viewport/viewport-warnings-6.html");
3123 FrameTestHelpers::WebViewHelper webViewHelper
;
3124 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-warnings-6.html", true, &webFrameClient
, 0, setViewportSettings
);
3126 Page
* page
= webViewHelper
.webViewImpl()->page();
3127 PageScaleConstraints constraints
= runViewportTest(page
, 320, 352);
3129 EXPECT_EQ(1U, webFrameClient
.messages
.size());
3130 EXPECT_EQ(WebConsoleMessage::LevelWarning
, webFrameClient
.messages
[0].level
);
3131 EXPECT_STREQ("The value \"\" for key \"width\" is invalid, and has been ignored.",
3132 webFrameClient
.messages
[0].text
.utf8().c_str());
3134 EXPECT_NEAR(64.0f
, constraints
.layoutSize
.width(), 0.01);
3135 EXPECT_NEAR(70.4f
, constraints
.layoutSize
.height(), 0.01);
3136 EXPECT_NEAR(5.0f
, constraints
.initialScale
, 0.01f
);
3137 EXPECT_NEAR(5.0f
, constraints
.minimumScale
, 0.01f
);
3138 EXPECT_NEAR(5.0f
, constraints
.maximumScale
, 0.01f
);
3139 EXPECT_TRUE(page
->viewportDescription().userZoom
);
3142 TEST_F(ViewportTest
, viewportWarnings7
)
3144 ConsoleMessageWebFrameClient webFrameClient
;
3146 registerMockedHttpURLLoad("viewport/viewport-warnings-7.html");
3148 FrameTestHelpers::WebViewHelper webViewHelper
;
3149 webViewHelper
.initializeAndLoad(m_baseURL
+ "viewport/viewport-warnings-7.html", true, &webFrameClient
, 0, setViewportSettings
);
3151 Page
* page
= webViewHelper
.webViewImpl()->page();
3152 runViewportTest(page
, 320, 352);
3154 EXPECT_EQ(0U, webFrameClient
.messages
.size());
3157 } // namespace blink