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

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

Powered by Google App Engine
This is Rietveld 408576698