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