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

Side by Side Diff: Source/web/tests/ViewportTest.cpp

Issue 48613005: Moved most viewport layout tests into a unit test (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
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
13 * distribution.
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.
17 *
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.
29 */
30
31 #include "config.h"
32
33 #include "FrameTestHelpers.h"
34 #include "URLTestHelpers.h"
35 #include "WebSettings.h"
36 #include "core/dom/ViewportDescription.h"
37 #include "core/frame/Frame.h"
38 #include "core/frame/FrameView.h"
39 #include "core/page/Page.h"
40 #include "core/page/PageScaleConstraints.h"
41 #include "core/page/Settings.h"
42 #include "core/platform/ScrollbarTheme.h"
43 #include "platform/geometry/IntPoint.h"
44 #include "platform/geometry/IntRect.h"
45 #include "platform/geometry/IntSize.h"
46 #include "public/platform/Platform.h"
47 #include "public/platform/WebUnitTestSupport.h"
48 #include <gmock/gmock.h>
49 #include <gtest/gtest.h>
50
51 using namespace WebKit;
52 using WebCore::Frame;
53 using WebCore::FrameView;
54 using WebCore::IntPoint;
55 using WebCore::IntRect;
56 using WebCore::IntSize;
57 using WebCore::Page;
58 using WebCore::PageScaleConstraints;
59 using WebCore::ViewportDescription;
60 using WebKit::FrameTestHelpers::runPendingTasks;
61
62 namespace {
63
64 class ViewportTest : public testing::Test {
65 protected:
66 ViewportTest()
67 : m_baseURL("http://www.test.com/")
68 , m_chromeURL("chrome://")
69 {
70 }
71
72 virtual ~ViewportTest()
73 {
74 Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
75 }
76
77 void registerMockedHttpURLLoad(const std::string& fileName)
78 {
79 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU RL.c_str()), WebString::fromUTF8(fileName.c_str()));
80 }
81
82 void registerMockedChromeURLLoad(const std::string& fileName)
83 {
84 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_chrom eURL.c_str()), WebString::fromUTF8(fileName.c_str()));
85 }
86
87 std::string m_baseURL;
88 std::string m_chromeURL;
89 };
90
91 class UseMockScrollbarSettings {
92 public:
93 UseMockScrollbarSettings()
94 {
95 WebCore::Settings::setMockScrollbarsEnabled(true);
96 WebCore::RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(true);
97 EXPECT_TRUE(WebCore::ScrollbarTheme::theme()->usesOverlayScrollbars());
98 }
99
100 ~UseMockScrollbarSettings()
101 {
102 WebCore::Settings::setMockScrollbarsEnabled(false);
103 WebCore::RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false);
104 }
105 };
106
107 static void setViewportSettings(WebSettings* settings)
108 {
109 settings->setViewportEnabled(true);
110 }
111
112 static PageScaleConstraints runViewportTest(Page* page, int initialWidth, int in itialHeight)
113 {
114 IntSize initialViewportSize(initialWidth, initialHeight);
115 page->mainFrame()->view()->setFrameRect(IntRect(IntPoint::zero(), initialVie wportSize));
116
117 ViewportDescription description = page->viewportDescription();
118 PageScaleConstraints constraints = description.resolve(initialViewportSize);
119
120 constraints.fitToContentsWidth(constraints.layoutSize.width(), initialWidth) ;
121 return constraints;
122 }
123
124 TEST_F(ViewportTest, viewport1)
125 {
126 UseMockScrollbarSettings mockScrollbarSettings;
127 registerMockedHttpURLLoad("viewport/viewport-1.html");
128
129 FrameTestHelpers::WebViewHelper webViewHelper;
130 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-1.html", true , 0, 0, setViewportSettings);
131
132 Page* page = webViewHelper.webViewImpl()->page();
133 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
134
135 EXPECT_EQ(320, constraints.layoutSize.width());
136 EXPECT_EQ(352, constraints.layoutSize.height());
137 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
138 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
139 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
140 EXPECT_TRUE(page->viewportDescription().userZoom);
141 }
142
143 TEST_F(ViewportTest, viewport2)
144 {
145 UseMockScrollbarSettings mockScrollbarSettings;
146 registerMockedHttpURLLoad("viewport/viewport-2.html");
147
148 FrameTestHelpers::WebViewHelper webViewHelper;
149 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-2.html", true , 0, 0, setViewportSettings);
150
151 Page* page = webViewHelper.webViewImpl()->page();
152 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
153
154 EXPECT_EQ(980, constraints.layoutSize.width());
155 EXPECT_EQ(352, constraints.layoutSize.height());
156 EXPECT_NEAR(0.32f, constraints.initialScale, 0.01f);
157 EXPECT_NEAR(0.32f, constraints.minimumScale, 0.01f);
158 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
159 EXPECT_TRUE(page->viewportDescription().userZoom);
160 }
161
162 TEST_F(ViewportTest, viewport3)
163 {
164 UseMockScrollbarSettings mockScrollbarSettings;
165 registerMockedHttpURLLoad("viewport/viewport-3.html");
166
167 FrameTestHelpers::WebViewHelper webViewHelper;
168 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-3.html", true , 0, 0, setViewportSettings);
169
170 Page* page = webViewHelper.webViewImpl()->page();
171 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
172
173 EXPECT_EQ(320, constraints.layoutSize.width());
174 EXPECT_EQ(352, constraints.layoutSize.height());
175 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
176 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
177 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
178 EXPECT_TRUE(page->viewportDescription().userZoom);
179 }
180
181 TEST_F(ViewportTest, viewport4)
182 {
183 UseMockScrollbarSettings mockScrollbarSettings;
184 registerMockedHttpURLLoad("viewport/viewport-4.html");
185
186 FrameTestHelpers::WebViewHelper webViewHelper;
187 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-4.html", true , 0, 0, setViewportSettings);
188
189 Page* page = webViewHelper.webViewImpl()->page();
190 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
191
192 EXPECT_EQ(160, constraints.layoutSize.width());
193 EXPECT_EQ(176, constraints.layoutSize.height());
194 EXPECT_NEAR(2.0f, constraints.initialScale, 0.01f);
195 EXPECT_NEAR(2.0f, constraints.minimumScale, 0.01f);
196 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
197 EXPECT_TRUE(page->viewportDescription().userZoom);
198 }
199
200 TEST_F(ViewportTest, viewport5)
201 {
202 UseMockScrollbarSettings mockScrollbarSettings;
203 registerMockedHttpURLLoad("viewport/viewport-5.html");
204
205 FrameTestHelpers::WebViewHelper webViewHelper;
206 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-5.html", true , 0, 0, setViewportSettings);
207
208 Page* page = webViewHelper.webViewImpl()->page();
209 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
210
211 EXPECT_EQ(640, constraints.layoutSize.width());
212 EXPECT_EQ(704, constraints.layoutSize.height());
213 EXPECT_NEAR(0.5f, constraints.initialScale, 0.01f);
214 EXPECT_NEAR(0.5f, constraints.minimumScale, 0.01f);
215 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
216 EXPECT_TRUE(page->viewportDescription().userZoom);
217 }
218
219 TEST_F(ViewportTest, viewport6)
220 {
221 UseMockScrollbarSettings mockScrollbarSettings;
222 registerMockedHttpURLLoad("viewport/viewport-6.html");
223
224 FrameTestHelpers::WebViewHelper webViewHelper;
225 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-6.html", true , 0, 0, setViewportSettings);
226
227 Page* page = webViewHelper.webViewImpl()->page();
228 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
229
230 EXPECT_EQ(200, constraints.layoutSize.width());
231 EXPECT_EQ(220, constraints.layoutSize.height());
232 EXPECT_NEAR(1.6f, constraints.initialScale, 0.01f);
233 EXPECT_NEAR(1.6f, constraints.minimumScale, 0.01f);
234 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
235 EXPECT_TRUE(page->viewportDescription().userZoom);
236 }
237
238 TEST_F(ViewportTest, viewport7)
239 {
240 UseMockScrollbarSettings mockScrollbarSettings;
241 registerMockedHttpURLLoad("viewport/viewport-7.html");
242
243 FrameTestHelpers::WebViewHelper webViewHelper;
244 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-7.html", true , 0, 0, setViewportSettings);
245
246 Page* page = webViewHelper.webViewImpl()->page();
247 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
248
249 EXPECT_EQ(1280, constraints.layoutSize.width());
250 EXPECT_EQ(1408, constraints.layoutSize.height());
251 EXPECT_NEAR(0.25f, constraints.initialScale, 0.01f);
252 EXPECT_NEAR(0.25f, constraints.minimumScale, 0.01f);
253 EXPECT_NEAR(0.25f, constraints.maximumScale, 0.01f);
254 EXPECT_TRUE(page->viewportDescription().userZoom);
255 }
256
257 TEST_F(ViewportTest, viewport8)
258 {
259 UseMockScrollbarSettings mockScrollbarSettings;
260 registerMockedHttpURLLoad("viewport/viewport-8.html");
261
262 FrameTestHelpers::WebViewHelper webViewHelper;
263 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-8.html", true , 0, 0, setViewportSettings);
264
265 Page* page = webViewHelper.webViewImpl()->page();
266 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
267
268 EXPECT_EQ(1280, constraints.layoutSize.width());
269 EXPECT_EQ(1408, constraints.layoutSize.height());
270 EXPECT_NEAR(0.25f, constraints.initialScale, 0.01f);
271 EXPECT_NEAR(0.25f, constraints.minimumScale, 0.01f);
272 EXPECT_NEAR(0.25f, constraints.maximumScale, 0.01f);
273 EXPECT_TRUE(page->viewportDescription().userZoom);
274 }
275
276 TEST_F(ViewportTest, viewport9)
277 {
278 UseMockScrollbarSettings mockScrollbarSettings;
279 registerMockedHttpURLLoad("viewport/viewport-9.html");
280
281 FrameTestHelpers::WebViewHelper webViewHelper;
282 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-9.html", true , 0, 0, setViewportSettings);
283
284 Page* page = webViewHelper.webViewImpl()->page();
285 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
286
287 EXPECT_EQ(1280, constraints.layoutSize.width());
288 EXPECT_EQ(1408, constraints.layoutSize.height());
289 EXPECT_NEAR(0.25f, constraints.initialScale, 0.01f);
290 EXPECT_NEAR(0.25f, constraints.minimumScale, 0.01f);
291 EXPECT_NEAR(0.25f, constraints.maximumScale, 0.01f);
292 EXPECT_TRUE(page->viewportDescription().userZoom);
293 }
294
295 TEST_F(ViewportTest, viewport10)
296 {
297 UseMockScrollbarSettings mockScrollbarSettings;
298 registerMockedHttpURLLoad("viewport/viewport-10.html");
299
300 FrameTestHelpers::WebViewHelper webViewHelper;
301 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-10.html", tru e, 0, 0, setViewportSettings);
302
303 Page* page = webViewHelper.webViewImpl()->page();
304 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
305
306 EXPECT_EQ(1280, constraints.layoutSize.width());
307 EXPECT_EQ(1408, constraints.layoutSize.height());
308 EXPECT_NEAR(0.25f, constraints.initialScale, 0.01f);
309 EXPECT_NEAR(0.25f, constraints.minimumScale, 0.01f);
310 EXPECT_NEAR(0.25f, constraints.maximumScale, 0.01f);
311 EXPECT_TRUE(page->viewportDescription().userZoom);
312 }
313
314 TEST_F(ViewportTest, viewport11)
315 {
316 UseMockScrollbarSettings mockScrollbarSettings;
317 registerMockedHttpURLLoad("viewport/viewport-11.html");
318
319 FrameTestHelpers::WebViewHelper webViewHelper;
320 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-11.html", tru e, 0, 0, setViewportSettings);
321
322 Page* page = webViewHelper.webViewImpl()->page();
323 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
324
325 EXPECT_EQ(980, constraints.layoutSize.width());
326 EXPECT_EQ(1078, constraints.layoutSize.height());
327 EXPECT_NEAR(0.32f, constraints.initialScale, 0.01f);
328 EXPECT_NEAR(0.32f, constraints.minimumScale, 0.01f);
329 EXPECT_NEAR(0.5f, constraints.maximumScale, 0.01f);
330 EXPECT_TRUE(page->viewportDescription().userZoom);
331 }
332
333 TEST_F(ViewportTest, viewport12)
334 {
335 UseMockScrollbarSettings mockScrollbarSettings;
336 registerMockedHttpURLLoad("viewport/viewport-12.html");
337
338 FrameTestHelpers::WebViewHelper webViewHelper;
339 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-12.html", tru e, 0, 0, setViewportSettings);
340
341 Page* page = webViewHelper.webViewImpl()->page();
342 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
343
344 EXPECT_EQ(640, constraints.layoutSize.width());
345 EXPECT_EQ(704, constraints.layoutSize.height());
346 EXPECT_NEAR(0.5f, constraints.initialScale, 0.01f);
347 EXPECT_NEAR(0.5f, constraints.minimumScale, 0.01f);
348 EXPECT_NEAR(0.5f, constraints.maximumScale, 0.01f);
349 EXPECT_TRUE(page->viewportDescription().userZoom);
350 }
351
352 TEST_F(ViewportTest, viewport13)
353 {
354 UseMockScrollbarSettings mockScrollbarSettings;
355 registerMockedHttpURLLoad("viewport/viewport-13.html");
356
357 FrameTestHelpers::WebViewHelper webViewHelper;
358 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-13.html", tru e, 0, 0, setViewportSettings);
359
360 Page* page = webViewHelper.webViewImpl()->page();
361 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
362
363 EXPECT_EQ(1280, constraints.layoutSize.width());
364 EXPECT_EQ(1408, constraints.layoutSize.height());
365 EXPECT_NEAR(0.25f, constraints.initialScale, 0.01f);
366 EXPECT_NEAR(0.25f, constraints.minimumScale, 0.01f);
367 EXPECT_NEAR(0.5f, constraints.maximumScale, 0.01f);
368 EXPECT_TRUE(page->viewportDescription().userZoom);
369 }
370
371 TEST_F(ViewportTest, viewport14)
372 {
373 UseMockScrollbarSettings mockScrollbarSettings;
374 registerMockedHttpURLLoad("viewport/viewport-14.html");
375
376 FrameTestHelpers::WebViewHelper webViewHelper;
377 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-14.html", tru e, 0, 0, setViewportSettings);
378
379 Page* page = webViewHelper.webViewImpl()->page();
380 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
381
382 EXPECT_EQ(320, constraints.layoutSize.width());
383 EXPECT_EQ(352, constraints.layoutSize.height());
384 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
385 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
386 EXPECT_NEAR(1.0f, constraints.maximumScale, 0.01f);
387 EXPECT_TRUE(page->viewportDescription().userZoom);
388 }
389
390 TEST_F(ViewportTest, viewport15)
391 {
392 UseMockScrollbarSettings mockScrollbarSettings;
393 registerMockedHttpURLLoad("viewport/viewport-15.html");
394
395 FrameTestHelpers::WebViewHelper webViewHelper;
396 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-15.html", tru e, 0, 0, setViewportSettings);
397
398 Page* page = webViewHelper.webViewImpl()->page();
399 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
400
401 EXPECT_EQ(980, constraints.layoutSize.width());
402 EXPECT_EQ(1078, constraints.layoutSize.height());
403 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
404 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
405 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
406 EXPECT_TRUE(page->viewportDescription().userZoom);
407 }
408
409 TEST_F(ViewportTest, viewport16)
410 {
411 UseMockScrollbarSettings mockScrollbarSettings;
412 registerMockedHttpURLLoad("viewport/viewport-16.html");
413
414 FrameTestHelpers::WebViewHelper webViewHelper;
415 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-16.html", tru e, 0, 0, setViewportSettings);
416
417 Page* page = webViewHelper.webViewImpl()->page();
418 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
419
420 EXPECT_EQ(980, constraints.layoutSize.width());
421 EXPECT_EQ(1078, constraints.layoutSize.height());
422 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
423 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
424 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
425 EXPECT_TRUE(page->viewportDescription().userZoom);
426 }
427
428 TEST_F(ViewportTest, viewport17)
429 {
430 UseMockScrollbarSettings mockScrollbarSettings;
431 registerMockedHttpURLLoad("viewport/viewport-17.html");
432
433 FrameTestHelpers::WebViewHelper webViewHelper;
434 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-17.html", tru e, 0, 0, setViewportSettings);
435
436 Page* page = webViewHelper.webViewImpl()->page();
437 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
438
439 EXPECT_EQ(980, constraints.layoutSize.width());
440 EXPECT_EQ(1078, constraints.layoutSize.height());
441 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
442 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
443 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
444 EXPECT_TRUE(page->viewportDescription().userZoom);
445 }
446
447 TEST_F(ViewportTest, viewport18)
448 {
449 UseMockScrollbarSettings mockScrollbarSettings;
450 registerMockedHttpURLLoad("viewport/viewport-18.html");
451
452 FrameTestHelpers::WebViewHelper webViewHelper;
453 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-18.html", tru e, 0, 0, setViewportSettings);
454
455 Page* page = webViewHelper.webViewImpl()->page();
456 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
457
458 EXPECT_EQ(64, constraints.layoutSize.width());
459 EXPECT_NEAR(70.4, constraints.layoutSize.height(), 0.01f);
460 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
461 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
462 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
463 EXPECT_TRUE(page->viewportDescription().userZoom);
464 }
465
466 TEST_F(ViewportTest, viewport19)
467 {
468 UseMockScrollbarSettings mockScrollbarSettings;
469 registerMockedHttpURLLoad("viewport/viewport-19.html");
470
471 FrameTestHelpers::WebViewHelper webViewHelper;
472 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-19.html", tru e, 0, 0, setViewportSettings);
473
474 Page* page = webViewHelper.webViewImpl()->page();
475 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
476
477 EXPECT_EQ(160, constraints.layoutSize.width());
478 EXPECT_EQ(176, constraints.layoutSize.height());
479 EXPECT_NEAR(2.0f, constraints.initialScale, 0.01f);
480 EXPECT_NEAR(2.0f, constraints.minimumScale, 0.01f);
481 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
482 EXPECT_TRUE(page->viewportDescription().userZoom);
483 }
484
485 TEST_F(ViewportTest, viewport20)
486 {
487 UseMockScrollbarSettings mockScrollbarSettings;
488 registerMockedHttpURLLoad("viewport/viewport-20.html");
489
490 FrameTestHelpers::WebViewHelper webViewHelper;
491 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-20.html", tru e, 0, 0, setViewportSettings);
492
493 Page* page = webViewHelper.webViewImpl()->page();
494 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
495
496 EXPECT_EQ(980, constraints.layoutSize.width());
497 EXPECT_EQ(1078, constraints.layoutSize.height());
498 EXPECT_NEAR(10.0f, constraints.initialScale, 0.01f);
499 EXPECT_NEAR(10.0f, constraints.minimumScale, 0.01f);
500 EXPECT_NEAR(10.0f, constraints.maximumScale, 0.01f);
501 EXPECT_TRUE(page->viewportDescription().userZoom);
502 }
503
504 TEST_F(ViewportTest, viewport21)
505 {
506 UseMockScrollbarSettings mockScrollbarSettings;
507 registerMockedHttpURLLoad("viewport/viewport-21.html");
508
509 FrameTestHelpers::WebViewHelper webViewHelper;
510 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-21.html", tru e, 0, 0, setViewportSettings);
511
512 Page* page = webViewHelper.webViewImpl()->page();
513 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
514
515 EXPECT_EQ(980, constraints.layoutSize.width());
516 EXPECT_EQ(1078, constraints.layoutSize.height());
517 EXPECT_NEAR(10.0f, constraints.initialScale, 0.01f);
518 EXPECT_NEAR(10.0f, constraints.minimumScale, 0.01f);
519 EXPECT_NEAR(10.0f, constraints.maximumScale, 0.01f);
520 EXPECT_TRUE(page->viewportDescription().userZoom);
521 }
522
523 TEST_F(ViewportTest, viewport22)
524 {
525 UseMockScrollbarSettings mockScrollbarSettings;
526 registerMockedHttpURLLoad("viewport/viewport-22.html");
527
528 FrameTestHelpers::WebViewHelper webViewHelper;
529 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-22.html", tru e, 0, 0, setViewportSettings);
530
531 Page* page = webViewHelper.webViewImpl()->page();
532 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
533
534 EXPECT_EQ(980, constraints.layoutSize.width());
535 EXPECT_EQ(1078, constraints.layoutSize.height());
536 EXPECT_NEAR(10.0f, constraints.initialScale, 0.01f);
537 EXPECT_NEAR(10.0f, constraints.minimumScale, 0.01f);
538 EXPECT_NEAR(10.0f, constraints.maximumScale, 0.01f);
539 EXPECT_TRUE(page->viewportDescription().userZoom);
540 }
541
542 TEST_F(ViewportTest, viewport23)
543 {
544 UseMockScrollbarSettings mockScrollbarSettings;
545 registerMockedHttpURLLoad("viewport/viewport-23.html");
546
547 FrameTestHelpers::WebViewHelper webViewHelper;
548 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-23.html", tru e, 0, 0, setViewportSettings);
549
550 Page* page = webViewHelper.webViewImpl()->page();
551 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
552
553 EXPECT_EQ(980, constraints.layoutSize.width());
554 EXPECT_EQ(1078, constraints.layoutSize.height());
555 EXPECT_NEAR(3.0f, constraints.initialScale, 0.01f);
556 EXPECT_NEAR(3.0f, constraints.minimumScale, 0.01f);
557 EXPECT_NEAR(3.0f, constraints.maximumScale, 0.01f);
558 EXPECT_TRUE(page->viewportDescription().userZoom);
559 }
560
561 TEST_F(ViewportTest, viewport24)
562 {
563 UseMockScrollbarSettings mockScrollbarSettings;
564 registerMockedHttpURLLoad("viewport/viewport-24.html");
565
566 FrameTestHelpers::WebViewHelper webViewHelper;
567 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-24.html", tru e, 0, 0, setViewportSettings);
568
569 Page* page = webViewHelper.webViewImpl()->page();
570 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
571
572 EXPECT_EQ(980, constraints.layoutSize.width());
573 EXPECT_EQ(1078, constraints.layoutSize.height());
574 EXPECT_NEAR(4.0f, constraints.initialScale, 0.01f);
575 EXPECT_NEAR(4.0f, constraints.minimumScale, 0.01f);
576 EXPECT_NEAR(4.0f, constraints.maximumScale, 0.01f);
577 EXPECT_TRUE(page->viewportDescription().userZoom);
578 }
579
580 TEST_F(ViewportTest, viewport25)
581 {
582 UseMockScrollbarSettings mockScrollbarSettings;
583 registerMockedHttpURLLoad("viewport/viewport-25.html");
584
585 FrameTestHelpers::WebViewHelper webViewHelper;
586 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-25.html", tru e, 0, 0, setViewportSettings);
587
588 Page* page = webViewHelper.webViewImpl()->page();
589 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
590
591 EXPECT_EQ(980, constraints.layoutSize.width());
592 EXPECT_EQ(1078, constraints.layoutSize.height());
593 EXPECT_NEAR(10.0f, constraints.initialScale, 0.01f);
594 EXPECT_NEAR(10.0f, constraints.minimumScale, 0.01f);
595 EXPECT_NEAR(10.0f, constraints.maximumScale, 0.01f);
596 EXPECT_TRUE(page->viewportDescription().userZoom);
597 }
598
599 TEST_F(ViewportTest, viewport26)
600 {
601 UseMockScrollbarSettings mockScrollbarSettings;
602 registerMockedHttpURLLoad("viewport/viewport-26.html");
603
604 FrameTestHelpers::WebViewHelper webViewHelper;
605 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-26.html", tru e, 0, 0, setViewportSettings);
606
607 Page* page = webViewHelper.webViewImpl()->page();
608 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
609
610 EXPECT_EQ(980, constraints.layoutSize.width());
611 EXPECT_EQ(1078, constraints.layoutSize.height());
612 EXPECT_NEAR(8.0f, constraints.initialScale, 0.01f);
613 EXPECT_NEAR(8.0f, constraints.minimumScale, 0.01f);
614 EXPECT_NEAR(9.0f, constraints.maximumScale, 0.01f);
615 EXPECT_TRUE(page->viewportDescription().userZoom);
616 }
617
618 TEST_F(ViewportTest, viewport27)
619 {
620 UseMockScrollbarSettings mockScrollbarSettings;
621 registerMockedHttpURLLoad("viewport/viewport-27.html");
622
623 FrameTestHelpers::WebViewHelper webViewHelper;
624 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-27.html", tru e, 0, 0, setViewportSettings);
625
626 Page* page = webViewHelper.webViewImpl()->page();
627 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
628
629 EXPECT_EQ(980, constraints.layoutSize.width());
630 EXPECT_EQ(1078, constraints.layoutSize.height());
631 EXPECT_NEAR(0.32f, constraints.initialScale, 0.01f);
632 EXPECT_NEAR(0.32f, constraints.minimumScale, 0.01f);
633 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
634 EXPECT_TRUE(page->viewportDescription().userZoom);
635 }
636
637 TEST_F(ViewportTest, viewport28)
638 {
639 UseMockScrollbarSettings mockScrollbarSettings;
640 registerMockedHttpURLLoad("viewport/viewport-28.html");
641
642 FrameTestHelpers::WebViewHelper webViewHelper;
643 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-28.html", tru e, 0, 0, setViewportSettings);
644
645 Page* page = webViewHelper.webViewImpl()->page();
646 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
647
648 EXPECT_EQ(352, constraints.layoutSize.width());
649 EXPECT_NEAR(387.2, constraints.layoutSize.height(), 0.01);
650 EXPECT_NEAR(0.91f, constraints.initialScale, 0.01f);
651 EXPECT_NEAR(0.91f, constraints.minimumScale, 0.01f);
652 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
653 EXPECT_TRUE(page->viewportDescription().userZoom);
654 }
655
656 TEST_F(ViewportTest, viewport29)
657 {
658 UseMockScrollbarSettings mockScrollbarSettings;
659 registerMockedHttpURLLoad("viewport/viewport-29.html");
660
661 FrameTestHelpers::WebViewHelper webViewHelper;
662 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-29.html", tru e, 0, 0, setViewportSettings);
663
664 Page* page = webViewHelper.webViewImpl()->page();
665 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
666
667 EXPECT_EQ(700, constraints.layoutSize.width());
668 EXPECT_EQ(770, constraints.layoutSize.height());
669 EXPECT_NEAR(0.46f, constraints.initialScale, 0.01f);
670 EXPECT_NEAR(0.46f, constraints.minimumScale, 0.01f);
671 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
672 EXPECT_TRUE(page->viewportDescription().userZoom);
673 }
674
675 TEST_F(ViewportTest, viewport30)
676 {
677 UseMockScrollbarSettings mockScrollbarSettings;
678 registerMockedHttpURLLoad("viewport/viewport-30.html");
679
680 FrameTestHelpers::WebViewHelper webViewHelper;
681 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-30.html", tru e, 0, 0, setViewportSettings);
682
683 Page* page = webViewHelper.webViewImpl()->page();
684 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
685
686 EXPECT_EQ(200, constraints.layoutSize.width());
687 EXPECT_EQ(220, constraints.layoutSize.height());
688 EXPECT_NEAR(1.6f, constraints.initialScale, 0.01f);
689 EXPECT_NEAR(1.6f, constraints.minimumScale, 0.01f);
690 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
691 EXPECT_TRUE(page->viewportDescription().userZoom);
692 }
693
694 TEST_F(ViewportTest, viewport31)
695 {
696 UseMockScrollbarSettings mockScrollbarSettings;
697 registerMockedHttpURLLoad("viewport/viewport-31.html");
698
699 FrameTestHelpers::WebViewHelper webViewHelper;
700 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-31.html", tru e, 0, 0, setViewportSettings);
701
702 Page* page = webViewHelper.webViewImpl()->page();
703 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
704
705 EXPECT_EQ(980, constraints.layoutSize.width());
706 EXPECT_EQ(700, constraints.layoutSize.height());
707 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
708 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
709 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
710 EXPECT_TRUE(page->viewportDescription().userZoom);
711 }
712
713 TEST_F(ViewportTest, viewport32)
714 {
715 UseMockScrollbarSettings mockScrollbarSettings;
716 registerMockedHttpURLLoad("viewport/viewport-32.html");
717
718 FrameTestHelpers::WebViewHelper webViewHelper;
719 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-32.html", tru e, 0, 0, setViewportSettings);
720
721 Page* page = webViewHelper.webViewImpl()->page();
722 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
723
724 EXPECT_EQ(980, constraints.layoutSize.width());
725 EXPECT_EQ(200, constraints.layoutSize.height());
726 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
727 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
728 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
729 EXPECT_TRUE(page->viewportDescription().userZoom);
730 }
731
732 TEST_F(ViewportTest, viewport33)
733 {
734 UseMockScrollbarSettings mockScrollbarSettings;
735 registerMockedHttpURLLoad("viewport/viewport-33.html");
736
737 FrameTestHelpers::WebViewHelper webViewHelper;
738 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-33.html", tru e, 0, 0, setViewportSettings);
739
740 Page* page = webViewHelper.webViewImpl()->page();
741 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
742
743 EXPECT_EQ(320, constraints.layoutSize.width());
744 EXPECT_EQ(352, constraints.layoutSize.height());
745 EXPECT_NEAR(2.0f, constraints.initialScale, 0.01f);
746 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
747 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
748 EXPECT_TRUE(page->viewportDescription().userZoom);
749 }
750
751 TEST_F(ViewportTest, viewport34)
752 {
753 UseMockScrollbarSettings mockScrollbarSettings;
754 registerMockedHttpURLLoad("viewport/viewport-34.html");
755
756 FrameTestHelpers::WebViewHelper webViewHelper;
757 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-34.html", tru e, 0, 0, setViewportSettings);
758
759 Page* page = webViewHelper.webViewImpl()->page();
760 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
761
762 EXPECT_EQ(640, constraints.layoutSize.width());
763 EXPECT_EQ(704, constraints.layoutSize.height());
764 EXPECT_NEAR(0.5f, constraints.initialScale, 0.01f);
765 EXPECT_NEAR(0.5f, constraints.minimumScale, 0.01f);
766 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
767 EXPECT_TRUE(page->viewportDescription().userZoom);
768 }
769
770 TEST_F(ViewportTest, viewport35)
771 {
772 UseMockScrollbarSettings mockScrollbarSettings;
773 registerMockedHttpURLLoad("viewport/viewport-35.html");
774
775 FrameTestHelpers::WebViewHelper webViewHelper;
776 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-35.html", tru e, 0, 0, setViewportSettings);
777
778 Page* page = webViewHelper.webViewImpl()->page();
779 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
780
781 EXPECT_EQ(1280, constraints.layoutSize.width());
782 EXPECT_EQ(1408, constraints.layoutSize.height());
783 EXPECT_NEAR(0.25f, constraints.initialScale, 0.01f);
784 EXPECT_NEAR(0.25f, constraints.minimumScale, 0.01f);
785 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
786 EXPECT_TRUE(page->viewportDescription().userZoom);
787 }
788
789 TEST_F(ViewportTest, viewport36)
790 {
791 UseMockScrollbarSettings mockScrollbarSettings;
792 registerMockedHttpURLLoad("viewport/viewport-36.html");
793
794 FrameTestHelpers::WebViewHelper webViewHelper;
795 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-36.html", tru e, 0, 0, setViewportSettings);
796
797 Page* page = webViewHelper.webViewImpl()->page();
798 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
799
800 EXPECT_NEAR(636.36, constraints.layoutSize.width(), 0.01f);
801 EXPECT_EQ(700, constraints.layoutSize.height());
802 EXPECT_NEAR(1.6f, constraints.initialScale, 0.01f);
803 EXPECT_NEAR(0.50f, constraints.minimumScale, 0.01f);
804 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
805 EXPECT_TRUE(page->viewportDescription().userZoom);
806 }
807
808 TEST_F(ViewportTest, viewport37)
809 {
810 UseMockScrollbarSettings mockScrollbarSettings;
811 registerMockedHttpURLLoad("viewport/viewport-37.html");
812
813 FrameTestHelpers::WebViewHelper webViewHelper;
814 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-37.html", tru e, 0, 0, setViewportSettings);
815
816 Page* page = webViewHelper.webViewImpl()->page();
817 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
818
819 EXPECT_EQ(320, constraints.layoutSize.width());
820 EXPECT_EQ(352, constraints.layoutSize.height());
821 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
822 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
823 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
824 EXPECT_TRUE(page->viewportDescription().userZoom);
825 }
826
827 TEST_F(ViewportTest, viewport38)
828 {
829 UseMockScrollbarSettings mockScrollbarSettings;
830 registerMockedHttpURLLoad("viewport/viewport-38.html");
831
832 FrameTestHelpers::WebViewHelper webViewHelper;
833 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-38.html", tru e, 0, 0, setViewportSettings);
834
835 Page* page = webViewHelper.webViewImpl()->page();
836 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
837
838 EXPECT_EQ(640, constraints.layoutSize.width());
839 EXPECT_EQ(704, constraints.layoutSize.height());
840 EXPECT_NEAR(0.5f, constraints.initialScale, 0.01f);
841 EXPECT_NEAR(0.5f, constraints.minimumScale, 0.01f);
842 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
843 EXPECT_TRUE(page->viewportDescription().userZoom);
844 }
845
846 TEST_F(ViewportTest, viewport39)
847 {
848 UseMockScrollbarSettings mockScrollbarSettings;
849 registerMockedHttpURLLoad("viewport/viewport-39.html");
850
851 FrameTestHelpers::WebViewHelper webViewHelper;
852 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-39.html", tru e, 0, 0, setViewportSettings);
853
854 Page* page = webViewHelper.webViewImpl()->page();
855 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
856
857 EXPECT_EQ(200, constraints.layoutSize.width());
858 EXPECT_EQ(700, constraints.layoutSize.height());
859 EXPECT_NEAR(1.6f, constraints.initialScale, 0.01f);
860 EXPECT_NEAR(1.6f, constraints.minimumScale, 0.01f);
861 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
862 EXPECT_TRUE(page->viewportDescription().userZoom);
863 }
864
865 TEST_F(ViewportTest, viewport40)
866 {
867 UseMockScrollbarSettings mockScrollbarSettings;
868 registerMockedHttpURLLoad("viewport/viewport-40.html");
869
870 FrameTestHelpers::WebViewHelper webViewHelper;
871 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-40.html", tru e, 0, 0, setViewportSettings);
872
873 Page* page = webViewHelper.webViewImpl()->page();
874 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
875
876 EXPECT_EQ(700, constraints.layoutSize.width());
877 EXPECT_EQ(352, constraints.layoutSize.height());
878 EXPECT_NEAR(0.46f, constraints.initialScale, 0.01f);
879 EXPECT_NEAR(0.46f, constraints.minimumScale, 0.01f);
880 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
881 EXPECT_TRUE(page->viewportDescription().userZoom);
882 }
883
884 TEST_F(ViewportTest, viewport41)
885 {
886 UseMockScrollbarSettings mockScrollbarSettings;
887 registerMockedHttpURLLoad("viewport/viewport-41.html");
888
889 FrameTestHelpers::WebViewHelper webViewHelper;
890 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-41.html", tru e, 0, 0, setViewportSettings);
891
892 Page* page = webViewHelper.webViewImpl()->page();
893 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
894
895 EXPECT_EQ(1000, constraints.layoutSize.width());
896 EXPECT_EQ(704, constraints.layoutSize.height());
897 EXPECT_NEAR(0.5f, constraints.initialScale, 0.01f);
898 EXPECT_NEAR(0.32f, constraints.minimumScale, 0.01f);
899 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
900 EXPECT_TRUE(page->viewportDescription().userZoom);
901 }
902
903 TEST_F(ViewportTest, viewport42)
904 {
905 UseMockScrollbarSettings mockScrollbarSettings;
906 registerMockedHttpURLLoad("viewport/viewport-42.html");
907
908 FrameTestHelpers::WebViewHelper webViewHelper;
909 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-42.html", tru e, 0, 0, setViewportSettings);
910
911 Page* page = webViewHelper.webViewImpl()->page();
912 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
913
914 EXPECT_EQ(320, constraints.layoutSize.width());
915 EXPECT_EQ(1000, constraints.layoutSize.height());
916 EXPECT_NEAR(2.0f, constraints.initialScale, 0.01f);
917 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
918 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
919 EXPECT_TRUE(page->viewportDescription().userZoom);
920 }
921
922 TEST_F(ViewportTest, viewport43)
923 {
924 UseMockScrollbarSettings mockScrollbarSettings;
925 registerMockedHttpURLLoad("viewport/viewport-43.html");
926
927 FrameTestHelpers::WebViewHelper webViewHelper;
928 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-43.html", tru e, 0, 0, setViewportSettings);
929
930 Page* page = webViewHelper.webViewImpl()->page();
931 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
932
933 EXPECT_EQ(64, constraints.layoutSize.width());
934 EXPECT_NEAR(70.4, constraints.layoutSize.height(), 0.01f);
935 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
936 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
937 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
938 EXPECT_TRUE(page->viewportDescription().userZoom);
939 }
940
941 TEST_F(ViewportTest, viewport44)
942 {
943 UseMockScrollbarSettings mockScrollbarSettings;
944 registerMockedHttpURLLoad("viewport/viewport-44.html");
945
946 FrameTestHelpers::WebViewHelper webViewHelper;
947 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-44.html", tru e, 0, 0, setViewportSettings);
948
949 Page* page = webViewHelper.webViewImpl()->page();
950 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
951
952 EXPECT_EQ(10000, constraints.layoutSize.width());
953 EXPECT_EQ(10000, constraints.layoutSize.height());
954 EXPECT_NEAR(0.25f, constraints.initialScale, 0.01f);
955 EXPECT_NEAR(0.25f, constraints.minimumScale, 0.01f);
956 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
957 EXPECT_TRUE(page->viewportDescription().userZoom);
958 }
959
960 TEST_F(ViewportTest, viewport45)
961 {
962 UseMockScrollbarSettings mockScrollbarSettings;
963 registerMockedHttpURLLoad("viewport/viewport-45.html");
964
965 FrameTestHelpers::WebViewHelper webViewHelper;
966 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-45.html", tru e, 0, 0, setViewportSettings);
967
968 Page* page = webViewHelper.webViewImpl()->page();
969 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
970
971 EXPECT_EQ(3200, constraints.layoutSize.width());
972 EXPECT_EQ(3520, constraints.layoutSize.height());
973 EXPECT_NEAR(0.1f, constraints.initialScale, 0.01f);
974 EXPECT_NEAR(0.1f, constraints.minimumScale, 0.01f);
975 EXPECT_NEAR(0.1f, constraints.maximumScale, 0.01f);
976 EXPECT_TRUE(page->viewportDescription().userZoom);
977 }
978
979 TEST_F(ViewportTest, viewport46)
980 {
981 UseMockScrollbarSettings mockScrollbarSettings;
982 registerMockedHttpURLLoad("viewport/viewport-46.html");
983
984 FrameTestHelpers::WebViewHelper webViewHelper;
985 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-46.html", tru e, 0, 0, setViewportSettings);
986
987 Page* page = webViewHelper.webViewImpl()->page();
988 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
989
990 EXPECT_EQ(32, constraints.layoutSize.width());
991 EXPECT_NEAR(35.2, constraints.layoutSize.height(), 0.01f);
992 EXPECT_NEAR(10.0f, constraints.initialScale, 0.01f);
993 EXPECT_NEAR(10.0f, constraints.minimumScale, 0.01f);
994 EXPECT_NEAR(10.0f, constraints.maximumScale, 0.01f);
995 EXPECT_TRUE(page->viewportDescription().userZoom);
996 }
997
998 TEST_F(ViewportTest, viewport47)
999 {
1000 UseMockScrollbarSettings mockScrollbarSettings;
1001 registerMockedHttpURLLoad("viewport/viewport-47.html");
1002
1003 FrameTestHelpers::WebViewHelper webViewHelper;
1004 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-47.html", tru e, 0, 0, setViewportSettings);
1005
1006 Page* page = webViewHelper.webViewImpl()->page();
1007 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1008
1009 EXPECT_EQ(320, constraints.layoutSize.width());
1010 EXPECT_EQ(3000, constraints.layoutSize.height());
1011 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
1012 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
1013 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1014 EXPECT_TRUE(page->viewportDescription().userZoom);
1015 }
1016
1017 TEST_F(ViewportTest, viewport48)
1018 {
1019 UseMockScrollbarSettings mockScrollbarSettings;
1020 registerMockedHttpURLLoad("viewport/viewport-48.html");
1021
1022 FrameTestHelpers::WebViewHelper webViewHelper;
1023 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-48.html", tru e, 0, 0, setViewportSettings);
1024
1025 Page* page = webViewHelper.webViewImpl()->page();
1026 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1027
1028 EXPECT_EQ(3000, constraints.layoutSize.width());
1029 EXPECT_EQ(352, constraints.layoutSize.height());
1030 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
1031 EXPECT_NEAR(0.25f, constraints.minimumScale, 0.01f);
1032 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1033 EXPECT_TRUE(page->viewportDescription().userZoom);
1034 }
1035
1036 TEST_F(ViewportTest, viewport49)
1037 {
1038 UseMockScrollbarSettings mockScrollbarSettings;
1039 registerMockedHttpURLLoad("viewport/viewport-49.html");
1040
1041 FrameTestHelpers::WebViewHelper webViewHelper;
1042 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-49.html", tru e, 0, 0, setViewportSettings);
1043
1044 Page* page = webViewHelper.webViewImpl()->page();
1045 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1046
1047 EXPECT_EQ(320, constraints.layoutSize.width());
1048 EXPECT_EQ(352, constraints.layoutSize.height());
1049 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
1050 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
1051 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1052 EXPECT_TRUE(page->viewportDescription().userZoom);
1053 }
1054
1055 TEST_F(ViewportTest, viewport50)
1056 {
1057 UseMockScrollbarSettings mockScrollbarSettings;
1058 registerMockedHttpURLLoad("viewport/viewport-50.html");
1059
1060 FrameTestHelpers::WebViewHelper webViewHelper;
1061 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-50.html", tru e, 0, 0, setViewportSettings);
1062
1063 Page* page = webViewHelper.webViewImpl()->page();
1064 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1065
1066 EXPECT_EQ(980, constraints.layoutSize.width());
1067 EXPECT_EQ(1078, constraints.layoutSize.height());
1068 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
1069 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
1070 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1071 EXPECT_TRUE(page->viewportDescription().userZoom);
1072 }
1073
1074 TEST_F(ViewportTest, viewport51)
1075 {
1076 UseMockScrollbarSettings mockScrollbarSettings;
1077 registerMockedHttpURLLoad("viewport/viewport-51.html");
1078
1079 FrameTestHelpers::WebViewHelper webViewHelper;
1080 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-51.html", tru e, 0, 0, setViewportSettings);
1081
1082 Page* page = webViewHelper.webViewImpl()->page();
1083 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1084
1085 EXPECT_EQ(980, constraints.layoutSize.width());
1086 EXPECT_EQ(1078, constraints.layoutSize.height());
1087 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
1088 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
1089 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1090 EXPECT_TRUE(page->viewportDescription().userZoom);
1091 }
1092
1093 TEST_F(ViewportTest, viewport52)
1094 {
1095 UseMockScrollbarSettings mockScrollbarSettings;
1096 registerMockedHttpURLLoad("viewport/viewport-52.html");
1097
1098 FrameTestHelpers::WebViewHelper webViewHelper;
1099 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-52.html", tru e, 0, 0, setViewportSettings);
1100
1101 Page* page = webViewHelper.webViewImpl()->page();
1102 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1103
1104 EXPECT_EQ(64, constraints.layoutSize.width());
1105 EXPECT_NEAR(70.4, constraints.layoutSize.height(), 0.01f);
1106 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
1107 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
1108 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1109 EXPECT_TRUE(page->viewportDescription().userZoom);
1110 }
1111
1112 TEST_F(ViewportTest, viewport53)
1113 {
1114 UseMockScrollbarSettings mockScrollbarSettings;
1115 registerMockedHttpURLLoad("viewport/viewport-53.html");
1116
1117 FrameTestHelpers::WebViewHelper webViewHelper;
1118 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-53.html", tru e, 0, 0, setViewportSettings);
1119
1120 Page* page = webViewHelper.webViewImpl()->page();
1121 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1122
1123 EXPECT_EQ(980, constraints.layoutSize.width());
1124 EXPECT_NEAR(70.4, constraints.layoutSize.height(), 0.01f);
1125 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
1126 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
1127 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1128 EXPECT_TRUE(page->viewportDescription().userZoom);
1129 }
1130
1131 TEST_F(ViewportTest, viewport54)
1132 {
1133 UseMockScrollbarSettings mockScrollbarSettings;
1134 registerMockedHttpURLLoad("viewport/viewport-54.html");
1135
1136 FrameTestHelpers::WebViewHelper webViewHelper;
1137 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-54.html", tru e, 0, 0, setViewportSettings);
1138
1139 Page* page = webViewHelper.webViewImpl()->page();
1140 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1141
1142 EXPECT_EQ(64, constraints.layoutSize.width());
1143 EXPECT_NEAR(70.4, constraints.layoutSize.height(), 0.01f);
1144 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
1145 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
1146 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1147 EXPECT_TRUE(page->viewportDescription().userZoom);
1148 }
1149
1150 TEST_F(ViewportTest, viewport55)
1151 {
1152 UseMockScrollbarSettings mockScrollbarSettings;
1153 registerMockedHttpURLLoad("viewport/viewport-55.html");
1154
1155 FrameTestHelpers::WebViewHelper webViewHelper;
1156 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-55.html", tru e, 0, 0, setViewportSettings);
1157
1158 Page* page = webViewHelper.webViewImpl()->page();
1159 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1160
1161 EXPECT_EQ(64, constraints.layoutSize.width());
1162 EXPECT_NEAR(70.4, constraints.layoutSize.height(), 0.01f);
1163 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
1164 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
1165 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1166 EXPECT_TRUE(page->viewportDescription().userZoom);
1167 }
1168
1169 TEST_F(ViewportTest, viewport56)
1170 {
1171 UseMockScrollbarSettings mockScrollbarSettings;
1172 registerMockedHttpURLLoad("viewport/viewport-56.html");
1173
1174 FrameTestHelpers::WebViewHelper webViewHelper;
1175 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-56.html", tru e, 0, 0, setViewportSettings);
1176
1177 Page* page = webViewHelper.webViewImpl()->page();
1178 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1179
1180 EXPECT_EQ(980, constraints.layoutSize.width());
1181 EXPECT_EQ(1078, constraints.layoutSize.height());
1182 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
1183 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
1184 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1185 EXPECT_TRUE(page->viewportDescription().userZoom);
1186 }
1187
1188 TEST_F(ViewportTest, viewport57)
1189 {
1190 UseMockScrollbarSettings mockScrollbarSettings;
1191 registerMockedHttpURLLoad("viewport/viewport-57.html");
1192
1193 FrameTestHelpers::WebViewHelper webViewHelper;
1194 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-57.html", tru e, 0, 0, setViewportSettings);
1195
1196 Page* page = webViewHelper.webViewImpl()->page();
1197 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1198
1199 EXPECT_EQ(320, constraints.layoutSize.width());
1200 EXPECT_EQ(352, constraints.layoutSize.height());
1201 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
1202 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
1203 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1204 EXPECT_TRUE(page->viewportDescription().userZoom);
1205 }
1206
1207 TEST_F(ViewportTest, viewport58)
1208 {
1209 UseMockScrollbarSettings mockScrollbarSettings;
1210 registerMockedHttpURLLoad("viewport/viewport-58.html");
1211
1212 FrameTestHelpers::WebViewHelper webViewHelper;
1213 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-58.html", tru e, 0, 0, setViewportSettings);
1214
1215 Page* page = webViewHelper.webViewImpl()->page();
1216 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1217
1218 EXPECT_EQ(3200, constraints.layoutSize.width());
1219 EXPECT_EQ(3520, constraints.layoutSize.height());
1220 EXPECT_NEAR(0.1f, constraints.initialScale, 0.01f);
1221 EXPECT_NEAR(0.1f, constraints.minimumScale, 0.01f);
1222 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1223 EXPECT_TRUE(page->viewportDescription().userZoom);
1224 }
1225
1226 TEST_F(ViewportTest, viewport59)
1227 {
1228 UseMockScrollbarSettings mockScrollbarSettings;
1229 registerMockedHttpURLLoad("viewport/viewport-59.html");
1230
1231 FrameTestHelpers::WebViewHelper webViewHelper;
1232 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-59.html", tru e, 0, 0, setViewportSettings);
1233
1234 Page* page = webViewHelper.webViewImpl()->page();
1235 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1236
1237 EXPECT_EQ(320, constraints.layoutSize.width());
1238 EXPECT_EQ(352, constraints.layoutSize.height());
1239 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
1240 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
1241 EXPECT_NEAR(1.0f, constraints.maximumScale, 0.01f);
1242 EXPECT_TRUE(page->viewportDescription().userZoom);
1243 }
1244
1245 TEST_F(ViewportTest, viewport60)
1246 {
1247 UseMockScrollbarSettings mockScrollbarSettings;
1248 registerMockedHttpURLLoad("viewport/viewport-60.html");
1249
1250 FrameTestHelpers::WebViewHelper webViewHelper;
1251 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-60.html", tru e, 0, 0, setViewportSettings);
1252
1253 Page* page = webViewHelper.webViewImpl()->page();
1254 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1255
1256 EXPECT_EQ(32, constraints.layoutSize.width());
1257 EXPECT_NEAR(35.2, constraints.layoutSize.height(), 0.01f);
1258 EXPECT_NEAR(10.0f, constraints.initialScale, 0.01f);
1259 EXPECT_NEAR(10.0f, constraints.minimumScale, 0.01f);
1260 EXPECT_NEAR(10.0f, constraints.maximumScale, 0.01f);
1261 EXPECT_TRUE(page->viewportDescription().userZoom);
1262 }
1263
1264 TEST_F(ViewportTest, viewport61)
1265 {
1266 UseMockScrollbarSettings mockScrollbarSettings;
1267 registerMockedHttpURLLoad("viewport/viewport-61.html");
1268
1269 FrameTestHelpers::WebViewHelper webViewHelper;
1270 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-61.html", tru e, 0, 0, setViewportSettings);
1271
1272 Page* page = webViewHelper.webViewImpl()->page();
1273 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1274
1275 EXPECT_EQ(320, constraints.layoutSize.width());
1276 EXPECT_EQ(352, constraints.layoutSize.height());
1277 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
1278 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
1279 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1280 EXPECT_TRUE(page->viewportDescription().userZoom);
1281 }
1282
1283 TEST_F(ViewportTest, viewport62)
1284 {
1285 UseMockScrollbarSettings mockScrollbarSettings;
1286 registerMockedHttpURLLoad("viewport/viewport-62.html");
1287
1288 FrameTestHelpers::WebViewHelper webViewHelper;
1289 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-62.html", tru e, 0, 0, setViewportSettings);
1290
1291 Page* page = webViewHelper.webViewImpl()->page();
1292 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1293
1294 EXPECT_EQ(320, constraints.layoutSize.width());
1295 EXPECT_EQ(352, constraints.layoutSize.height());
1296 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
1297 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
1298 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1299 EXPECT_TRUE(page->viewportDescription().userZoom);
1300 }
1301
1302 TEST_F(ViewportTest, viewport63)
1303 {
1304 UseMockScrollbarSettings mockScrollbarSettings;
1305 registerMockedHttpURLLoad("viewport/viewport-63.html");
1306
1307 FrameTestHelpers::WebViewHelper webViewHelper;
1308 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-63.html", tru e, 0, 0, setViewportSettings);
1309
1310 Page* page = webViewHelper.webViewImpl()->page();
1311 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1312
1313 EXPECT_EQ(320, constraints.layoutSize.width());
1314 EXPECT_EQ(352, constraints.layoutSize.height());
1315 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
1316 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
1317 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1318 EXPECT_TRUE(page->viewportDescription().userZoom);
1319 }
1320
1321 TEST_F(ViewportTest, viewport64)
1322 {
1323 UseMockScrollbarSettings mockScrollbarSettings;
1324 registerMockedHttpURLLoad("viewport/viewport-64.html");
1325
1326 FrameTestHelpers::WebViewHelper webViewHelper;
1327 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-64.html", tru e, 0, 0, setViewportSettings);
1328
1329 Page* page = webViewHelper.webViewImpl()->page();
1330 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1331
1332 EXPECT_EQ(320, constraints.layoutSize.width());
1333 EXPECT_EQ(352, constraints.layoutSize.height());
1334 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
1335 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
1336 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1337 EXPECT_TRUE(page->viewportDescription().userZoom);
1338 }
1339
1340 TEST_F(ViewportTest, viewport65)
1341 {
1342 UseMockScrollbarSettings mockScrollbarSettings;
1343 registerMockedHttpURLLoad("viewport/viewport-65.html");
1344
1345 FrameTestHelpers::WebViewHelper webViewHelper;
1346 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-65.html", tru e, 0, 0, setViewportSettings);
1347
1348 Page* page = webViewHelper.webViewImpl()->page();
1349 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1350
1351 EXPECT_EQ(100, constraints.layoutSize.width());
1352 EXPECT_EQ(110, constraints.layoutSize.height());
1353 EXPECT_NEAR(3.2f, constraints.initialScale, 0.01f);
1354 EXPECT_NEAR(3.2f, constraints.minimumScale, 0.01f);
1355 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1356 EXPECT_TRUE(page->viewportDescription().userZoom);
1357 }
1358
1359 TEST_F(ViewportTest, viewport66)
1360 {
1361 UseMockScrollbarSettings mockScrollbarSettings;
1362 registerMockedHttpURLLoad("viewport/viewport-66.html");
1363
1364 FrameTestHelpers::WebViewHelper webViewHelper;
1365 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-66.html", tru e, 0, 0, setViewportSettings);
1366
1367 Page* page = webViewHelper.webViewImpl()->page();
1368 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1369
1370 EXPECT_EQ(100, constraints.layoutSize.width());
1371 EXPECT_EQ(110, constraints.layoutSize.height());
1372 EXPECT_NEAR(3.2f, constraints.initialScale, 0.01f);
1373 EXPECT_NEAR(3.2f, constraints.minimumScale, 0.01f);
1374 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1375 EXPECT_TRUE(page->viewportDescription().userZoom);
1376 }
1377
1378 TEST_F(ViewportTest, viewport67)
1379 {
1380 UseMockScrollbarSettings mockScrollbarSettings;
1381 registerMockedHttpURLLoad("viewport/viewport-67.html");
1382
1383 FrameTestHelpers::WebViewHelper webViewHelper;
1384 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-67.html", tru e, 0, 0, setViewportSettings);
1385
1386 Page* page = webViewHelper.webViewImpl()->page();
1387 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1388
1389 EXPECT_EQ(320, constraints.layoutSize.width());
1390 EXPECT_EQ(352, constraints.layoutSize.height());
1391 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
1392 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
1393 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1394 EXPECT_TRUE(page->viewportDescription().userZoom);
1395 }
1396
1397 TEST_F(ViewportTest, viewport68)
1398 {
1399 UseMockScrollbarSettings mockScrollbarSettings;
1400 registerMockedHttpURLLoad("viewport/viewport-68.html");
1401
1402 FrameTestHelpers::WebViewHelper webViewHelper;
1403 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-68.html", tru e, 0, 0, setViewportSettings);
1404
1405 Page* page = webViewHelper.webViewImpl()->page();
1406 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1407
1408 EXPECT_EQ(320, constraints.layoutSize.width());
1409 EXPECT_EQ(352, constraints.layoutSize.height());
1410 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
1411 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
1412 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1413 EXPECT_TRUE(page->viewportDescription().userZoom);
1414 }
1415
1416 TEST_F(ViewportTest, viewport69)
1417 {
1418 UseMockScrollbarSettings mockScrollbarSettings;
1419 registerMockedHttpURLLoad("viewport/viewport-69.html");
1420
1421 FrameTestHelpers::WebViewHelper webViewHelper;
1422 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-69.html", tru e, 0, 0, setViewportSettings);
1423
1424 Page* page = webViewHelper.webViewImpl()->page();
1425 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1426
1427 EXPECT_EQ(100, constraints.layoutSize.width());
1428 EXPECT_EQ(110, constraints.layoutSize.height());
1429 EXPECT_NEAR(3.2f, constraints.initialScale, 0.01f);
1430 EXPECT_NEAR(3.2f, constraints.minimumScale, 0.01f);
1431 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1432 EXPECT_TRUE(page->viewportDescription().userZoom);
1433 }
1434
1435 TEST_F(ViewportTest, viewport70)
1436 {
1437 UseMockScrollbarSettings mockScrollbarSettings;
1438 registerMockedHttpURLLoad("viewport/viewport-70.html");
1439
1440 FrameTestHelpers::WebViewHelper webViewHelper;
1441 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-70.html", tru e, 0, 0, setViewportSettings);
1442
1443 Page* page = webViewHelper.webViewImpl()->page();
1444 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1445
1446 EXPECT_EQ(100, constraints.layoutSize.width());
1447 EXPECT_EQ(110, constraints.layoutSize.height());
1448 EXPECT_NEAR(3.2f, constraints.initialScale, 0.01f);
1449 EXPECT_NEAR(3.2f, constraints.minimumScale, 0.01f);
1450 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1451 EXPECT_TRUE(page->viewportDescription().userZoom);
1452 }
1453
1454 TEST_F(ViewportTest, viewport71)
1455 {
1456 UseMockScrollbarSettings mockScrollbarSettings;
1457 registerMockedHttpURLLoad("viewport/viewport-71.html");
1458
1459 FrameTestHelpers::WebViewHelper webViewHelper;
1460 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-71.html", tru e, 0, 0, setViewportSettings);
1461
1462 Page* page = webViewHelper.webViewImpl()->page();
1463 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1464
1465 EXPECT_EQ(320, constraints.layoutSize.width());
1466 EXPECT_EQ(352, constraints.layoutSize.height());
1467 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
1468 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
1469 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1470 EXPECT_TRUE(page->viewportDescription().userZoom);
1471 }
1472
1473 TEST_F(ViewportTest, viewport72)
1474 {
1475 UseMockScrollbarSettings mockScrollbarSettings;
1476 registerMockedHttpURLLoad("viewport/viewport-72.html");
1477
1478 FrameTestHelpers::WebViewHelper webViewHelper;
1479 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-72.html", tru e, 0, 0, setViewportSettings);
1480
1481 Page* page = webViewHelper.webViewImpl()->page();
1482 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1483
1484 EXPECT_EQ(100, constraints.layoutSize.width());
1485 EXPECT_EQ(110, constraints.layoutSize.height());
1486 EXPECT_NEAR(3.2f, constraints.initialScale, 0.01f);
1487 EXPECT_NEAR(3.2f, constraints.minimumScale, 0.01f);
1488 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1489 EXPECT_TRUE(page->viewportDescription().userZoom);
1490 }
1491
1492 TEST_F(ViewportTest, viewport73)
1493 {
1494 UseMockScrollbarSettings mockScrollbarSettings;
1495 registerMockedHttpURLLoad("viewport/viewport-73.html");
1496
1497 FrameTestHelpers::WebViewHelper webViewHelper;
1498 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-73.html", tru e, 0, 0, setViewportSettings);
1499
1500 Page* page = webViewHelper.webViewImpl()->page();
1501 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1502
1503 EXPECT_EQ(100, constraints.layoutSize.width());
1504 EXPECT_EQ(110, constraints.layoutSize.height());
1505 EXPECT_NEAR(3.2f, constraints.initialScale, 0.01f);
1506 EXPECT_NEAR(3.2f, constraints.minimumScale, 0.01f);
1507 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1508 EXPECT_TRUE(page->viewportDescription().userZoom);
1509 }
1510
1511 TEST_F(ViewportTest, viewport74)
1512 {
1513 UseMockScrollbarSettings mockScrollbarSettings;
1514 registerMockedHttpURLLoad("viewport/viewport-74.html");
1515
1516 FrameTestHelpers::WebViewHelper webViewHelper;
1517 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-74.html", tru e, 0, 0, setViewportSettings);
1518
1519 Page* page = webViewHelper.webViewImpl()->page();
1520 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1521
1522 EXPECT_EQ(100, constraints.layoutSize.width());
1523 EXPECT_EQ(110, constraints.layoutSize.height());
1524 EXPECT_NEAR(3.2f, constraints.initialScale, 0.01f);
1525 EXPECT_NEAR(3.2f, constraints.minimumScale, 0.01f);
1526 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1527 EXPECT_TRUE(page->viewportDescription().userZoom);
1528 }
1529
1530 TEST_F(ViewportTest, viewport75)
1531 {
1532 UseMockScrollbarSettings mockScrollbarSettings;
1533 registerMockedHttpURLLoad("viewport/viewport-75.html");
1534
1535 FrameTestHelpers::WebViewHelper webViewHelper;
1536 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-75.html", tru e, 0, 0, setViewportSettings);
1537
1538 Page* page = webViewHelper.webViewImpl()->page();
1539 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1540
1541 EXPECT_EQ(64, constraints.layoutSize.width());
1542 EXPECT_NEAR(70.4, constraints.layoutSize.height(), 0.01f);
1543 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
1544 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
1545 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1546 EXPECT_TRUE(page->viewportDescription().userZoom);
1547 }
1548
1549 TEST_F(ViewportTest, viewport76)
1550 {
1551 UseMockScrollbarSettings mockScrollbarSettings;
1552 registerMockedHttpURLLoad("viewport/viewport-76.html");
1553
1554 FrameTestHelpers::WebViewHelper webViewHelper;
1555 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-76.html", tru e, 0, 0, setViewportSettings);
1556
1557 Page* page = webViewHelper.webViewImpl()->page();
1558 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1559
1560 EXPECT_EQ(32, constraints.layoutSize.width());
1561 EXPECT_NEAR(35.2, constraints.layoutSize.height(), 0.01);
1562 EXPECT_NEAR(10.0f, constraints.initialScale, 0.01f);
1563 EXPECT_NEAR(10.0f, constraints.minimumScale, 0.01f);
1564 EXPECT_NEAR(10.0f, constraints.maximumScale, 0.01f);
1565 EXPECT_TRUE(page->viewportDescription().userZoom);
1566 }
1567
1568 TEST_F(ViewportTest, viewport77)
1569 {
1570 UseMockScrollbarSettings mockScrollbarSettings;
1571 registerMockedHttpURLLoad("viewport/viewport-77.html");
1572
1573 FrameTestHelpers::WebViewHelper webViewHelper;
1574 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-77.html", tru e, 0, 0, setViewportSettings);
1575
1576 Page* page = webViewHelper.webViewImpl()->page();
1577 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1578
1579 EXPECT_EQ(1280, constraints.layoutSize.width());
1580 EXPECT_EQ(1408, constraints.layoutSize.height());
1581 EXPECT_NEAR(0.25f, constraints.initialScale, 0.01f);
1582 EXPECT_NEAR(0.25f, constraints.minimumScale, 0.01f);
1583 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1584 EXPECT_TRUE(page->viewportDescription().userZoom);
1585 }
1586
1587 TEST_F(ViewportTest, viewport78)
1588 {
1589 UseMockScrollbarSettings mockScrollbarSettings;
1590 registerMockedHttpURLLoad("viewport/viewport-78.html");
1591
1592 FrameTestHelpers::WebViewHelper webViewHelper;
1593 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-78.html", tru e, 0, 0, setViewportSettings);
1594
1595 Page* page = webViewHelper.webViewImpl()->page();
1596 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1597
1598 EXPECT_EQ(100, constraints.layoutSize.width());
1599 EXPECT_EQ(110, constraints.layoutSize.height());
1600 EXPECT_NEAR(3.2f, constraints.initialScale, 0.01f);
1601 EXPECT_NEAR(3.2f, constraints.minimumScale, 0.01f);
1602 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1603 EXPECT_TRUE(page->viewportDescription().userZoom);
1604 }
1605
1606 TEST_F(ViewportTest, viewport79)
1607 {
1608 UseMockScrollbarSettings mockScrollbarSettings;
1609 registerMockedHttpURLLoad("viewport/viewport-79.html");
1610
1611 FrameTestHelpers::WebViewHelper webViewHelper;
1612 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-79.html", tru e, 0, 0, setViewportSettings);
1613
1614 Page* page = webViewHelper.webViewImpl()->page();
1615 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1616
1617 EXPECT_EQ(320, constraints.layoutSize.width());
1618 EXPECT_EQ(352, constraints.layoutSize.height());
1619 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
1620 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
1621 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1622 EXPECT_TRUE(page->viewportDescription().userZoom);
1623 }
1624
1625 TEST_F(ViewportTest, viewport80)
1626 {
1627 UseMockScrollbarSettings mockScrollbarSettings;
1628 registerMockedHttpURLLoad("viewport/viewport-80.html");
1629
1630 FrameTestHelpers::WebViewHelper webViewHelper;
1631 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-80.html", tru e, 0, 0, setViewportSettings);
1632
1633 Page* page = webViewHelper.webViewImpl()->page();
1634 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1635
1636 EXPECT_EQ(320, constraints.layoutSize.width());
1637 EXPECT_EQ(352, constraints.layoutSize.height());
1638 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
1639 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
1640 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1641 EXPECT_TRUE(page->viewportDescription().userZoom);
1642 }
1643
1644 TEST_F(ViewportTest, viewport81)
1645 {
1646 UseMockScrollbarSettings mockScrollbarSettings;
1647 registerMockedHttpURLLoad("viewport/viewport-81.html");
1648
1649 FrameTestHelpers::WebViewHelper webViewHelper;
1650 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-81.html", tru e, 0, 0, setViewportSettings);
1651
1652 Page* page = webViewHelper.webViewImpl()->page();
1653 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1654
1655 EXPECT_EQ(3000, constraints.layoutSize.width());
1656 EXPECT_EQ(3300, constraints.layoutSize.height());
1657 EXPECT_NEAR(0.25f, constraints.initialScale, 0.01f);
1658 EXPECT_NEAR(0.25f, constraints.minimumScale, 0.01f);
1659 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1660 EXPECT_TRUE(page->viewportDescription().userZoom);
1661 }
1662
1663 TEST_F(ViewportTest, viewport82)
1664 {
1665 UseMockScrollbarSettings mockScrollbarSettings;
1666 registerMockedHttpURLLoad("viewport/viewport-82.html");
1667
1668 FrameTestHelpers::WebViewHelper webViewHelper;
1669 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-82.html", tru e, 0, 0, setViewportSettings);
1670
1671 Page* page = webViewHelper.webViewImpl()->page();
1672 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1673
1674 EXPECT_EQ(400, constraints.layoutSize.width());
1675 EXPECT_EQ(440, constraints.layoutSize.height());
1676 EXPECT_NEAR(0.8f, constraints.initialScale, 0.01f);
1677 EXPECT_NEAR(0.8f, constraints.minimumScale, 0.01f);
1678 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1679 EXPECT_TRUE(page->viewportDescription().userZoom);
1680 }
1681
1682 TEST_F(ViewportTest, viewport83)
1683 {
1684 UseMockScrollbarSettings mockScrollbarSettings;
1685 registerMockedHttpURLLoad("viewport/viewport-83.html");
1686
1687 FrameTestHelpers::WebViewHelper webViewHelper;
1688 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-83.html", tru e, 0, 0, setViewportSettings);
1689
1690 Page* page = webViewHelper.webViewImpl()->page();
1691 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1692
1693 EXPECT_EQ(64, constraints.layoutSize.width());
1694 EXPECT_NEAR(70.4, constraints.layoutSize.height(), 0.01f);
1695 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
1696 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
1697 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1698 EXPECT_TRUE(page->viewportDescription().userZoom);
1699 }
1700
1701 TEST_F(ViewportTest, viewport84)
1702 {
1703 UseMockScrollbarSettings mockScrollbarSettings;
1704 registerMockedHttpURLLoad("viewport/viewport-84.html");
1705
1706 FrameTestHelpers::WebViewHelper webViewHelper;
1707 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-84.html", tru e, 0, 0, setViewportSettings);
1708
1709 Page* page = webViewHelper.webViewImpl()->page();
1710 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1711
1712 EXPECT_EQ(64, constraints.layoutSize.width());
1713 EXPECT_EQ(480, constraints.layoutSize.height());
1714 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
1715 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
1716 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1717 EXPECT_TRUE(page->viewportDescription().userZoom);
1718 }
1719
1720 TEST_F(ViewportTest, viewport85)
1721 {
1722 UseMockScrollbarSettings mockScrollbarSettings;
1723 registerMockedHttpURLLoad("viewport/viewport-85.html");
1724
1725 FrameTestHelpers::WebViewHelper webViewHelper;
1726 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-85.html", tru e, 0, 0, setViewportSettings);
1727
1728 Page* page = webViewHelper.webViewImpl()->page();
1729 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1730
1731 EXPECT_EQ(540, constraints.layoutSize.width());
1732 EXPECT_EQ(594, constraints.layoutSize.height());
1733 EXPECT_NEAR(0.59f, constraints.initialScale, 0.01f);
1734 EXPECT_NEAR(0.59f, constraints.minimumScale, 0.01f);
1735 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1736 EXPECT_TRUE(page->viewportDescription().userZoom);
1737 }
1738
1739 TEST_F(ViewportTest, viewport86)
1740 {
1741 UseMockScrollbarSettings mockScrollbarSettings;
1742 registerMockedHttpURLLoad("viewport/viewport-86.html");
1743
1744 FrameTestHelpers::WebViewHelper webViewHelper;
1745 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-86.html", tru e, 0, 0, setViewportSettings);
1746
1747 Page* page = webViewHelper.webViewImpl()->page();
1748 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1749
1750 EXPECT_NEAR(457.14, constraints.layoutSize.width(), 0.01f);
1751 EXPECT_NEAR(502.86, constraints.layoutSize.height(), 0.01f);
1752 EXPECT_NEAR(0.7f, constraints.initialScale, 0.01f);
1753 EXPECT_NEAR(0.7f, constraints.minimumScale, 0.01f);
1754 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1755 EXPECT_TRUE(page->viewportDescription().userZoom);
1756 }
1757
1758 TEST_F(ViewportTest, viewport87)
1759 {
1760 UseMockScrollbarSettings mockScrollbarSettings;
1761 registerMockedHttpURLLoad("viewport/viewport-87.html");
1762
1763 FrameTestHelpers::WebViewHelper webViewHelper;
1764 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-87.html", tru e, 0, 0, setViewportSettings);
1765
1766 Page* page = webViewHelper.webViewImpl()->page();
1767 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1768
1769 EXPECT_EQ(64, constraints.layoutSize.width());
1770 EXPECT_NEAR(70.4, constraints.layoutSize.height(), 0.01f);
1771 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
1772 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
1773 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1774 EXPECT_TRUE(page->viewportDescription().userZoom);
1775 }
1776
1777 TEST_F(ViewportTest, viewport88)
1778 {
1779 UseMockScrollbarSettings mockScrollbarSettings;
1780 registerMockedHttpURLLoad("viewport/viewport-88.html");
1781
1782 FrameTestHelpers::WebViewHelper webViewHelper;
1783 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-88.html", tru e, 0, 0, setViewportSettings);
1784
1785 Page* page = webViewHelper.webViewImpl()->page();
1786 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1787
1788 EXPECT_EQ(980, constraints.layoutSize.width());
1789 EXPECT_EQ(1078, constraints.layoutSize.height());
1790 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
1791 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
1792 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1793 EXPECT_TRUE(page->viewportDescription().userZoom);
1794 }
1795
1796 TEST_F(ViewportTest, viewport90)
1797 {
1798 UseMockScrollbarSettings mockScrollbarSettings;
1799 registerMockedHttpURLLoad("viewport/viewport-90.html");
1800
1801 FrameTestHelpers::WebViewHelper webViewHelper;
1802 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-90.html", tru e, 0, 0, setViewportSettings);
1803
1804 Page* page = webViewHelper.webViewImpl()->page();
1805 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1806
1807 EXPECT_EQ(700, constraints.layoutSize.width());
1808 EXPECT_EQ(770, constraints.layoutSize.height());
1809 EXPECT_NEAR(0.5f, constraints.initialScale, 0.01f);
1810 EXPECT_NEAR(0.46f, constraints.minimumScale, 0.01f);
1811 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1812 EXPECT_TRUE(page->viewportDescription().userZoom);
1813 }
1814
1815 TEST_F(ViewportTest, viewport100)
1816 {
1817 UseMockScrollbarSettings mockScrollbarSettings;
1818 registerMockedHttpURLLoad("viewport/viewport-100.html");
1819
1820 FrameTestHelpers::WebViewHelper webViewHelper;
1821 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-100.html", tr ue, 0, 0, setViewportSettings);
1822
1823 Page* page = webViewHelper.webViewImpl()->page();
1824 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1825
1826 EXPECT_EQ(400, constraints.layoutSize.width());
1827 EXPECT_EQ(440, constraints.layoutSize.height());
1828 EXPECT_NEAR(0.8f, constraints.initialScale, 0.01f);
1829 EXPECT_NEAR(0.8f, constraints.minimumScale, 0.01f);
1830 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1831 EXPECT_TRUE(page->viewportDescription().userZoom);
1832 }
1833
1834 TEST_F(ViewportTest, viewport101)
1835 {
1836 UseMockScrollbarSettings mockScrollbarSettings;
1837 registerMockedHttpURLLoad("viewport/viewport-101.html");
1838
1839 FrameTestHelpers::WebViewHelper webViewHelper;
1840 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-101.html", tr ue, 0, 0, setViewportSettings);
1841
1842 Page* page = webViewHelper.webViewImpl()->page();
1843 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1844
1845 EXPECT_EQ(400, constraints.layoutSize.width());
1846 EXPECT_EQ(440, constraints.layoutSize.height());
1847 EXPECT_NEAR(0.8f, constraints.initialScale, 0.01f);
1848 EXPECT_NEAR(0.8f, constraints.minimumScale, 0.01f);
1849 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1850 EXPECT_TRUE(page->viewportDescription().userZoom);
1851 }
1852
1853 TEST_F(ViewportTest, viewport102)
1854 {
1855 UseMockScrollbarSettings mockScrollbarSettings;
1856 registerMockedHttpURLLoad("viewport/viewport-102.html");
1857
1858 FrameTestHelpers::WebViewHelper webViewHelper;
1859 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-102.html", tr ue, 0, 0, setViewportSettings);
1860
1861 Page* page = webViewHelper.webViewImpl()->page();
1862 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1863
1864 EXPECT_EQ(400, constraints.layoutSize.width());
1865 EXPECT_EQ(440, constraints.layoutSize.height());
1866 EXPECT_NEAR(0.8f, constraints.initialScale, 0.01f);
1867 EXPECT_NEAR(0.8f, constraints.minimumScale, 0.01f);
1868 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1869 EXPECT_TRUE(page->viewportDescription().userZoom);
1870 }
1871
1872 TEST_F(ViewportTest, viewport103)
1873 {
1874 UseMockScrollbarSettings mockScrollbarSettings;
1875 registerMockedHttpURLLoad("viewport/viewport-103.html");
1876
1877 FrameTestHelpers::WebViewHelper webViewHelper;
1878 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-103.html", tr ue, 0, 0, setViewportSettings);
1879
1880 Page* page = webViewHelper.webViewImpl()->page();
1881 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1882
1883 EXPECT_EQ(400, constraints.layoutSize.width());
1884 EXPECT_EQ(440, constraints.layoutSize.height());
1885 EXPECT_NEAR(0.8f, constraints.initialScale, 0.01f);
1886 EXPECT_NEAR(0.8f, constraints.minimumScale, 0.01f);
1887 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1888 EXPECT_TRUE(page->viewportDescription().userZoom);
1889 }
1890
1891 TEST_F(ViewportTest, viewport104)
1892 {
1893 UseMockScrollbarSettings mockScrollbarSettings;
1894 registerMockedHttpURLLoad("viewport/viewport-104.html");
1895
1896 FrameTestHelpers::WebViewHelper webViewHelper;
1897 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-104.html", tr ue, 0, 0, setViewportSettings);
1898
1899 Page* page = webViewHelper.webViewImpl()->page();
1900 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1901
1902 EXPECT_EQ(980, constraints.layoutSize.width());
1903 EXPECT_EQ(1078, constraints.layoutSize.height());
1904 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
1905 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
1906 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1907 EXPECT_TRUE(page->viewportDescription().userZoom);
1908 }
1909
1910 TEST_F(ViewportTest, viewport105)
1911 {
1912 UseMockScrollbarSettings mockScrollbarSettings;
1913 registerMockedHttpURLLoad("viewport/viewport-105.html");
1914
1915 FrameTestHelpers::WebViewHelper webViewHelper;
1916 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-105.html", tr ue, 0, 0, setViewportSettings);
1917
1918 Page* page = webViewHelper.webViewImpl()->page();
1919 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1920
1921 EXPECT_EQ(980, constraints.layoutSize.width());
1922 EXPECT_EQ(1078, constraints.layoutSize.height());
1923 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
1924 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
1925 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1926 EXPECT_TRUE(page->viewportDescription().userZoom);
1927 }
1928
1929 TEST_F(ViewportTest, viewport106)
1930 {
1931 UseMockScrollbarSettings mockScrollbarSettings;
1932 registerMockedHttpURLLoad("viewport/viewport-106.html");
1933
1934 FrameTestHelpers::WebViewHelper webViewHelper;
1935 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-106.html", tr ue, 0, 0, setViewportSettings);
1936
1937 Page* page = webViewHelper.webViewImpl()->page();
1938 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1939
1940 EXPECT_EQ(980, constraints.layoutSize.width());
1941 EXPECT_EQ(1078, constraints.layoutSize.height());
1942 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
1943 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
1944 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1945 EXPECT_TRUE(page->viewportDescription().userZoom);
1946 }
1947
1948 TEST_F(ViewportTest, viewport107)
1949 {
1950 UseMockScrollbarSettings mockScrollbarSettings;
1951 registerMockedHttpURLLoad("viewport/viewport-107.html");
1952
1953 FrameTestHelpers::WebViewHelper webViewHelper;
1954 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-107.html", tr ue, 0, 0, setViewportSettings);
1955
1956 Page* page = webViewHelper.webViewImpl()->page();
1957 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1958
1959 EXPECT_EQ(980, constraints.layoutSize.width());
1960 EXPECT_EQ(1078, constraints.layoutSize.height());
1961 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
1962 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
1963 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1964 EXPECT_TRUE(page->viewportDescription().userZoom);
1965 }
1966
1967 TEST_F(ViewportTest, viewport108)
1968 {
1969 UseMockScrollbarSettings mockScrollbarSettings;
1970 registerMockedHttpURLLoad("viewport/viewport-108.html");
1971
1972 FrameTestHelpers::WebViewHelper webViewHelper;
1973 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-108.html", tr ue, 0, 0, setViewportSettings);
1974
1975 Page* page = webViewHelper.webViewImpl()->page();
1976 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1977
1978 EXPECT_EQ(980, constraints.layoutSize.width());
1979 EXPECT_EQ(1078, constraints.layoutSize.height());
1980 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
1981 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
1982 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
1983 EXPECT_TRUE(page->viewportDescription().userZoom);
1984 }
1985
1986 TEST_F(ViewportTest, viewport109)
1987 {
1988 UseMockScrollbarSettings mockScrollbarSettings;
1989 registerMockedHttpURLLoad("viewport/viewport-109.html");
1990
1991 FrameTestHelpers::WebViewHelper webViewHelper;
1992 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-109.html", tr ue, 0, 0, setViewportSettings);
1993
1994 Page* page = webViewHelper.webViewImpl()->page();
1995 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
1996
1997 EXPECT_EQ(980, constraints.layoutSize.width());
1998 EXPECT_EQ(1078, constraints.layoutSize.height());
1999 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
2000 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
2001 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2002 EXPECT_TRUE(page->viewportDescription().userZoom);
2003 }
2004
2005 TEST_F(ViewportTest, viewport110)
2006 {
2007 UseMockScrollbarSettings mockScrollbarSettings;
2008 registerMockedHttpURLLoad("viewport/viewport-110.html");
2009
2010 FrameTestHelpers::WebViewHelper webViewHelper;
2011 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-110.html", tr ue, 0, 0, setViewportSettings);
2012
2013 Page* page = webViewHelper.webViewImpl()->page();
2014 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2015
2016 EXPECT_EQ(980, constraints.layoutSize.width());
2017 EXPECT_EQ(1078, constraints.layoutSize.height());
2018 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
2019 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
2020 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2021 EXPECT_TRUE(page->viewportDescription().userZoom);
2022 }
2023
2024 TEST_F(ViewportTest, viewport111)
2025 {
2026 UseMockScrollbarSettings mockScrollbarSettings;
2027 registerMockedHttpURLLoad("viewport/viewport-111.html");
2028
2029 FrameTestHelpers::WebViewHelper webViewHelper;
2030 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-111.html", tr ue, 0, 0, setViewportSettings);
2031
2032 Page* page = webViewHelper.webViewImpl()->page();
2033 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2034
2035 EXPECT_EQ(980, constraints.layoutSize.width());
2036 EXPECT_EQ(1078, constraints.layoutSize.height());
2037 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
2038 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
2039 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2040 EXPECT_TRUE(page->viewportDescription().userZoom);
2041 }
2042
2043 TEST_F(ViewportTest, viewport112)
2044 {
2045 UseMockScrollbarSettings mockScrollbarSettings;
2046 registerMockedHttpURLLoad("viewport/viewport-112.html");
2047
2048 FrameTestHelpers::WebViewHelper webViewHelper;
2049 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-112.html", tr ue, 0, 0, setViewportSettings);
2050
2051 Page* page = webViewHelper.webViewImpl()->page();
2052 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2053
2054 EXPECT_EQ(400, constraints.layoutSize.width());
2055 EXPECT_EQ(440, constraints.layoutSize.height());
2056 EXPECT_NEAR(0.8f, constraints.initialScale, 0.01f);
2057 EXPECT_NEAR(0.8f, constraints.minimumScale, 0.01f);
2058 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2059 EXPECT_TRUE(page->viewportDescription().userZoom);
2060 }
2061
2062 TEST_F(ViewportTest, viewport113)
2063 {
2064 UseMockScrollbarSettings mockScrollbarSettings;
2065 registerMockedHttpURLLoad("viewport/viewport-113.html");
2066
2067 FrameTestHelpers::WebViewHelper webViewHelper;
2068 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-113.html", tr ue, 0, 0, setViewportSettings);
2069
2070 Page* page = webViewHelper.webViewImpl()->page();
2071 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2072
2073 EXPECT_EQ(980, constraints.layoutSize.width());
2074 EXPECT_EQ(1078, constraints.layoutSize.height());
2075 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
2076 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
2077 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2078 EXPECT_TRUE(page->viewportDescription().userZoom);
2079 }
2080
2081 TEST_F(ViewportTest, viewport114)
2082 {
2083 UseMockScrollbarSettings mockScrollbarSettings;
2084 registerMockedHttpURLLoad("viewport/viewport-114.html");
2085
2086 FrameTestHelpers::WebViewHelper webViewHelper;
2087 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-114.html", tr ue, 0, 0, setViewportSettings);
2088
2089 Page* page = webViewHelper.webViewImpl()->page();
2090 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2091
2092 EXPECT_EQ(980, constraints.layoutSize.width());
2093 EXPECT_EQ(1078, constraints.layoutSize.height());
2094 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
2095 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
2096 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2097 EXPECT_TRUE(page->viewportDescription().userZoom);
2098 }
2099
2100 TEST_F(ViewportTest, viewport115)
2101 {
2102 UseMockScrollbarSettings mockScrollbarSettings;
2103 registerMockedHttpURLLoad("viewport/viewport-115.html");
2104
2105 FrameTestHelpers::WebViewHelper webViewHelper;
2106 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-115.html", tr ue, 0, 0, setViewportSettings);
2107
2108 Page* page = webViewHelper.webViewImpl()->page();
2109 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2110
2111 EXPECT_EQ(400, constraints.layoutSize.width());
2112 EXPECT_EQ(440, constraints.layoutSize.height());
2113 EXPECT_NEAR(0.8f, constraints.initialScale, 0.01f);
2114 EXPECT_NEAR(0.8f, constraints.minimumScale, 0.01f);
2115 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2116 EXPECT_TRUE(page->viewportDescription().userZoom);
2117 }
2118
2119 TEST_F(ViewportTest, viewport116)
2120 {
2121 UseMockScrollbarSettings mockScrollbarSettings;
2122 registerMockedHttpURLLoad("viewport/viewport-116.html");
2123
2124 FrameTestHelpers::WebViewHelper webViewHelper;
2125 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-116.html", tr ue, 0, 0, setViewportSettings);
2126
2127 Page* page = webViewHelper.webViewImpl()->page();
2128 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2129
2130 EXPECT_EQ(400, constraints.layoutSize.width());
2131 EXPECT_EQ(440, constraints.layoutSize.height());
2132 EXPECT_NEAR(0.8f, constraints.initialScale, 0.01f);
2133 EXPECT_NEAR(0.8f, constraints.minimumScale, 0.01f);
2134 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2135 EXPECT_TRUE(page->viewportDescription().userZoom);
2136 }
2137
2138 TEST_F(ViewportTest, viewport117)
2139 {
2140 UseMockScrollbarSettings mockScrollbarSettings;
2141 registerMockedHttpURLLoad("viewport/viewport-117.html");
2142
2143 FrameTestHelpers::WebViewHelper webViewHelper;
2144 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-117.html", tr ue, 0, 0, setViewportSettings);
2145
2146 Page* page = webViewHelper.webViewImpl()->page();
2147 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2148
2149 EXPECT_EQ(980, constraints.layoutSize.width());
2150 EXPECT_EQ(400, constraints.layoutSize.height());
2151 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
2152 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
2153 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2154 EXPECT_TRUE(page->viewportDescription().userZoom);
2155 }
2156
2157 TEST_F(ViewportTest, viewport118)
2158 {
2159 UseMockScrollbarSettings mockScrollbarSettings;
2160 registerMockedHttpURLLoad("viewport/viewport-118.html");
2161
2162 FrameTestHelpers::WebViewHelper webViewHelper;
2163 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-118.html", tr ue, 0, 0, setViewportSettings);
2164
2165 Page* page = webViewHelper.webViewImpl()->page();
2166 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2167
2168 EXPECT_EQ(320, constraints.layoutSize.width());
2169 EXPECT_EQ(352, constraints.layoutSize.height());
2170 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2171 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2172 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2173 EXPECT_TRUE(page->viewportDescription().userZoom);
2174 }
2175
2176 TEST_F(ViewportTest, viewport119)
2177 {
2178 UseMockScrollbarSettings mockScrollbarSettings;
2179 registerMockedHttpURLLoad("viewport/viewport-119.html");
2180
2181 FrameTestHelpers::WebViewHelper webViewHelper;
2182 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-119.html", tr ue, 0, 0, setViewportSettings);
2183
2184 Page* page = webViewHelper.webViewImpl()->page();
2185 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2186
2187 EXPECT_EQ(320, constraints.layoutSize.width());
2188 EXPECT_EQ(352, constraints.layoutSize.height());
2189 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2190 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2191 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2192 EXPECT_TRUE(page->viewportDescription().userZoom);
2193 }
2194
2195 TEST_F(ViewportTest, viewport120)
2196 {
2197 UseMockScrollbarSettings mockScrollbarSettings;
2198 registerMockedHttpURLLoad("viewport/viewport-120.html");
2199
2200 FrameTestHelpers::WebViewHelper webViewHelper;
2201 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-120.html", tr ue, 0, 0, setViewportSettings);
2202
2203 Page* page = webViewHelper.webViewImpl()->page();
2204 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2205
2206 EXPECT_EQ(320, constraints.layoutSize.width());
2207 EXPECT_EQ(352, constraints.layoutSize.height());
2208 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2209 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2210 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2211 EXPECT_TRUE(page->viewportDescription().userZoom);
2212 }
2213
2214 TEST_F(ViewportTest, viewport121)
2215 {
2216 UseMockScrollbarSettings mockScrollbarSettings;
2217 registerMockedHttpURLLoad("viewport/viewport-121.html");
2218
2219 FrameTestHelpers::WebViewHelper webViewHelper;
2220 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-121.html", tr ue, 0, 0, setViewportSettings);
2221
2222 Page* page = webViewHelper.webViewImpl()->page();
2223 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2224
2225 EXPECT_EQ(64, constraints.layoutSize.width());
2226 EXPECT_NEAR(70.4, constraints.layoutSize.height(), 0.01f);
2227 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
2228 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
2229 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2230 EXPECT_TRUE(page->viewportDescription().userZoom);
2231 }
2232
2233 TEST_F(ViewportTest, viewport122)
2234 {
2235 UseMockScrollbarSettings mockScrollbarSettings;
2236 registerMockedHttpURLLoad("viewport/viewport-122.html");
2237
2238 FrameTestHelpers::WebViewHelper webViewHelper;
2239 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-122.html", tr ue, 0, 0, setViewportSettings);
2240
2241 Page* page = webViewHelper.webViewImpl()->page();
2242 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2243
2244 EXPECT_EQ(64, constraints.layoutSize.width());
2245 EXPECT_NEAR(70.4, constraints.layoutSize.height(), 0.01f);
2246 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
2247 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
2248 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2249 EXPECT_TRUE(page->viewportDescription().userZoom);
2250 }
2251
2252 TEST_F(ViewportTest, viewport123)
2253 {
2254 UseMockScrollbarSettings mockScrollbarSettings;
2255 registerMockedHttpURLLoad("viewport/viewport-123.html");
2256
2257 FrameTestHelpers::WebViewHelper webViewHelper;
2258 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-123.html", tr ue, 0, 0, setViewportSettings);
2259
2260 Page* page = webViewHelper.webViewImpl()->page();
2261 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2262
2263 EXPECT_EQ(320, constraints.layoutSize.width());
2264 EXPECT_EQ(352, constraints.layoutSize.height());
2265 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2266 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2267 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2268 EXPECT_TRUE(page->viewportDescription().userZoom);
2269 }
2270
2271 TEST_F(ViewportTest, viewport124)
2272 {
2273 UseMockScrollbarSettings mockScrollbarSettings;
2274 registerMockedHttpURLLoad("viewport/viewport-124.html");
2275
2276 FrameTestHelpers::WebViewHelper webViewHelper;
2277 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-124.html", tr ue, 0, 0, setViewportSettings);
2278
2279 Page* page = webViewHelper.webViewImpl()->page();
2280 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2281
2282 EXPECT_EQ(320, constraints.layoutSize.width());
2283 EXPECT_EQ(352, constraints.layoutSize.height());
2284 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2285 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2286 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2287 EXPECT_TRUE(page->viewportDescription().userZoom);
2288 }
2289
2290 TEST_F(ViewportTest, viewport125)
2291 {
2292 UseMockScrollbarSettings mockScrollbarSettings;
2293 registerMockedHttpURLLoad("viewport/viewport-125.html");
2294
2295 FrameTestHelpers::WebViewHelper webViewHelper;
2296 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-125.html", tr ue, 0, 0, setViewportSettings);
2297
2298 Page* page = webViewHelper.webViewImpl()->page();
2299 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2300
2301 EXPECT_EQ(64, constraints.layoutSize.width());
2302 EXPECT_NEAR(70.4, constraints.layoutSize.height(), 0.01f);
2303 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
2304 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
2305 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2306 EXPECT_TRUE(page->viewportDescription().userZoom);
2307 }
2308
2309 TEST_F(ViewportTest, viewport126)
2310 {
2311 UseMockScrollbarSettings mockScrollbarSettings;
2312 registerMockedHttpURLLoad("viewport/viewport-126.html");
2313
2314 FrameTestHelpers::WebViewHelper webViewHelper;
2315 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-126.html", tr ue, 0, 0, setViewportSettings);
2316
2317 Page* page = webViewHelper.webViewImpl()->page();
2318 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2319
2320 EXPECT_EQ(64, constraints.layoutSize.width());
2321 EXPECT_NEAR(70.4, constraints.layoutSize.height(), 0.01f);
2322 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
2323 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
2324 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2325 EXPECT_TRUE(page->viewportDescription().userZoom);
2326 }
2327
2328 TEST_F(ViewportTest, viewport127)
2329 {
2330 UseMockScrollbarSettings mockScrollbarSettings;
2331 registerMockedHttpURLLoad("viewport/viewport-127.html");
2332
2333 FrameTestHelpers::WebViewHelper webViewHelper;
2334 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-127.html", tr ue, 0, 0, setViewportSettings);
2335
2336 Page* page = webViewHelper.webViewImpl()->page();
2337 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2338
2339 EXPECT_EQ(64, constraints.layoutSize.width());
2340 EXPECT_NEAR(70.4, constraints.layoutSize.height(), 0.01f);
2341 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
2342 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
2343 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2344 EXPECT_TRUE(page->viewportDescription().userZoom);
2345 }
2346
2347 TEST_F(ViewportTest, viewport129)
2348 {
2349 UseMockScrollbarSettings mockScrollbarSettings;
2350 registerMockedHttpURLLoad("viewport/viewport-129.html");
2351
2352 FrameTestHelpers::WebViewHelper webViewHelper;
2353 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-129.html", tr ue, 0, 0, setViewportSettings);
2354
2355 Page* page = webViewHelper.webViewImpl()->page();
2356 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2357
2358 EXPECT_EQ(123, constraints.layoutSize.width());
2359 EXPECT_NEAR(135.3, constraints.layoutSize.height(), 0.01f);
2360 EXPECT_NEAR(2.60f, constraints.initialScale, 0.01f);
2361 EXPECT_NEAR(2.60f, constraints.minimumScale, 0.01f);
2362 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2363 EXPECT_TRUE(page->viewportDescription().userZoom);
2364 }
2365
2366 TEST_F(ViewportTest, viewport130)
2367 {
2368 UseMockScrollbarSettings mockScrollbarSettings;
2369 registerMockedHttpURLLoad("viewport/viewport-130.html");
2370
2371 FrameTestHelpers::WebViewHelper webViewHelper;
2372 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-130.html", tr ue, 0, 0, setViewportSettings);
2373
2374 Page* page = webViewHelper.webViewImpl()->page();
2375 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2376
2377 EXPECT_EQ(320, constraints.layoutSize.width());
2378 EXPECT_EQ(352, constraints.layoutSize.height());
2379 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2380 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2381 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2382 EXPECT_TRUE(page->viewportDescription().userZoom);
2383 }
2384
2385 TEST_F(ViewportTest, viewport131)
2386 {
2387 UseMockScrollbarSettings mockScrollbarSettings;
2388 registerMockedHttpURLLoad("viewport/viewport-131.html");
2389
2390 FrameTestHelpers::WebViewHelper webViewHelper;
2391 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-131.html", tr ue, 0, 0, setViewportSettings);
2392
2393 Page* page = webViewHelper.webViewImpl()->page();
2394 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2395
2396 EXPECT_EQ(320, constraints.layoutSize.width());
2397 EXPECT_EQ(352, constraints.layoutSize.height());
2398 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2399 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2400 EXPECT_NEAR(1.0f, constraints.maximumScale, 0.01f);
2401 EXPECT_FALSE(page->viewportDescription().userZoom);
2402 }
2403
2404 TEST_F(ViewportTest, viewport132)
2405 {
2406 UseMockScrollbarSettings mockScrollbarSettings;
2407 registerMockedHttpURLLoad("viewport/viewport-132.html");
2408
2409 FrameTestHelpers::WebViewHelper webViewHelper;
2410 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-132.html", tr ue, 0, 0, setViewportSettings);
2411
2412 Page* page = webViewHelper.webViewImpl()->page();
2413 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2414
2415 EXPECT_EQ(320, constraints.layoutSize.width());
2416 EXPECT_EQ(352, constraints.layoutSize.height());
2417 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2418 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2419 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2420 EXPECT_TRUE(page->viewportDescription().userZoom);
2421 }
2422
2423 TEST_F(ViewportTest, viewport133)
2424 {
2425 UseMockScrollbarSettings mockScrollbarSettings;
2426 registerMockedHttpURLLoad("viewport/viewport-133.html");
2427
2428 FrameTestHelpers::WebViewHelper webViewHelper;
2429 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-133.html", tr ue, 0, 0, setViewportSettings);
2430
2431 Page* page = webViewHelper.webViewImpl()->page();
2432 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2433
2434 EXPECT_EQ(980, constraints.layoutSize.width());
2435 EXPECT_EQ(1078, constraints.layoutSize.height());
2436 EXPECT_NEAR(10.0f, constraints.initialScale, 0.01f);
2437 EXPECT_NEAR(10.0f, constraints.minimumScale, 0.01f);
2438 EXPECT_NEAR(10.0f, constraints.maximumScale, 0.01f);
2439 EXPECT_TRUE(page->viewportDescription().userZoom);
2440 }
2441
2442 TEST_F(ViewportTest, viewport134)
2443 {
2444 UseMockScrollbarSettings mockScrollbarSettings;
2445 registerMockedHttpURLLoad("viewport/viewport-134.html");
2446
2447 FrameTestHelpers::WebViewHelper webViewHelper;
2448 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-134.html", tr ue, 0, 0, setViewportSettings);
2449
2450 Page* page = webViewHelper.webViewImpl()->page();
2451 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2452
2453 EXPECT_EQ(160, constraints.layoutSize.width());
2454 EXPECT_EQ(176, constraints.layoutSize.height());
2455 EXPECT_NEAR(2.0f, constraints.initialScale, 0.01f);
2456 EXPECT_NEAR(2.0f, constraints.minimumScale, 0.01f);
2457 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2458 EXPECT_TRUE(page->viewportDescription().userZoom);
2459 }
2460
2461 TEST_F(ViewportTest, viewport135)
2462 {
2463 UseMockScrollbarSettings mockScrollbarSettings;
2464 registerMockedHttpURLLoad("viewport/viewport-135.html");
2465
2466 FrameTestHelpers::WebViewHelper webViewHelper;
2467 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-135.html", tr ue, 0, 0, setViewportSettings);
2468
2469 Page* page = webViewHelper.webViewImpl()->page();
2470 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2471
2472 EXPECT_EQ(980, constraints.layoutSize.width());
2473 EXPECT_EQ(1078, constraints.layoutSize.height());
2474 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
2475 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
2476 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2477 EXPECT_TRUE(page->viewportDescription().userZoom);
2478 }
2479
2480 TEST_F(ViewportTest, viewport136)
2481 {
2482 UseMockScrollbarSettings mockScrollbarSettings;
2483 registerMockedHttpURLLoad("viewport/viewport-136.html");
2484
2485 FrameTestHelpers::WebViewHelper webViewHelper;
2486 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-136.html", tr ue, 0, 0, setViewportSettings);
2487
2488 Page* page = webViewHelper.webViewImpl()->page();
2489 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2490
2491 EXPECT_EQ(320, constraints.layoutSize.width());
2492 EXPECT_EQ(352, constraints.layoutSize.height());
2493 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2494 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2495 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2496 EXPECT_TRUE(page->viewportDescription().userZoom);
2497 }
2498
2499 TEST_F(ViewportTest, viewport137)
2500 {
2501 UseMockScrollbarSettings mockScrollbarSettings;
2502 registerMockedHttpURLLoad("viewport/viewport-137.html");
2503
2504 FrameTestHelpers::WebViewHelper webViewHelper;
2505 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-137.html", tr ue, 0, 0, setViewportSettings);
2506
2507 Page* page = webViewHelper.webViewImpl()->page();
2508 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2509
2510 EXPECT_EQ(980, constraints.layoutSize.width());
2511 EXPECT_EQ(1078, constraints.layoutSize.height());
2512 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
2513 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
2514 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2515 EXPECT_TRUE(page->viewportDescription().userZoom);
2516 }
2517
2518 TEST_F(ViewportTest, viewportLegacyHandheldFriendly)
2519 {
2520 UseMockScrollbarSettings mockScrollbarSettings;
2521 registerMockedHttpURLLoad("viewport/viewport-legacy-handheldfriendly.html");
2522
2523 FrameTestHelpers::WebViewHelper webViewHelper;
2524 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-handhe ldfriendly.html", true, 0, 0, setViewportSettings);
2525
2526 Page* page = webViewHelper.webViewImpl()->page();
2527 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2528
2529 EXPECT_EQ(320, constraints.layoutSize.width());
2530 EXPECT_EQ(352, constraints.layoutSize.height());
2531 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2532 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2533 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2534 EXPECT_TRUE(page->viewportDescription().userZoom);
2535 }
2536
2537 static void setQuirkViewportSettings(WebSettings* settings)
2538 {
2539 setViewportSettings(settings);
2540
2541 // This quirk allows content attributes of meta viewport tags to be merged.
2542 settings->setViewportMetaMergeContentQuirk(true);
2543 }
2544
2545 TEST_F(ViewportTest, viewportLegacyMergeQuirk1)
2546 {
2547 UseMockScrollbarSettings mockScrollbarSettings;
2548 registerMockedHttpURLLoad("viewport/viewport-legacy-merge-quirk-1.html");
2549
2550 FrameTestHelpers::WebViewHelper webViewHelper;
2551 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-merge- quirk-1.html", true, 0, 0, setQuirkViewportSettings);
2552
2553 Page* page = webViewHelper.webViewImpl()->page();
2554 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2555
2556 EXPECT_EQ(640, constraints.layoutSize.width());
2557 EXPECT_EQ(704, constraints.layoutSize.height());
2558 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2559 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2560 EXPECT_NEAR(1.0f, constraints.maximumScale, 0.01f);
2561 EXPECT_FALSE(page->viewportDescription().userZoom);
2562 }
2563
2564 TEST_F(ViewportTest, viewportLegacyMergeQuirk2)
2565 {
2566 UseMockScrollbarSettings mockScrollbarSettings;
2567 registerMockedHttpURLLoad("viewport/viewport-legacy-merge-quirk-2.html");
2568
2569 FrameTestHelpers::WebViewHelper webViewHelper;
2570 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-merge- quirk-2.html", true, 0, 0, setQuirkViewportSettings);
2571
2572 Page* page = webViewHelper.webViewImpl()->page();
2573
2574 // This quirk allows content attributes of meta viewport tags to be merged.
2575 page->settings().setViewportMetaMergeContentQuirk(true);
2576 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2577
2578 EXPECT_EQ(500, constraints.layoutSize.width());
2579 EXPECT_EQ(550, constraints.layoutSize.height());
2580 EXPECT_NEAR(2.0f, constraints.initialScale, 0.01f);
2581 EXPECT_NEAR(2.0f, constraints.minimumScale, 0.01f);
2582 EXPECT_NEAR(2.0f, constraints.maximumScale, 0.01f);
2583 EXPECT_FALSE(page->viewportDescription().userZoom);
2584 }
2585
2586 TEST_F(ViewportTest, viewportLegacyMobileOptimizedMetaWithoutContent)
2587 {
2588 UseMockScrollbarSettings mockScrollbarSettings;
2589 registerMockedHttpURLLoad("viewport/viewport-legacy-mobileoptimized.html");
2590
2591 FrameTestHelpers::WebViewHelper webViewHelper;
2592 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-mobile optimized.html", true, 0, 0, setViewportSettings);
2593
2594 Page* page = webViewHelper.webViewImpl()->page();
2595
2596 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2597
2598 EXPECT_EQ(320, constraints.layoutSize.width());
2599 EXPECT_EQ(352, constraints.layoutSize.height());
2600 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2601 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2602 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2603 EXPECT_TRUE(page->viewportDescription().userZoom);
2604 }
2605
2606 TEST_F(ViewportTest, viewportLegacyMobileOptimizedMetaWith0)
2607 {
2608 UseMockScrollbarSettings mockScrollbarSettings;
2609 registerMockedHttpURLLoad("viewport/viewport-legacy-mobileoptimized-2.html") ;
2610
2611 FrameTestHelpers::WebViewHelper webViewHelper;
2612 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-mobile optimized-2.html", true, 0, 0, setViewportSettings);
2613
2614 Page* page = webViewHelper.webViewImpl()->page();
2615
2616 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2617
2618 EXPECT_EQ(320, constraints.layoutSize.width());
2619 EXPECT_EQ(352, constraints.layoutSize.height());
2620 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2621 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2622 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2623 EXPECT_TRUE(page->viewportDescription().userZoom);
2624 }
2625
2626 TEST_F(ViewportTest, viewportLegacyMobileOptimizedMetaWith400)
2627 {
2628 UseMockScrollbarSettings mockScrollbarSettings;
2629 registerMockedHttpURLLoad("viewport/viewport-legacy-mobileoptimized-2.html") ;
2630
2631 FrameTestHelpers::WebViewHelper webViewHelper;
2632 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-mobile optimized-2.html", true, 0, 0, setViewportSettings);
2633
2634 Page* page = webViewHelper.webViewImpl()->page();
2635
2636 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2637
2638 EXPECT_EQ(320, constraints.layoutSize.width());
2639 EXPECT_EQ(352, constraints.layoutSize.height());
2640 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2641 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2642 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2643 EXPECT_TRUE(page->viewportDescription().userZoom);
2644 }
2645
2646 TEST_F(ViewportTest, viewportLegacyOrdering2)
2647 {
2648 UseMockScrollbarSettings mockScrollbarSettings;
2649 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-2.html");
2650
2651 FrameTestHelpers::WebViewHelper webViewHelper;
2652 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-orderi ng-2.html", true, 0, 0, setViewportSettings);
2653
2654 Page* page = webViewHelper.webViewImpl()->page();
2655
2656 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2657
2658 EXPECT_EQ(300, constraints.layoutSize.width());
2659 EXPECT_EQ(330, constraints.layoutSize.height());
2660 EXPECT_NEAR(1.07f, constraints.initialScale, 0.01f);
2661 EXPECT_NEAR(1.07f, constraints.minimumScale, 0.01f);
2662 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2663 EXPECT_TRUE(page->viewportDescription().userZoom);
2664 }
2665
2666 TEST_F(ViewportTest, viewportLegacyOrdering3)
2667 {
2668 UseMockScrollbarSettings mockScrollbarSettings;
2669 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-3.html");
2670
2671 FrameTestHelpers::WebViewHelper webViewHelper;
2672 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-orderi ng-3.html", true, 0, 0, setViewportSettings);
2673
2674 Page* page = webViewHelper.webViewImpl()->page();
2675
2676 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2677
2678 EXPECT_EQ(300, constraints.layoutSize.width());
2679 EXPECT_EQ(330, constraints.layoutSize.height());
2680 EXPECT_NEAR(1.07f, constraints.initialScale, 0.01f);
2681 EXPECT_NEAR(1.07f, constraints.minimumScale, 0.01f);
2682 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2683 EXPECT_TRUE(page->viewportDescription().userZoom);
2684 }
2685
2686 TEST_F(ViewportTest, viewportLegacyOrdering4)
2687 {
2688 UseMockScrollbarSettings mockScrollbarSettings;
2689 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-4.html");
2690
2691 FrameTestHelpers::WebViewHelper webViewHelper;
2692 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-orderi ng-4.html", true, 0, 0, setViewportSettings);
2693
2694 Page* page = webViewHelper.webViewImpl()->page();
2695
2696 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2697
2698 EXPECT_EQ(300, constraints.layoutSize.width());
2699 EXPECT_EQ(330, constraints.layoutSize.height());
2700 EXPECT_NEAR(1.07f, constraints.initialScale, 0.01f);
2701 EXPECT_NEAR(1.07f, constraints.minimumScale, 0.01f);
2702 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2703 EXPECT_TRUE(page->viewportDescription().userZoom);
2704 }
2705
2706 TEST_F(ViewportTest, viewportLegacyOrdering5)
2707 {
2708 UseMockScrollbarSettings mockScrollbarSettings;
2709 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-5.html");
2710
2711 FrameTestHelpers::WebViewHelper webViewHelper;
2712 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-orderi ng-5.html", true, 0, 0, setViewportSettings);
2713
2714 Page* page = webViewHelper.webViewImpl()->page();
2715
2716 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2717
2718 EXPECT_EQ(320, constraints.layoutSize.width());
2719 EXPECT_EQ(352, constraints.layoutSize.height());
2720 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2721 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2722 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2723 EXPECT_TRUE(page->viewportDescription().userZoom);
2724 }
2725
2726 TEST_F(ViewportTest, viewportLegacyOrdering6)
2727 {
2728 UseMockScrollbarSettings mockScrollbarSettings;
2729 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-6.html");
2730
2731 FrameTestHelpers::WebViewHelper webViewHelper;
2732 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-orderi ng-6.html", true, 0, 0, setViewportSettings);
2733
2734 Page* page = webViewHelper.webViewImpl()->page();
2735
2736 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2737
2738 EXPECT_EQ(320, constraints.layoutSize.width());
2739 EXPECT_EQ(352, constraints.layoutSize.height());
2740 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2741 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2742 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2743 EXPECT_TRUE(page->viewportDescription().userZoom);
2744 }
2745
2746 TEST_F(ViewportTest, viewportLegacyOrdering7)
2747 {
2748 UseMockScrollbarSettings mockScrollbarSettings;
2749 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-7.html");
2750
2751 FrameTestHelpers::WebViewHelper webViewHelper;
2752 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-orderi ng-7.html", true, 0, 0, setViewportSettings);
2753
2754 Page* page = webViewHelper.webViewImpl()->page();
2755
2756 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2757
2758 EXPECT_EQ(300, constraints.layoutSize.width());
2759 EXPECT_EQ(330, constraints.layoutSize.height());
2760 EXPECT_NEAR(1.07f, constraints.initialScale, 0.01f);
2761 EXPECT_NEAR(1.07f, constraints.minimumScale, 0.01f);
2762 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2763 EXPECT_TRUE(page->viewportDescription().userZoom);
2764 }
2765
2766 TEST_F(ViewportTest, viewportLegacyOrdering8)
2767 {
2768 UseMockScrollbarSettings mockScrollbarSettings;
2769 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-8.html");
2770
2771 FrameTestHelpers::WebViewHelper webViewHelper;
2772 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-orderi ng-8.html", true, 0, 0, setViewportSettings);
2773
2774 Page* page = webViewHelper.webViewImpl()->page();
2775
2776 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2777
2778 EXPECT_EQ(300, constraints.layoutSize.width());
2779 EXPECT_EQ(330, constraints.layoutSize.height());
2780 EXPECT_NEAR(1.07f, constraints.initialScale, 0.01f);
2781 EXPECT_NEAR(1.07f, constraints.minimumScale, 0.01f);
2782 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2783 EXPECT_TRUE(page->viewportDescription().userZoom);
2784 }
2785
2786 TEST_F(ViewportTest, viewportLegacyEmptyAtViewportDoesntOverrideViewportMeta)
2787 {
2788 UseMockScrollbarSettings mockScrollbarSettings;
2789 registerMockedHttpURLLoad("viewport/viewport-legacy-ordering-10.html");
2790
2791 FrameTestHelpers::WebViewHelper webViewHelper;
2792 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-orderi ng-10.html", true, 0, 0, setViewportSettings);
2793
2794 Page* page = webViewHelper.webViewImpl()->page();
2795 PageScaleConstraints constraints = runViewportTest(page, 800, 600);
2796
2797 EXPECT_EQ(5000, constraints.layoutSize.width());
2798 }
2799
2800 TEST_F(ViewportTest, viewportLegacyDefaultValueChangedByXHTMLMP)
2801 {
2802 UseMockScrollbarSettings mockScrollbarSettings;
2803 registerMockedHttpURLLoad("viewport/viewport-legacy-xhtmlmp.html");
2804
2805 FrameTestHelpers::WebViewHelper webViewHelper;
2806 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-xhtmlm p.html", true, 0, 0, setViewportSettings);
2807
2808 Page* page = webViewHelper.webViewImpl()->page();
2809 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2810
2811 EXPECT_EQ(320, constraints.layoutSize.width());
2812 EXPECT_EQ(352, constraints.layoutSize.height());
2813 EXPECT_NEAR(1.0f, constraints.initialScale, 0.01f);
2814 EXPECT_NEAR(1.0f, constraints.minimumScale, 0.01f);
2815 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2816 EXPECT_TRUE(page->viewportDescription().userZoom);
2817 }
2818
2819 TEST_F(ViewportTest, viewportLegacyDefaultValueChangedByXHTMLMPAndOverriddenByMe ta)
2820 {
2821 UseMockScrollbarSettings mockScrollbarSettings;
2822 registerMockedHttpURLLoad("viewport/viewport-legacy-xhtmlmp-misplaced-doctyp e.html");
2823
2824 FrameTestHelpers::WebViewHelper webViewHelper;
2825 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-xhtmlm p-misplaced-doctype.html", true, 0, 0, setViewportSettings);
2826
2827 Page* page = webViewHelper.webViewImpl()->page();
2828 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2829
2830 EXPECT_EQ(640, constraints.layoutSize.width());
2831 EXPECT_EQ(704, constraints.layoutSize.height());
2832 EXPECT_NEAR(0.5f, constraints.initialScale, 0.01f);
2833 EXPECT_NEAR(0.5f, constraints.minimumScale, 0.01f);
2834 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2835 EXPECT_TRUE(page->viewportDescription().userZoom);
2836 }
2837
2838 TEST_F(ViewportTest, viewportLegacyXHTMLMPOrdering)
2839 {
2840 UseMockScrollbarSettings mockScrollbarSettings;
2841 registerMockedHttpURLLoad("viewport/viewport-legacy-xhtmlmp-ordering.html");
2842
2843 FrameTestHelpers::WebViewHelper webViewHelper;
2844 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-legacy-xhtmlm p-ordering.html", true, 0, 0, setViewportSettings);
2845
2846 Page* page = webViewHelper.webViewImpl()->page();
2847 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2848
2849 EXPECT_EQ(640, constraints.layoutSize.width());
2850 EXPECT_EQ(704, constraints.layoutSize.height());
2851 EXPECT_NEAR(0.5f, constraints.initialScale, 0.01f);
2852 EXPECT_NEAR(0.5f, constraints.minimumScale, 0.01f);
2853 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2854 EXPECT_TRUE(page->viewportDescription().userZoom);
2855 }
2856
2857 TEST_F(ViewportTest, viewportLimitsAdjustedForNoUserScale)
2858 {
2859 UseMockScrollbarSettings mockScrollbarSettings;
2860 registerMockedHttpURLLoad("viewport/viewport-limits-adjusted-for-no-user-sca le.html");
2861
2862 FrameTestHelpers::WebViewHelper webViewHelper;
2863 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-limits-adjust ed-for-no-user-scale.html", true, 0, 0, setViewportSettings);
2864
2865 Page* page = webViewHelper.webViewImpl()->page();
2866
2867 EXPECT_FALSE(page->viewportDescription().userZoom);
2868 }
2869
2870 TEST_F(ViewportTest, viewportLimitsAdjustedForNoUserScaleControl)
2871 {
2872 UseMockScrollbarSettings mockScrollbarSettings;
2873 registerMockedHttpURLLoad("viewport/viewport-limits-adjusted-for-no-user-sca le-control.html");
2874
2875 FrameTestHelpers::WebViewHelper webViewHelper;
2876 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-limits-adjust ed-for-no-user-scale-control.html", true, 0, 0, setViewportSettings);
2877
2878 Page* page = webViewHelper.webViewImpl()->page();
2879
2880 EXPECT_TRUE(page->viewportDescription().userZoom);
2881 }
2882
2883 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698