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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 FixedLayoutTestWebViewClient client; 1182 FixedLayoutTestWebViewClient client;
1183 client.m_screenInfo.deviceScaleFactor = 1; 1183 client.m_screenInfo.deviceScaleFactor = 1;
1184 int viewportWidth = 1280; 1184 int viewportWidth = 1280;
1185 int viewportHeight = 0; 1185 int viewportHeight = 0;
1186 1186
1187 FrameTestHelpers::WebViewHelper webViewHelper; 1187 FrameTestHelpers::WebViewHelper webViewHelper;
1188 webViewHelper.initialize(true, nullptr, &client, nullptr, 1188 webViewHelper.initialize(true, nullptr, &client, nullptr,
1189 enableViewportSettings); 1189 enableViewportSettings);
1190 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 1190 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
1191 1191
1192 EXPECT_EQ(viewportWidth, webViewHelper.webView() 1192 EXPECT_EQ(viewportWidth,
1193 ->mainFrameImpl() 1193 webViewHelper.webView()
1194 ->frameView() 1194 ->mainFrameImpl()
1195 ->layoutSize() 1195 ->frameView()
1196 .width()); 1196 ->layoutSize()
1197 EXPECT_EQ(viewportHeight, webViewHelper.webView() 1197 .width());
1198 ->mainFrameImpl() 1198 EXPECT_EQ(viewportHeight,
1199 ->frameView() 1199 webViewHelper.webView()
1200 ->layoutSize() 1200 ->mainFrameImpl()
1201 .height()); 1201 ->frameView()
1202 ->layoutSize()
1203 .height());
1202 } 1204 }
1203 1205
1204 TEST_P(ParameterizedWebFrameTest, 1206 TEST_P(ParameterizedWebFrameTest,
1205 DeviceScaleFactorUsesDefaultWithoutViewportTag) { 1207 DeviceScaleFactorUsesDefaultWithoutViewportTag) {
1206 registerMockedHttpURLLoad("no_viewport_tag.html"); 1208 registerMockedHttpURLLoad("no_viewport_tag.html");
1207 1209
1208 int viewportWidth = 640; 1210 int viewportWidth = 640;
1209 int viewportHeight = 480; 1211 int viewportHeight = 480;
1210 1212
1211 FixedLayoutTestWebViewClient client; 1213 FixedLayoutTestWebViewClient client;
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1390 FrameTestHelpers::WebViewHelper webViewHelper; 1392 FrameTestHelpers::WebViewHelper webViewHelper;
1391 webViewHelper.initializeAndLoad( 1393 webViewHelper.initializeAndLoad(
1392 m_baseURL + "viewport-auto-initial-scale.html", true, nullptr, &client, 1394 m_baseURL + "viewport-auto-initial-scale.html", true, nullptr, &client,
1393 nullptr, enableViewportSettings); 1395 nullptr, enableViewportSettings);
1394 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 1396 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
1395 webViewHelper.webView()->settings()->setUseWideViewport(false); 1397 webViewHelper.webView()->settings()->setUseWideViewport(false);
1396 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 1398 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
1397 1399
1398 // The page sets viewport width to 3000, but with UseWideViewport == false is 1400 // The page sets viewport width to 3000, but with UseWideViewport == false is
1399 // must be ignored. 1401 // must be ignored.
1400 EXPECT_EQ(viewportWidth, webViewHelper.webView() 1402 EXPECT_EQ(viewportWidth,
1401 ->mainFrameImpl() 1403 webViewHelper.webView()
1402 ->frameView() 1404 ->mainFrameImpl()
1403 ->contentsSize() 1405 ->frameView()
1404 .width()); 1406 ->contentsSize()
1405 EXPECT_EQ(viewportHeight, webViewHelper.webView() 1407 .width());
1406 ->mainFrameImpl() 1408 EXPECT_EQ(viewportHeight,
1407 ->frameView() 1409 webViewHelper.webView()
1408 ->contentsSize() 1410 ->mainFrameImpl()
1409 .height()); 1411 ->frameView()
1412 ->contentsSize()
1413 .height());
1410 } 1414 }
1411 1415
1412 TEST_P(ParameterizedWebFrameTest, 1416 TEST_P(ParameterizedWebFrameTest,
1413 NoWideViewportIgnoresPageViewportWidthButAccountsScale) { 1417 NoWideViewportIgnoresPageViewportWidthButAccountsScale) {
1414 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); 1418 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html");
1415 1419
1416 FixedLayoutTestWebViewClient client; 1420 FixedLayoutTestWebViewClient client;
1417 client.m_screenInfo.deviceScaleFactor = 1; 1421 client.m_screenInfo.deviceScaleFactor = 1;
1418 int viewportWidth = 640; 1422 int viewportWidth = 640;
1419 int viewportHeight = 480; 1423 int viewportHeight = 480;
1420 1424
1421 FrameTestHelpers::WebViewHelper webViewHelper; 1425 FrameTestHelpers::WebViewHelper webViewHelper;
1422 webViewHelper.initializeAndLoad( 1426 webViewHelper.initializeAndLoad(
1423 m_baseURL + "viewport-wide-2x-initial-scale.html", true, nullptr, &client, 1427 m_baseURL + "viewport-wide-2x-initial-scale.html", true, nullptr, &client,
1424 nullptr, enableViewportSettings); 1428 nullptr, enableViewportSettings);
1425 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 1429 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
1426 webViewHelper.webView()->settings()->setUseWideViewport(false); 1430 webViewHelper.webView()->settings()->setUseWideViewport(false);
1427 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 1431 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
1428 1432
1429 // The page sets viewport width to 3000, but with UseWideViewport == false it 1433 // The page sets viewport width to 3000, but with UseWideViewport == false it
1430 // must be ignored while the initial scale specified by the page must be 1434 // must be ignored while the initial scale specified by the page must be
1431 // accounted. 1435 // accounted.
1432 EXPECT_EQ(viewportWidth / 2, webViewHelper.webView() 1436 EXPECT_EQ(viewportWidth / 2,
1433 ->mainFrameImpl() 1437 webViewHelper.webView()
1434 ->frameView() 1438 ->mainFrameImpl()
1435 ->contentsSize() 1439 ->frameView()
1436 .width()); 1440 ->contentsSize()
1437 EXPECT_EQ(viewportHeight / 2, webViewHelper.webView() 1441 .width());
1438 ->mainFrameImpl() 1442 EXPECT_EQ(viewportHeight / 2,
1439 ->frameView() 1443 webViewHelper.webView()
1440 ->contentsSize() 1444 ->mainFrameImpl()
1441 .height()); 1445 ->frameView()
1446 ->contentsSize()
1447 .height());
1442 } 1448 }
1443 1449
1444 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithoutViewportTag) { 1450 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithoutViewportTag) {
1445 registerMockedHttpURLLoad("no_viewport_tag.html"); 1451 registerMockedHttpURLLoad("no_viewport_tag.html");
1446 1452
1447 FixedLayoutTestWebViewClient client; 1453 FixedLayoutTestWebViewClient client;
1448 client.m_screenInfo.deviceScaleFactor = 1; 1454 client.m_screenInfo.deviceScaleFactor = 1;
1449 int viewportWidth = 640; 1455 int viewportWidth = 640;
1450 int viewportHeight = 480; 1456 int viewportHeight = 480;
1451 1457
1452 FrameTestHelpers::WebViewHelper webViewHelper; 1458 FrameTestHelpers::WebViewHelper webViewHelper;
1453 webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true, 1459 webViewHelper.initializeAndLoad(m_baseURL + "no_viewport_tag.html", true,
1454 nullptr, &client, nullptr, 1460 nullptr, &client, nullptr,
1455 enableViewportSettings); 1461 enableViewportSettings);
1456 applyViewportStyleOverride(&webViewHelper); 1462 applyViewportStyleOverride(&webViewHelper);
1457 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 1463 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
1458 webViewHelper.webView()->settings()->setUseWideViewport(true); 1464 webViewHelper.webView()->settings()->setUseWideViewport(true);
1459 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 1465 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
1460 1466
1461 EXPECT_EQ(980, webViewHelper.webView() 1467 EXPECT_EQ(980,
1462 ->mainFrameImpl() 1468 webViewHelper.webView()
1463 ->frameView() 1469 ->mainFrameImpl()
1464 ->contentsSize() 1470 ->frameView()
1465 .width()); 1471 ->contentsSize()
1466 EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewHelper.webView() 1472 .width());
1467 ->mainFrameImpl() 1473 EXPECT_EQ(980.0 / viewportWidth * viewportHeight,
1468 ->frameView() 1474 webViewHelper.webView()
1469 ->contentsSize() 1475 ->mainFrameImpl()
1470 .height()); 1476 ->frameView()
1477 ->contentsSize()
1478 .height());
1471 } 1479 }
1472 1480
1473 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithXhtmlMp) { 1481 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithXhtmlMp) {
1474 registerMockedHttpURLLoad("viewport/viewport-legacy-xhtmlmp.html"); 1482 registerMockedHttpURLLoad("viewport/viewport-legacy-xhtmlmp.html");
1475 1483
1476 FixedLayoutTestWebViewClient client; 1484 FixedLayoutTestWebViewClient client;
1477 client.m_screenInfo.deviceScaleFactor = 1; 1485 client.m_screenInfo.deviceScaleFactor = 1;
1478 int viewportWidth = 640; 1486 int viewportWidth = 640;
1479 int viewportHeight = 480; 1487 int viewportHeight = 480;
1480 1488
1481 FrameTestHelpers::WebViewHelper webViewHelper; 1489 FrameTestHelpers::WebViewHelper webViewHelper;
1482 webViewHelper.initialize(true, nullptr, &client, nullptr, 1490 webViewHelper.initialize(true, nullptr, &client, nullptr,
1483 enableViewportSettings); 1491 enableViewportSettings);
1484 applyViewportStyleOverride(&webViewHelper); 1492 applyViewportStyleOverride(&webViewHelper);
1485 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 1493 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
1486 webViewHelper.webView()->settings()->setUseWideViewport(true); 1494 webViewHelper.webView()->settings()->setUseWideViewport(true);
1487 FrameTestHelpers::loadFrame( 1495 FrameTestHelpers::loadFrame(
1488 webViewHelper.webView()->mainFrame(), 1496 webViewHelper.webView()->mainFrame(),
1489 m_baseURL + "viewport/viewport-legacy-xhtmlmp.html"); 1497 m_baseURL + "viewport/viewport-legacy-xhtmlmp.html");
1490 1498
1491 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 1499 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
1492 EXPECT_EQ(viewportWidth, webViewHelper.webView() 1500 EXPECT_EQ(viewportWidth,
1493 ->mainFrameImpl() 1501 webViewHelper.webView()
1494 ->frameView() 1502 ->mainFrameImpl()
1495 ->contentsSize() 1503 ->frameView()
1496 .width()); 1504 ->contentsSize()
1497 EXPECT_EQ(viewportHeight, webViewHelper.webView() 1505 .width());
1498 ->mainFrameImpl() 1506 EXPECT_EQ(viewportHeight,
1499 ->frameView() 1507 webViewHelper.webView()
1500 ->contentsSize() 1508 ->mainFrameImpl()
1501 .height()); 1509 ->frameView()
1510 ->contentsSize()
1511 .height());
1502 } 1512 }
1503 1513
1504 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndHeightInMeta) { 1514 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndHeightInMeta) {
1505 registerMockedHttpURLLoad("viewport-height-1000.html"); 1515 registerMockedHttpURLLoad("viewport-height-1000.html");
1506 1516
1507 FixedLayoutTestWebViewClient client; 1517 FixedLayoutTestWebViewClient client;
1508 client.m_screenInfo.deviceScaleFactor = 1; 1518 client.m_screenInfo.deviceScaleFactor = 1;
1509 int viewportWidth = 640; 1519 int viewportWidth = 640;
1510 int viewportHeight = 480; 1520 int viewportHeight = 480;
1511 1521
1512 FrameTestHelpers::WebViewHelper webViewHelper; 1522 FrameTestHelpers::WebViewHelper webViewHelper;
1513 webViewHelper.initializeAndLoad(m_baseURL + "viewport-height-1000.html", true, 1523 webViewHelper.initializeAndLoad(m_baseURL + "viewport-height-1000.html", true,
1514 nullptr, &client, nullptr, 1524 nullptr, &client, nullptr,
1515 enableViewportSettings); 1525 enableViewportSettings);
1516 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 1526 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
1517 webViewHelper.webView()->settings()->setUseWideViewport(false); 1527 webViewHelper.webView()->settings()->setUseWideViewport(false);
1518 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 1528 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
1519 1529
1520 EXPECT_EQ(viewportWidth, webViewHelper.webView() 1530 EXPECT_EQ(viewportWidth,
1521 ->mainFrameImpl() 1531 webViewHelper.webView()
1522 ->frameView() 1532 ->mainFrameImpl()
1523 ->contentsSize() 1533 ->frameView()
1524 .width()); 1534 ->contentsSize()
1535 .width());
1525 } 1536 }
1526 1537
1527 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithAutoWidth) { 1538 TEST_P(ParameterizedWebFrameTest, WideViewportSetsTo980WithAutoWidth) {
1528 registerMockedHttpURLLoad("viewport-2x-initial-scale.html"); 1539 registerMockedHttpURLLoad("viewport-2x-initial-scale.html");
1529 1540
1530 FixedLayoutTestWebViewClient client; 1541 FixedLayoutTestWebViewClient client;
1531 client.m_screenInfo.deviceScaleFactor = 1; 1542 client.m_screenInfo.deviceScaleFactor = 1;
1532 int viewportWidth = 640; 1543 int viewportWidth = 640;
1533 int viewportHeight = 480; 1544 int viewportHeight = 480;
1534 1545
1535 FrameTestHelpers::WebViewHelper webViewHelper; 1546 FrameTestHelpers::WebViewHelper webViewHelper;
1536 webViewHelper.initializeAndLoad(m_baseURL + "viewport-2x-initial-scale.html", 1547 webViewHelper.initializeAndLoad(m_baseURL + "viewport-2x-initial-scale.html",
1537 true, nullptr, &client, nullptr, 1548 true, nullptr, &client, nullptr,
1538 enableViewportSettings); 1549 enableViewportSettings);
1539 applyViewportStyleOverride(&webViewHelper); 1550 applyViewportStyleOverride(&webViewHelper);
1540 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 1551 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
1541 webViewHelper.webView()->settings()->setUseWideViewport(true); 1552 webViewHelper.webView()->settings()->setUseWideViewport(true);
1542 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 1553 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
1543 1554
1544 EXPECT_EQ(980, webViewHelper.webView() 1555 EXPECT_EQ(980,
1545 ->mainFrameImpl() 1556 webViewHelper.webView()
1546 ->frameView() 1557 ->mainFrameImpl()
1547 ->contentsSize() 1558 ->frameView()
1548 .width()); 1559 ->contentsSize()
1549 EXPECT_EQ(980.0 / viewportWidth * viewportHeight, webViewHelper.webView() 1560 .width());
1550 ->mainFrameImpl() 1561 EXPECT_EQ(980.0 / viewportWidth * viewportHeight,
1551 ->frameView() 1562 webViewHelper.webView()
1552 ->contentsSize() 1563 ->mainFrameImpl()
1553 .height()); 1564 ->frameView()
1565 ->contentsSize()
1566 .height());
1554 } 1567 }
1555 1568
1556 TEST_P(ParameterizedWebFrameTest, 1569 TEST_P(ParameterizedWebFrameTest,
1557 PageViewportInitialScaleOverridesLoadWithOverviewMode) { 1570 PageViewportInitialScaleOverridesLoadWithOverviewMode) {
1558 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html"); 1571 registerMockedHttpURLLoad("viewport-wide-2x-initial-scale.html");
1559 1572
1560 FixedLayoutTestWebViewClient client; 1573 FixedLayoutTestWebViewClient client;
1561 client.m_screenInfo.deviceScaleFactor = 1; 1574 client.m_screenInfo.deviceScaleFactor = 1;
1562 int viewportWidth = 640; 1575 int viewportWidth = 640;
1563 int viewportHeight = 480; 1576 int viewportHeight = 480;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1701 1714
1702 FrameTestHelpers::WebViewHelper webViewHelper; 1715 FrameTestHelpers::WebViewHelper webViewHelper;
1703 webViewHelper.initializeAndLoad("about:blank", true, nullptr, &client, 1716 webViewHelper.initializeAndLoad("about:blank", true, nullptr, &client,
1704 nullptr, enableViewportSettings); 1717 nullptr, enableViewportSettings);
1705 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 1718 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
1706 webViewHelper.webView()->settings()->setUseWideViewport(false); 1719 webViewHelper.webView()->settings()->setUseWideViewport(false);
1707 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false); 1720 webViewHelper.webView()->settings()->setLoadWithOverviewMode(false);
1708 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor); 1721 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor);
1709 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 1722 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
1710 1723
1711 EXPECT_EQ(viewportWidth / enforcedPageScaleFactor, webViewHelper.webView() 1724 EXPECT_EQ(viewportWidth / enforcedPageScaleFactor,
1712 ->mainFrameImpl() 1725 webViewHelper.webView()
1713 ->frameView() 1726 ->mainFrameImpl()
1714 ->contentsSize() 1727 ->frameView()
1715 .width()); 1728 ->contentsSize()
1729 .width());
1716 EXPECT_EQ(enforcedPageScaleFactor, 1730 EXPECT_EQ(enforcedPageScaleFactor,
1717 webViewHelper.webView()->pageScaleFactor()); 1731 webViewHelper.webView()->pageScaleFactor());
1718 } 1732 }
1719 1733
1720 TEST_P(ParameterizedWebFrameTest, 1734 TEST_P(ParameterizedWebFrameTest,
1721 DocumentElementClientHeightWorksWithWrapContentMode) { 1735 DocumentElementClientHeightWorksWithWrapContentMode) {
1722 registerMockedHttpURLLoad("0-by-0.html"); 1736 registerMockedHttpURLLoad("0-by-0.html");
1723 1737
1724 FixedLayoutTestWebViewClient client; 1738 FixedLayoutTestWebViewClient client;
1725 client.m_screenInfo.deviceScaleFactor = 1; 1739 client.m_screenInfo.deviceScaleFactor = 1;
(...skipping 21 matching lines...) Expand all
1747 client.m_screenInfo.deviceScaleFactor = 1; 1761 client.m_screenInfo.deviceScaleFactor = 1;
1748 int viewportWidth = 640; 1762 int viewportWidth = 640;
1749 int viewportHeight = 480; 1763 int viewportHeight = 480;
1750 1764
1751 FrameTestHelpers::WebViewHelper webViewHelper; 1765 FrameTestHelpers::WebViewHelper webViewHelper;
1752 1766
1753 webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, nullptr, 1767 webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, nullptr,
1754 &client, nullptr, configureAndroid); 1768 &client, nullptr, configureAndroid);
1755 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); 1769 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true);
1756 PaintLayerCompositor* compositor = webViewHelper.webView()->compositor(); 1770 PaintLayerCompositor* compositor = webViewHelper.webView()->compositor();
1757 EXPECT_EQ(0, webViewHelper.webView() 1771 EXPECT_EQ(0,
1758 ->mainFrameImpl() 1772 webViewHelper.webView()
1759 ->frameView() 1773 ->mainFrameImpl()
1760 ->layoutSize() 1774 ->frameView()
1761 .width()); 1775 ->layoutSize()
1762 EXPECT_EQ(0, webViewHelper.webView() 1776 .width());
1763 ->mainFrameImpl() 1777 EXPECT_EQ(0,
1764 ->frameView() 1778 webViewHelper.webView()
1765 ->layoutSize() 1779 ->mainFrameImpl()
1766 .height()); 1780 ->frameView()
1781 ->layoutSize()
1782 .height());
1767 EXPECT_EQ(0.0, compositor->containerLayer()->size().width()); 1783 EXPECT_EQ(0.0, compositor->containerLayer()->size().width());
1768 EXPECT_EQ(0.0, compositor->containerLayer()->size().height()); 1784 EXPECT_EQ(0.0, compositor->containerLayer()->size().height());
1769 1785
1770 webViewHelper.resize(WebSize(viewportWidth, 0)); 1786 webViewHelper.resize(WebSize(viewportWidth, 0));
1771 EXPECT_EQ(viewportWidth, webViewHelper.webView() 1787 EXPECT_EQ(viewportWidth,
1772 ->mainFrameImpl() 1788 webViewHelper.webView()
1773 ->frameView() 1789 ->mainFrameImpl()
1774 ->layoutSize() 1790 ->frameView()
1775 .width()); 1791 ->layoutSize()
1776 EXPECT_EQ(0, webViewHelper.webView() 1792 .width());
1777 ->mainFrameImpl() 1793 EXPECT_EQ(0,
1778 ->frameView() 1794 webViewHelper.webView()
1779 ->layoutSize() 1795 ->mainFrameImpl()
1780 .height()); 1796 ->frameView()
1797 ->layoutSize()
1798 .height());
1781 EXPECT_EQ(viewportWidth, compositor->containerLayer()->size().width()); 1799 EXPECT_EQ(viewportWidth, compositor->containerLayer()->size().width());
1782 EXPECT_EQ(0.0, compositor->containerLayer()->size().height()); 1800 EXPECT_EQ(0.0, compositor->containerLayer()->size().height());
1783 1801
1784 // The flag ForceZeroLayoutHeight will cause the following resize of viewport 1802 // The flag ForceZeroLayoutHeight will cause the following resize of viewport
1785 // height to be ignored by the outer viewport (the container layer of 1803 // height to be ignored by the outer viewport (the container layer of
1786 // LayerCompositor). The height of the visualViewport, however, is not 1804 // LayerCompositor). The height of the visualViewport, however, is not
1787 // affected. 1805 // affected.
1788 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 1806 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
1789 EXPECT_FALSE( 1807 EXPECT_FALSE(
1790 webViewHelper.webView()->mainFrameImpl()->frameView()->needsLayout()); 1808 webViewHelper.webView()->mainFrameImpl()->frameView()->needsLayout());
1791 EXPECT_EQ(viewportWidth, webViewHelper.webView() 1809 EXPECT_EQ(viewportWidth,
1792 ->mainFrameImpl() 1810 webViewHelper.webView()
1793 ->frameView() 1811 ->mainFrameImpl()
1794 ->layoutSize() 1812 ->frameView()
1795 .width()); 1813 ->layoutSize()
1796 EXPECT_EQ(0, webViewHelper.webView() 1814 .width());
1797 ->mainFrameImpl() 1815 EXPECT_EQ(0,
1798 ->frameView() 1816 webViewHelper.webView()
1799 ->layoutSize() 1817 ->mainFrameImpl()
1800 .height()); 1818 ->frameView()
1819 ->layoutSize()
1820 .height());
1801 EXPECT_EQ(viewportWidth, compositor->containerLayer()->size().width()); 1821 EXPECT_EQ(viewportWidth, compositor->containerLayer()->size().width());
1802 EXPECT_EQ(viewportHeight, compositor->containerLayer()->size().height()); 1822 EXPECT_EQ(viewportHeight, compositor->containerLayer()->size().height());
1803 1823
1804 LocalFrame* frame = webViewHelper.webView()->mainFrameImpl()->frame(); 1824 LocalFrame* frame = webViewHelper.webView()->mainFrameImpl()->frame();
1805 VisualViewport& visualViewport = frame->page()->frameHost().visualViewport(); 1825 VisualViewport& visualViewport = frame->page()->frameHost().visualViewport();
1806 EXPECT_EQ(viewportHeight, visualViewport.containerLayer()->size().height()); 1826 EXPECT_EQ(viewportHeight, visualViewport.containerLayer()->size().height());
1807 EXPECT_TRUE( 1827 EXPECT_TRUE(
1808 visualViewport.containerLayer()->platformLayer()->masksToBounds()); 1828 visualViewport.containerLayer()->platformLayer()->masksToBounds());
1809 EXPECT_FALSE(compositor->containerLayer()->platformLayer()->masksToBounds()); 1829 EXPECT_FALSE(compositor->containerLayer()->platformLayer()->masksToBounds());
1810 } 1830 }
1811 1831
1812 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeight) { 1832 TEST_P(ParameterizedWebFrameTest, SetForceZeroLayoutHeight) {
1813 registerMockedHttpURLLoad("200-by-300.html"); 1833 registerMockedHttpURLLoad("200-by-300.html");
1814 1834
1815 FixedLayoutTestWebViewClient client; 1835 FixedLayoutTestWebViewClient client;
1816 client.m_screenInfo.deviceScaleFactor = 1; 1836 client.m_screenInfo.deviceScaleFactor = 1;
1817 int viewportWidth = 640; 1837 int viewportWidth = 640;
1818 int viewportHeight = 480; 1838 int viewportHeight = 480;
1819 1839
1820 FrameTestHelpers::WebViewHelper webViewHelper; 1840 FrameTestHelpers::WebViewHelper webViewHelper;
1821 1841
1822 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, nullptr, 1842 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, nullptr,
1823 &client, nullptr, enableViewportSettings); 1843 &client, nullptr, enableViewportSettings);
1824 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 1844 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
1825 1845
1826 EXPECT_LE(viewportHeight, webViewHelper.webView() 1846 EXPECT_LE(viewportHeight,
1827 ->mainFrameImpl() 1847 webViewHelper.webView()
1828 ->frameView() 1848 ->mainFrameImpl()
1829 ->layoutSize() 1849 ->frameView()
1830 .height()); 1850 ->layoutSize()
1851 .height());
1831 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); 1852 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true);
1832 EXPECT_TRUE( 1853 EXPECT_TRUE(
1833 webViewHelper.webView()->mainFrameImpl()->frameView()->needsLayout()); 1854 webViewHelper.webView()->mainFrameImpl()->frameView()->needsLayout());
1834 1855
1835 EXPECT_EQ(0, webViewHelper.webView() 1856 EXPECT_EQ(0,
1836 ->mainFrameImpl() 1857 webViewHelper.webView()
1837 ->frameView() 1858 ->mainFrameImpl()
1838 ->layoutSize() 1859 ->frameView()
1839 .height()); 1860 ->layoutSize()
1861 .height());
1840 1862
1841 webViewHelper.resize(WebSize(viewportWidth, viewportHeight * 2)); 1863 webViewHelper.resize(WebSize(viewportWidth, viewportHeight * 2));
1842 EXPECT_FALSE( 1864 EXPECT_FALSE(
1843 webViewHelper.webView()->mainFrameImpl()->frameView()->needsLayout()); 1865 webViewHelper.webView()->mainFrameImpl()->frameView()->needsLayout());
1844 EXPECT_EQ(0, webViewHelper.webView() 1866 EXPECT_EQ(0,
1845 ->mainFrameImpl() 1867 webViewHelper.webView()
1846 ->frameView() 1868 ->mainFrameImpl()
1847 ->layoutSize() 1869 ->frameView()
1848 .height()); 1870 ->layoutSize()
1871 .height());
1849 1872
1850 webViewHelper.resize(WebSize(viewportWidth * 2, viewportHeight)); 1873 webViewHelper.resize(WebSize(viewportWidth * 2, viewportHeight));
1851 EXPECT_EQ(0, webViewHelper.webView() 1874 EXPECT_EQ(0,
1852 ->mainFrameImpl() 1875 webViewHelper.webView()
1853 ->frameView() 1876 ->mainFrameImpl()
1854 ->layoutSize() 1877 ->frameView()
1855 .height()); 1878 ->layoutSize()
1879 .height());
1856 1880
1857 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(false); 1881 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(false);
1858 EXPECT_LE(viewportHeight, webViewHelper.webView() 1882 EXPECT_LE(viewportHeight,
1859 ->mainFrameImpl() 1883 webViewHelper.webView()
1860 ->frameView() 1884 ->mainFrameImpl()
1861 ->layoutSize() 1885 ->frameView()
1862 .height()); 1886 ->layoutSize()
1887 .height());
1863 } 1888 }
1864 1889
1865 TEST_F(WebFrameTest, ToggleViewportMetaOnOff) { 1890 TEST_F(WebFrameTest, ToggleViewportMetaOnOff) {
1866 registerMockedHttpURLLoad("viewport-device-width.html"); 1891 registerMockedHttpURLLoad("viewport-device-width.html");
1867 1892
1868 FixedLayoutTestWebViewClient client; 1893 FixedLayoutTestWebViewClient client;
1869 client.m_screenInfo.deviceScaleFactor = 1; 1894 client.m_screenInfo.deviceScaleFactor = 1;
1870 int viewportWidth = 640; 1895 int viewportWidth = 640;
1871 int viewportHeight = 480; 1896 int viewportHeight = 480;
1872 1897
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1958 WebLocalFrameImpl* localFrame = FrameTestHelpers::createLocalChild( 1983 WebLocalFrameImpl* localFrame = FrameTestHelpers::createLocalChild(
1959 root, "frameName", nullptr, nullptr, nullptr, properties); 1984 root, "frameName", nullptr, nullptr, nullptr, properties);
1960 1985
1961 registerMockedHttpURLLoad("frame_owner_properties.html"); 1986 registerMockedHttpURLLoad("frame_owner_properties.html");
1962 FrameTestHelpers::loadFrame(localFrame, 1987 FrameTestHelpers::loadFrame(localFrame,
1963 m_baseURL + "frame_owner_properties.html"); 1988 m_baseURL + "frame_owner_properties.html");
1964 1989
1965 // Check if the LocalFrame has seen the marginwidth and marginheight 1990 // Check if the LocalFrame has seen the marginwidth and marginheight
1966 // properties. 1991 // properties.
1967 Document* childDocument = localFrame->frame()->document(); 1992 Document* childDocument = localFrame->frame()->document();
1968 EXPECT_EQ(11, childDocument->firstBodyElement()->getIntegralAttribute( 1993 EXPECT_EQ(11,
1969 HTMLNames::marginwidthAttr)); 1994 childDocument->firstBodyElement()->getIntegralAttribute(
1970 EXPECT_EQ(22, childDocument->firstBodyElement()->getIntegralAttribute( 1995 HTMLNames::marginwidthAttr));
1971 HTMLNames::marginheightAttr)); 1996 EXPECT_EQ(22,
1997 childDocument->firstBodyElement()->getIntegralAttribute(
1998 HTMLNames::marginheightAttr));
1972 1999
1973 FrameView* frameView = localFrame->frameView(); 2000 FrameView* frameView = localFrame->frameView();
1974 // Expect scrollbars to be enabled by default. 2001 // Expect scrollbars to be enabled by default.
1975 EXPECT_NE(nullptr, frameView->horizontalScrollbar()); 2002 EXPECT_NE(nullptr, frameView->horizontalScrollbar());
1976 EXPECT_NE(nullptr, frameView->verticalScrollbar()); 2003 EXPECT_NE(nullptr, frameView->verticalScrollbar());
1977 2004
1978 view->close(); 2005 view->close();
1979 } 2006 }
1980 2007
1981 TEST_F(WebFrameTest, FrameOwnerPropertiesScrolling) { 2008 TEST_F(WebFrameTest, FrameOwnerPropertiesScrolling) {
1982 FrameTestHelpers::TestWebViewClient viewClient; 2009 FrameTestHelpers::TestWebViewClient viewClient;
1983 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 2010 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
1984 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible); 2011 WebView* view = WebView::create(&viewClient, WebPageVisibilityStateVisible);
1985 view->settings()->setJavaScriptEnabled(true); 2012 view->settings()->setJavaScriptEnabled(true);
1986 view->setMainFrame(remoteClient.frame()); 2013 view->setMainFrame(remoteClient.frame());
1987 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame(); 2014 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame();
1988 root->setReplicatedOrigin(SecurityOrigin::createUnique()); 2015 root->setReplicatedOrigin(SecurityOrigin::createUnique());
1989 2016
1990 WebFrameOwnerProperties properties; 2017 WebFrameOwnerProperties properties;
1991 // Turn off scrolling in the subframe. 2018 // Turn off scrolling in the subframe.
1992 properties.scrollingMode = WebFrameOwnerProperties::ScrollingMode::AlwaysOff; 2019 properties.scrollingMode = WebFrameOwnerProperties::ScrollingMode::AlwaysOff;
1993 WebLocalFrameImpl* localFrame = FrameTestHelpers::createLocalChild( 2020 WebLocalFrameImpl* localFrame = FrameTestHelpers::createLocalChild(
1994 root, "frameName", nullptr, nullptr, nullptr, properties); 2021 root, "frameName", nullptr, nullptr, nullptr, properties);
1995 2022
1996 registerMockedHttpURLLoad("frame_owner_properties.html"); 2023 registerMockedHttpURLLoad("frame_owner_properties.html");
1997 FrameTestHelpers::loadFrame(localFrame, 2024 FrameTestHelpers::loadFrame(localFrame,
1998 m_baseURL + "frame_owner_properties.html"); 2025 m_baseURL + "frame_owner_properties.html");
1999 2026
2000 Document* childDocument = localFrame->frame()->document(); 2027 Document* childDocument = localFrame->frame()->document();
2001 EXPECT_EQ(0, childDocument->firstBodyElement()->getIntegralAttribute( 2028 EXPECT_EQ(0,
2002 HTMLNames::marginwidthAttr)); 2029 childDocument->firstBodyElement()->getIntegralAttribute(
2003 EXPECT_EQ(0, childDocument->firstBodyElement()->getIntegralAttribute( 2030 HTMLNames::marginwidthAttr));
2004 HTMLNames::marginheightAttr)); 2031 EXPECT_EQ(0,
2032 childDocument->firstBodyElement()->getIntegralAttribute(
2033 HTMLNames::marginheightAttr));
2005 2034
2006 FrameView* frameView = 2035 FrameView* frameView =
2007 static_cast<WebLocalFrameImpl*>(localFrame)->frameView(); 2036 static_cast<WebLocalFrameImpl*>(localFrame)->frameView();
2008 EXPECT_EQ(nullptr, frameView->horizontalScrollbar()); 2037 EXPECT_EQ(nullptr, frameView->horizontalScrollbar());
2009 EXPECT_EQ(nullptr, frameView->verticalScrollbar()); 2038 EXPECT_EQ(nullptr, frameView->verticalScrollbar());
2010 2039
2011 view->close(); 2040 view->close();
2012 } 2041 }
2013 2042
2014 TEST_P(ParameterizedWebFrameTest, 2043 TEST_P(ParameterizedWebFrameTest,
(...skipping 10 matching lines...) Expand all
2025 2054
2026 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, nullptr, 2055 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, nullptr,
2027 &client, nullptr, enableViewportSettings); 2056 &client, nullptr, enableViewportSettings);
2028 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); 2057 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true);
2029 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2058 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2030 2059
2031 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), 2060 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(),
2032 m_baseURL + "large-div.html"); 2061 m_baseURL + "large-div.html");
2033 webViewHelper.webView()->updateAllLifecyclePhases(); 2062 webViewHelper.webView()->updateAllLifecyclePhases();
2034 2063
2035 EXPECT_EQ(0, webViewHelper.webView() 2064 EXPECT_EQ(0,
2036 ->mainFrameImpl() 2065 webViewHelper.webView()
2037 ->frameView() 2066 ->mainFrameImpl()
2038 ->layoutSize() 2067 ->frameView()
2039 .height()); 2068 ->layoutSize()
2069 .height());
2040 } 2070 }
2041 2071
2042 TEST_P(ParameterizedWebFrameTest, 2072 TEST_P(ParameterizedWebFrameTest,
2043 SetForceZeroLayoutHeightWithWideViewportQuirk) { 2073 SetForceZeroLayoutHeightWithWideViewportQuirk) {
2044 registerMockedHttpURLLoad("200-by-300.html"); 2074 registerMockedHttpURLLoad("200-by-300.html");
2045 2075
2046 FixedLayoutTestWebViewClient client; 2076 FixedLayoutTestWebViewClient client;
2047 client.m_screenInfo.deviceScaleFactor = 1; 2077 client.m_screenInfo.deviceScaleFactor = 1;
2048 int viewportWidth = 640; 2078 int viewportWidth = 640;
2049 int viewportHeight = 480; 2079 int viewportHeight = 480;
2050 2080
2051 FrameTestHelpers::WebViewHelper webViewHelper; 2081 FrameTestHelpers::WebViewHelper webViewHelper;
2052 2082
2053 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, nullptr, 2083 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, nullptr,
2054 &client, nullptr, enableViewportSettings); 2084 &client, nullptr, enableViewportSettings);
2055 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 2085 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
2056 webViewHelper.webView()->settings()->setUseWideViewport(true); 2086 webViewHelper.webView()->settings()->setUseWideViewport(true);
2057 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); 2087 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true);
2058 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2088 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2059 2089
2060 EXPECT_EQ(0, webViewHelper.webView() 2090 EXPECT_EQ(0,
2061 ->mainFrameImpl() 2091 webViewHelper.webView()
2062 ->frameView() 2092 ->mainFrameImpl()
2063 ->layoutSize() 2093 ->frameView()
2064 .height()); 2094 ->layoutSize()
2095 .height());
2065 } 2096 }
2066 2097
2067 TEST_P(ParameterizedWebFrameTest, WideViewportAndWideContentWithInitialScale) { 2098 TEST_P(ParameterizedWebFrameTest, WideViewportAndWideContentWithInitialScale) {
2068 registerMockedHttpURLLoad("wide_document_width_viewport.html"); 2099 registerMockedHttpURLLoad("wide_document_width_viewport.html");
2069 registerMockedHttpURLLoad("white-1x1.png"); 2100 registerMockedHttpURLLoad("white-1x1.png");
2070 2101
2071 FixedLayoutTestWebViewClient client; 2102 FixedLayoutTestWebViewClient client;
2072 client.m_screenInfo.deviceScaleFactor = 1; 2103 client.m_screenInfo.deviceScaleFactor = 1;
2073 int viewportWidth = 600; 2104 int viewportWidth = 600;
2074 int viewportHeight = 800; 2105 int viewportHeight = 800;
(...skipping 30 matching lines...) Expand all
2105 nullptr, enableViewportSettings); 2136 nullptr, enableViewportSettings);
2106 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 2137 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
2107 webViewHelper.webView()->settings()->setUseWideViewport(false); 2138 webViewHelper.webView()->settings()->setUseWideViewport(false);
2108 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); 2139 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true);
2109 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2140 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2110 2141
2111 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), 2142 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(),
2112 m_baseURL + "viewport-height-1000.html"); 2143 m_baseURL + "viewport-height-1000.html");
2113 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2144 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2114 2145
2115 EXPECT_EQ(800, webViewHelper.webView() 2146 EXPECT_EQ(800,
2116 ->mainFrameImpl() 2147 webViewHelper.webView()
2117 ->frameView() 2148 ->mainFrameImpl()
2118 ->layoutSize() 2149 ->frameView()
2119 .height()); 2150 ->layoutSize()
2151 .height());
2120 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); 2152 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor());
2121 } 2153 }
2122 2154
2123 TEST_P(ParameterizedWebFrameTest, LayoutSize320Quirk) { 2155 TEST_P(ParameterizedWebFrameTest, LayoutSize320Quirk) {
2124 registerMockedHttpURLLoad("viewport/viewport-30.html"); 2156 registerMockedHttpURLLoad("viewport/viewport-30.html");
2125 2157
2126 FixedLayoutTestWebViewClient client; 2158 FixedLayoutTestWebViewClient client;
2127 client.m_screenInfo.deviceScaleFactor = 1; 2159 client.m_screenInfo.deviceScaleFactor = 1;
2128 int viewportWidth = 600; 2160 int viewportWidth = 600;
2129 int viewportHeight = 800; 2161 int viewportHeight = 800;
2130 2162
2131 FrameTestHelpers::WebViewHelper webViewHelper; 2163 FrameTestHelpers::WebViewHelper webViewHelper;
2132 webViewHelper.initializeAndLoad("about:blank", true, nullptr, &client, 2164 webViewHelper.initializeAndLoad("about:blank", true, nullptr, &client,
2133 nullptr, enableViewportSettings); 2165 nullptr, enableViewportSettings);
2134 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 2166 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
2135 webViewHelper.webView()->settings()->setUseWideViewport(true); 2167 webViewHelper.webView()->settings()->setUseWideViewport(true);
2136 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); 2168 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true);
2137 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2169 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2138 2170
2139 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), 2171 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(),
2140 m_baseURL + "viewport/viewport-30.html"); 2172 m_baseURL + "viewport/viewport-30.html");
2141 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2173 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2142 2174
2143 EXPECT_EQ(600, webViewHelper.webView() 2175 EXPECT_EQ(600,
2144 ->mainFrameImpl() 2176 webViewHelper.webView()
2145 ->frameView() 2177 ->mainFrameImpl()
2146 ->layoutSize() 2178 ->frameView()
2147 .width()); 2179 ->layoutSize()
2148 EXPECT_EQ(800, webViewHelper.webView() 2180 .width());
2149 ->mainFrameImpl() 2181 EXPECT_EQ(800,
2150 ->frameView() 2182 webViewHelper.webView()
2151 ->layoutSize() 2183 ->mainFrameImpl()
2152 .height()); 2184 ->frameView()
2185 ->layoutSize()
2186 .height());
2153 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); 2187 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor());
2154 2188
2155 // The magic number to snap to device-width is 320, so test that 321 is 2189 // The magic number to snap to device-width is 320, so test that 321 is
2156 // respected. 2190 // respected.
2157 Document* document = 2191 Document* document =
2158 toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document(); 2192 toLocalFrame(webViewHelper.webView()->page()->mainFrame())->document();
2159 ViewportDescription description = document->viewportDescription(); 2193 ViewportDescription description = document->viewportDescription();
2160 description.minWidth = Length(321, blink::Fixed); 2194 description.minWidth = Length(321, blink::Fixed);
2161 description.maxWidth = Length(321, blink::Fixed); 2195 description.maxWidth = Length(321, blink::Fixed);
2162 document->setViewportDescription(description); 2196 document->setViewportDescription(description);
2163 webViewHelper.webView()->updateAllLifecyclePhases(); 2197 webViewHelper.webView()->updateAllLifecyclePhases();
2164 EXPECT_EQ(321, webViewHelper.webView() 2198 EXPECT_EQ(321,
2165 ->mainFrameImpl() 2199 webViewHelper.webView()
2166 ->frameView() 2200 ->mainFrameImpl()
2167 ->layoutSize() 2201 ->frameView()
2168 .width()); 2202 ->layoutSize()
2203 .width());
2169 2204
2170 description.minWidth = Length(320, blink::Fixed); 2205 description.minWidth = Length(320, blink::Fixed);
2171 description.maxWidth = Length(320, blink::Fixed); 2206 description.maxWidth = Length(320, blink::Fixed);
2172 document->setViewportDescription(description); 2207 document->setViewportDescription(description);
2173 webViewHelper.webView()->updateAllLifecyclePhases(); 2208 webViewHelper.webView()->updateAllLifecyclePhases();
2174 EXPECT_EQ(600, webViewHelper.webView() 2209 EXPECT_EQ(600,
2175 ->mainFrameImpl() 2210 webViewHelper.webView()
2176 ->frameView() 2211 ->mainFrameImpl()
2177 ->layoutSize() 2212 ->frameView()
2178 .width()); 2213 ->layoutSize()
2214 .width());
2179 2215
2180 description = document->viewportDescription(); 2216 description = document->viewportDescription();
2181 description.maxHeight = Length(1000, blink::Fixed); 2217 description.maxHeight = Length(1000, blink::Fixed);
2182 document->setViewportDescription(description); 2218 document->setViewportDescription(description);
2183 webViewHelper.webView()->updateAllLifecyclePhases(); 2219 webViewHelper.webView()->updateAllLifecyclePhases();
2184 EXPECT_EQ(1000, webViewHelper.webView() 2220 EXPECT_EQ(1000,
2185 ->mainFrameImpl() 2221 webViewHelper.webView()
2186 ->frameView() 2222 ->mainFrameImpl()
2187 ->layoutSize() 2223 ->frameView()
2188 .height()); 2224 ->layoutSize()
2225 .height());
2189 2226
2190 description.maxHeight = Length(320, blink::Fixed); 2227 description.maxHeight = Length(320, blink::Fixed);
2191 document->setViewportDescription(description); 2228 document->setViewportDescription(description);
2192 webViewHelper.webView()->updateAllLifecyclePhases(); 2229 webViewHelper.webView()->updateAllLifecyclePhases();
2193 EXPECT_EQ(800, webViewHelper.webView() 2230 EXPECT_EQ(800,
2194 ->mainFrameImpl() 2231 webViewHelper.webView()
2195 ->frameView() 2232 ->mainFrameImpl()
2196 ->layoutSize() 2233 ->frameView()
2197 .height()); 2234 ->layoutSize()
2235 .height());
2198 } 2236 }
2199 2237
2200 TEST_P(ParameterizedWebFrameTest, ZeroValuesQuirk) { 2238 TEST_P(ParameterizedWebFrameTest, ZeroValuesQuirk) {
2201 registerMockedHttpURLLoad("viewport-zero-values.html"); 2239 registerMockedHttpURLLoad("viewport-zero-values.html");
2202 2240
2203 FixedLayoutTestWebViewClient client; 2241 FixedLayoutTestWebViewClient client;
2204 client.m_screenInfo.deviceScaleFactor = 1; 2242 client.m_screenInfo.deviceScaleFactor = 1;
2205 int viewportWidth = 640; 2243 int viewportWidth = 640;
2206 int viewportHeight = 480; 2244 int viewportHeight = 480;
2207 2245
2208 FrameTestHelpers::WebViewHelper webViewHelper; 2246 FrameTestHelpers::WebViewHelper webViewHelper;
2209 webViewHelper.initialize(true, nullptr, &client, nullptr, 2247 webViewHelper.initialize(true, nullptr, &client, nullptr,
2210 enableViewportSettings); 2248 enableViewportSettings);
2211 webViewHelper.webView()->settings()->setViewportMetaZeroValuesQuirk(true); 2249 webViewHelper.webView()->settings()->setViewportMetaZeroValuesQuirk(true);
2212 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 2250 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
2213 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true); 2251 webViewHelper.webView()->settings()->setViewportMetaLayoutSizeQuirk(true);
2214 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), 2252 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(),
2215 m_baseURL + "viewport-zero-values.html"); 2253 m_baseURL + "viewport-zero-values.html");
2216 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2254 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2217 2255
2218 EXPECT_EQ(viewportWidth, webViewHelper.webView() 2256 EXPECT_EQ(viewportWidth,
2219 ->mainFrameImpl() 2257 webViewHelper.webView()
2220 ->frameView() 2258 ->mainFrameImpl()
2221 ->layoutSize() 2259 ->frameView()
2222 .width()); 2260 ->layoutSize()
2261 .width());
2223 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); 2262 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor());
2224 2263
2225 webViewHelper.webView()->settings()->setUseWideViewport(true); 2264 webViewHelper.webView()->settings()->setUseWideViewport(true);
2226 webViewHelper.webView()->updateAllLifecyclePhases(); 2265 webViewHelper.webView()->updateAllLifecyclePhases();
2227 EXPECT_EQ(viewportWidth, webViewHelper.webView() 2266 EXPECT_EQ(viewportWidth,
2228 ->mainFrameImpl() 2267 webViewHelper.webView()
2229 ->frameView() 2268 ->mainFrameImpl()
2230 ->layoutSize() 2269 ->frameView()
2231 .width()); 2270 ->layoutSize()
2271 .width());
2232 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor()); 2272 EXPECT_EQ(1.0f, webViewHelper.webView()->pageScaleFactor());
2233 } 2273 }
2234 2274
2235 TEST_P(ParameterizedWebFrameTest, OverflowHiddenDisablesScrolling) { 2275 TEST_P(ParameterizedWebFrameTest, OverflowHiddenDisablesScrolling) {
2236 registerMockedHttpURLLoad("body-overflow-hidden.html"); 2276 registerMockedHttpURLLoad("body-overflow-hidden.html");
2237 2277
2238 FixedLayoutTestWebViewClient client; 2278 FixedLayoutTestWebViewClient client;
2239 client.m_screenInfo.deviceScaleFactor = 1; 2279 client.m_screenInfo.deviceScaleFactor = 1;
2240 int viewportWidth = 640; 2280 int viewportWidth = 640;
2241 int viewportHeight = 480; 2281 int viewportHeight = 480;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2306 2346
2307 FrameTestHelpers::WebViewHelper webViewHelper; 2347 FrameTestHelpers::WebViewHelper webViewHelper;
2308 webViewHelper.initialize(true, nullptr, &client, nullptr, 2348 webViewHelper.initialize(true, nullptr, &client, nullptr,
2309 enableViewportSettings); 2349 enableViewportSettings);
2310 webViewHelper.webView()->settings()->setViewportMetaZeroValuesQuirk(true); 2350 webViewHelper.webView()->settings()->setViewportMetaZeroValuesQuirk(true);
2311 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 2351 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
2312 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), 2352 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(),
2313 m_baseURL + "viewport-nonzero-values.html"); 2353 m_baseURL + "viewport-nonzero-values.html");
2314 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2354 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2315 2355
2316 EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webView() 2356 EXPECT_EQ(viewportWidth / expectedPageScaleFactor,
2317 ->mainFrameImpl() 2357 webViewHelper.webView()
2318 ->frameView() 2358 ->mainFrameImpl()
2319 ->layoutSize() 2359 ->frameView()
2320 .width()); 2360 ->layoutSize()
2361 .width());
2321 EXPECT_EQ(expectedPageScaleFactor, 2362 EXPECT_EQ(expectedPageScaleFactor,
2322 webViewHelper.webView()->pageScaleFactor()); 2363 webViewHelper.webView()->pageScaleFactor());
2323 2364
2324 webViewHelper.webView()->settings()->setUseWideViewport(true); 2365 webViewHelper.webView()->settings()->setUseWideViewport(true);
2325 webViewHelper.webView()->updateAllLifecyclePhases(); 2366 webViewHelper.webView()->updateAllLifecyclePhases();
2326 EXPECT_EQ(viewportWidth / expectedPageScaleFactor, webViewHelper.webView() 2367 EXPECT_EQ(viewportWidth / expectedPageScaleFactor,
2327 ->mainFrameImpl() 2368 webViewHelper.webView()
2328 ->frameView() 2369 ->mainFrameImpl()
2329 ->layoutSize() 2370 ->frameView()
2330 .width()); 2371 ->layoutSize()
2372 .width());
2331 EXPECT_EQ(expectedPageScaleFactor, 2373 EXPECT_EQ(expectedPageScaleFactor,
2332 webViewHelper.webView()->pageScaleFactor()); 2374 webViewHelper.webView()->pageScaleFactor());
2333 } 2375 }
2334 2376
2335 TEST_P(ParameterizedWebFrameTest, setPageScaleFactorDoesNotLayout) { 2377 TEST_P(ParameterizedWebFrameTest, setPageScaleFactorDoesNotLayout) {
2336 registerMockedHttpURLLoad("fixed_layout.html"); 2378 registerMockedHttpURLLoad("fixed_layout.html");
2337 2379
2338 FixedLayoutTestWebViewClient client; 2380 FixedLayoutTestWebViewClient client;
2339 client.m_screenInfo.deviceScaleFactor = 1; 2381 client.m_screenInfo.deviceScaleFactor = 1;
2340 // Small viewport to ensure there are always scrollbars. 2382 // Small viewport to ensure there are always scrollbars.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2390 int viewportWidth = 640; 2432 int viewportWidth = 640;
2391 int viewportHeight = 480; 2433 int viewportHeight = 480;
2392 2434
2393 FrameTestHelpers::WebViewHelper webViewHelper; 2435 FrameTestHelpers::WebViewHelper webViewHelper;
2394 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 2436 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true,
2395 nullptr, &client, nullptr, 2437 nullptr, &client, nullptr,
2396 enableViewportSettings); 2438 enableViewportSettings);
2397 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2439 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2398 2440
2399 webViewHelper.webView()->setPageScaleFactor(3); 2441 webViewHelper.webView()->setPageScaleFactor(3);
2400 EXPECT_EQ(3, toLocalFrame(webViewHelper.webView()->page()->mainFrame()) 2442 EXPECT_EQ(3,
2401 ->loader() 2443 toLocalFrame(webViewHelper.webView()->page()->mainFrame())
2402 .currentItem() 2444 ->loader()
2403 ->pageScaleFactor()); 2445 .currentItem()
2446 ->pageScaleFactor());
2404 } 2447 }
2405 2448
2406 TEST_P(ParameterizedWebFrameTest, initialScaleWrittenToHistoryItem) { 2449 TEST_P(ParameterizedWebFrameTest, initialScaleWrittenToHistoryItem) {
2407 registerMockedHttpURLLoad("fixed_layout.html"); 2450 registerMockedHttpURLLoad("fixed_layout.html");
2408 2451
2409 FixedLayoutTestWebViewClient client; 2452 FixedLayoutTestWebViewClient client;
2410 client.m_screenInfo.deviceScaleFactor = 1; 2453 client.m_screenInfo.deviceScaleFactor = 1;
2411 int viewportWidth = 640; 2454 int viewportWidth = 640;
2412 int viewportHeight = 480; 2455 int viewportHeight = 480;
2413 2456
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2479 int viewportHeight = 480; 2522 int viewportHeight = 480;
2480 2523
2481 FrameTestHelpers::WebViewHelper webViewHelper; 2524 FrameTestHelpers::WebViewHelper webViewHelper;
2482 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true, 2525 webViewHelper.initializeAndLoad(m_baseURL + "fixed_layout.html", true,
2483 nullptr, &client, nullptr, 2526 nullptr, &client, nullptr,
2484 enableViewportSettings); 2527 enableViewportSettings);
2485 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2528 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2486 2529
2487 webViewHelper.webView()->setPageScaleFactor(2); 2530 webViewHelper.webView()->setPageScaleFactor(2);
2488 2531
2489 EXPECT_EQ(980, toLocalFrame(webViewHelper.webView()->page()->mainFrame()) 2532 EXPECT_EQ(980,
2490 ->contentLayoutItem() 2533 toLocalFrame(webViewHelper.webView()->page()->mainFrame())
2491 .documentRect() 2534 ->contentLayoutItem()
2492 .width()); 2535 .documentRect()
2493 EXPECT_EQ(980, webViewHelper.webView() 2536 .width());
2494 ->mainFrameImpl() 2537 EXPECT_EQ(980,
2495 ->frameView() 2538 webViewHelper.webView()
2496 ->contentsSize() 2539 ->mainFrameImpl()
2497 .width()); 2540 ->frameView()
2541 ->contentsSize()
2542 .width());
2498 } 2543 }
2499 2544
2500 TEST_P(ParameterizedWebFrameTest, targetDensityDpiHigh) { 2545 TEST_P(ParameterizedWebFrameTest, targetDensityDpiHigh) {
2501 registerMockedHttpURLLoad("viewport-target-densitydpi-high.html"); 2546 registerMockedHttpURLLoad("viewport-target-densitydpi-high.html");
2502 2547
2503 FixedLayoutTestWebViewClient client; 2548 FixedLayoutTestWebViewClient client;
2504 // high-dpi = 240 2549 // high-dpi = 240
2505 float targetDpi = 240.0f; 2550 float targetDpi = 240.0f;
2506 float deviceScaleFactors[] = {1.0f, 4.0f / 3.0f, 2.0f}; 2551 float deviceScaleFactors[] = {1.0f, 4.0f / 3.0f, 2.0f};
2507 int viewportWidth = 640; 2552 int viewportWidth = 640;
2508 int viewportHeight = 480; 2553 int viewportHeight = 480;
2509 2554
2510 for (size_t i = 0; i < WTF_ARRAY_LENGTH(deviceScaleFactors); ++i) { 2555 for (size_t i = 0; i < WTF_ARRAY_LENGTH(deviceScaleFactors); ++i) {
2511 float deviceScaleFactor = deviceScaleFactors[i]; 2556 float deviceScaleFactor = deviceScaleFactors[i];
2512 float deviceDpi = deviceScaleFactor * 160.0f; 2557 float deviceDpi = deviceScaleFactor * 160.0f;
2513 client.m_screenInfo.deviceScaleFactor = deviceScaleFactor; 2558 client.m_screenInfo.deviceScaleFactor = deviceScaleFactor;
2514 2559
2515 FrameTestHelpers::WebViewHelper webViewHelper; 2560 FrameTestHelpers::WebViewHelper webViewHelper;
2516 webViewHelper.initializeAndLoad( 2561 webViewHelper.initializeAndLoad(
2517 m_baseURL + "viewport-target-densitydpi-high.html", true, nullptr, 2562 m_baseURL + "viewport-target-densitydpi-high.html", true, nullptr,
2518 &client, nullptr, enableViewportSettings); 2563 &client, nullptr, enableViewportSettings);
2519 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 2564 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
2520 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI( 2565 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(
2521 true); 2566 true);
2522 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2567 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2523 2568
2524 // We need to account for the fact that logical pixels are unconditionally 2569 // We need to account for the fact that logical pixels are unconditionally
2525 // multiplied by deviceScaleFactor to produce physical pixels. 2570 // multiplied by deviceScaleFactor to produce physical pixels.
2526 float densityDpiScaleRatio = deviceScaleFactor * targetDpi / deviceDpi; 2571 float densityDpiScaleRatio = deviceScaleFactor * targetDpi / deviceDpi;
2527 EXPECT_NEAR(viewportWidth * densityDpiScaleRatio, webViewHelper.webView() 2572 EXPECT_NEAR(viewportWidth * densityDpiScaleRatio,
2528 ->mainFrameImpl() 2573 webViewHelper.webView()
2529 ->frameView() 2574 ->mainFrameImpl()
2530 ->layoutSize() 2575 ->frameView()
2531 .width(), 2576 ->layoutSize()
2577 .width(),
2532 1.0f); 2578 1.0f);
2533 EXPECT_NEAR(viewportHeight * densityDpiScaleRatio, webViewHelper.webView() 2579 EXPECT_NEAR(viewportHeight * densityDpiScaleRatio,
2534 ->mainFrameImpl() 2580 webViewHelper.webView()
2535 ->frameView() 2581 ->mainFrameImpl()
2536 ->layoutSize() 2582 ->frameView()
2537 .height(), 2583 ->layoutSize()
2584 .height(),
2538 1.0f); 2585 1.0f);
2539 EXPECT_NEAR(1.0f / densityDpiScaleRatio, 2586 EXPECT_NEAR(1.0f / densityDpiScaleRatio,
2540 webViewHelper.webView()->pageScaleFactor(), 0.01f); 2587 webViewHelper.webView()->pageScaleFactor(), 0.01f);
2541 } 2588 }
2542 } 2589 }
2543 2590
2544 TEST_P(ParameterizedWebFrameTest, targetDensityDpiDevice) { 2591 TEST_P(ParameterizedWebFrameTest, targetDensityDpiDevice) {
2545 registerMockedHttpURLLoad("viewport-target-densitydpi-device.html"); 2592 registerMockedHttpURLLoad("viewport-target-densitydpi-device.html");
2546 2593
2547 float deviceScaleFactors[] = {1.0f, 4.0f / 3.0f, 2.0f}; 2594 float deviceScaleFactors[] = {1.0f, 4.0f / 3.0f, 2.0f};
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2597 FrameTestHelpers::WebViewHelper webViewHelper; 2644 FrameTestHelpers::WebViewHelper webViewHelper;
2598 webViewHelper.initializeAndLoad( 2645 webViewHelper.initializeAndLoad(
2599 m_baseURL + "viewport-target-densitydpi-device-and-fixed-width.html", 2646 m_baseURL + "viewport-target-densitydpi-device-and-fixed-width.html",
2600 true, nullptr, &client, nullptr, enableViewportSettings); 2647 true, nullptr, &client, nullptr, enableViewportSettings);
2601 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 2648 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
2602 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI( 2649 webViewHelper.webView()->settings()->setSupportDeprecatedTargetDensityDPI(
2603 true); 2650 true);
2604 webViewHelper.webView()->settings()->setUseWideViewport(true); 2651 webViewHelper.webView()->settings()->setUseWideViewport(true);
2605 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2652 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2606 2653
2607 EXPECT_NEAR(viewportWidth, webViewHelper.webView() 2654 EXPECT_NEAR(viewportWidth,
2608 ->mainFrameImpl() 2655 webViewHelper.webView()
2609 ->frameView() 2656 ->mainFrameImpl()
2610 ->layoutSize() 2657 ->frameView()
2611 .width(), 2658 ->layoutSize()
2659 .width(),
2612 1.0f); 2660 1.0f);
2613 EXPECT_NEAR(viewportHeight, webViewHelper.webView() 2661 EXPECT_NEAR(viewportHeight,
2614 ->mainFrameImpl() 2662 webViewHelper.webView()
2615 ->frameView() 2663 ->mainFrameImpl()
2616 ->layoutSize() 2664 ->frameView()
2617 .height(), 2665 ->layoutSize()
2666 .height(),
2618 1.0f); 2667 1.0f);
2619 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); 2668 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f);
2620 } 2669 }
2621 } 2670 }
2622 2671
2623 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndScaleLessThanOne) { 2672 TEST_P(ParameterizedWebFrameTest, NoWideViewportAndScaleLessThanOne) {
2624 registerMockedHttpURLLoad("viewport-initial-scale-less-than-1.html"); 2673 registerMockedHttpURLLoad("viewport-initial-scale-less-than-1.html");
2625 2674
2626 FixedLayoutTestWebViewClient client; 2675 FixedLayoutTestWebViewClient client;
2627 client.m_screenInfo.deviceScaleFactor = 1.33f; 2676 client.m_screenInfo.deviceScaleFactor = 1.33f;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2706 2755
2707 FrameTestHelpers::WebViewHelper webViewHelper; 2756 FrameTestHelpers::WebViewHelper webViewHelper;
2708 webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, nullptr, 2757 webViewHelper.initializeAndLoad(m_baseURL + "large-div.html", true, nullptr,
2709 &client, nullptr, enableViewportSettings); 2758 &client, nullptr, enableViewportSettings);
2710 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5); 2759 webViewHelper.webView()->setDefaultPageScaleLimits(0.25f, 5);
2711 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 2760 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
2712 webViewHelper.webView()->settings()->setUseWideViewport(false); 2761 webViewHelper.webView()->settings()->setUseWideViewport(false);
2713 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor); 2762 webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor);
2714 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2763 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2715 2764
2716 EXPECT_NEAR(viewportWidth / enforcedPageScaleFactor, webViewHelper.webView() 2765 EXPECT_NEAR(viewportWidth / enforcedPageScaleFactor,
2717 ->mainFrameImpl() 2766 webViewHelper.webView()
2718 ->frameView() 2767 ->mainFrameImpl()
2719 ->layoutSize() 2768 ->frameView()
2720 .width(), 2769 ->layoutSize()
2770 .width(),
2721 1.0f); 2771 1.0f);
2722 EXPECT_NEAR(viewportHeight / enforcedPageScaleFactor, webViewHelper.webView() 2772 EXPECT_NEAR(viewportHeight / enforcedPageScaleFactor,
2723 ->mainFrameImpl() 2773 webViewHelper.webView()
2724 ->frameView() 2774 ->mainFrameImpl()
2725 ->layoutSize() 2775 ->frameView()
2726 .height(), 2776 ->layoutSize()
2777 .height(),
2727 1.0f); 2778 1.0f);
2728 EXPECT_NEAR(enforcedPageScaleFactor, 2779 EXPECT_NEAR(enforcedPageScaleFactor,
2729 webViewHelper.webView()->pageScaleFactor(), 0.01f); 2780 webViewHelper.webView()->pageScaleFactor(), 0.01f);
2730 } 2781 }
2731 2782
2732 TEST_P(ParameterizedWebFrameTest, NoUserScalableQuirkIgnoresViewportScale) { 2783 TEST_P(ParameterizedWebFrameTest, NoUserScalableQuirkIgnoresViewportScale) {
2733 registerMockedHttpURLLoad("viewport-initial-scale-and-user-scalable-no.html"); 2784 registerMockedHttpURLLoad("viewport-initial-scale-and-user-scalable-no.html");
2734 2785
2735 FixedLayoutTestWebViewClient client; 2786 FixedLayoutTestWebViewClient client;
2736 int viewportWidth = 640; 2787 int viewportWidth = 640;
2737 int viewportHeight = 480; 2788 int viewportHeight = 480;
2738 2789
2739 FrameTestHelpers::WebViewHelper webViewHelper; 2790 FrameTestHelpers::WebViewHelper webViewHelper;
2740 webViewHelper.initializeAndLoad( 2791 webViewHelper.initializeAndLoad(
2741 m_baseURL + "viewport-initial-scale-and-user-scalable-no.html", true, 2792 m_baseURL + "viewport-initial-scale-and-user-scalable-no.html", true,
2742 nullptr, &client, nullptr, enableViewportSettings); 2793 nullptr, &client, nullptr, enableViewportSettings);
2743 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk( 2794 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(
2744 true); 2795 true);
2745 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2796 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2746 2797
2747 EXPECT_NEAR(viewportWidth, webViewHelper.webView() 2798 EXPECT_NEAR(viewportWidth,
2748 ->mainFrameImpl() 2799 webViewHelper.webView()
2749 ->frameView() 2800 ->mainFrameImpl()
2750 ->layoutSize() 2801 ->frameView()
2751 .width(), 2802 ->layoutSize()
2803 .width(),
2752 1.0f); 2804 1.0f);
2753 EXPECT_NEAR(viewportHeight, webViewHelper.webView() 2805 EXPECT_NEAR(viewportHeight,
2754 ->mainFrameImpl() 2806 webViewHelper.webView()
2755 ->frameView() 2807 ->mainFrameImpl()
2756 ->layoutSize() 2808 ->frameView()
2757 .height(), 2809 ->layoutSize()
2810 .height(),
2758 1.0f); 2811 1.0f);
2759 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); 2812 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f);
2760 } 2813 }
2761 2814
2762 TEST_P(ParameterizedWebFrameTest, 2815 TEST_P(ParameterizedWebFrameTest,
2763 NoUserScalableQuirkIgnoresViewportScaleForNonWideViewport) { 2816 NoUserScalableQuirkIgnoresViewportScaleForNonWideViewport) {
2764 registerMockedHttpURLLoad("viewport-initial-scale-and-user-scalable-no.html"); 2817 registerMockedHttpURLLoad("viewport-initial-scale-and-user-scalable-no.html");
2765 2818
2766 FixedLayoutTestWebViewClient client; 2819 FixedLayoutTestWebViewClient client;
2767 client.m_screenInfo.deviceScaleFactor = 1.33f; 2820 client.m_screenInfo.deviceScaleFactor = 1.33f;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2809 FrameTestHelpers::WebViewHelper webViewHelper; 2862 FrameTestHelpers::WebViewHelper webViewHelper;
2810 webViewHelper.initializeAndLoad( 2863 webViewHelper.initializeAndLoad(
2811 m_baseURL + "viewport-2x-initial-scale-non-user-scalable.html", true, 2864 m_baseURL + "viewport-2x-initial-scale-non-user-scalable.html", true,
2812 nullptr, &client, nullptr, enableViewportSettings); 2865 nullptr, &client, nullptr, enableViewportSettings);
2813 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk( 2866 webViewHelper.webView()->settings()->setViewportMetaNonUserScalableQuirk(
2814 true); 2867 true);
2815 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true); 2868 webViewHelper.webView()->settings()->setWideViewportQuirkEnabled(true);
2816 webViewHelper.webView()->settings()->setUseWideViewport(true); 2869 webViewHelper.webView()->settings()->setUseWideViewport(true);
2817 webViewHelper.resize(WebSize(viewportWidth, viewportHeight)); 2870 webViewHelper.resize(WebSize(viewportWidth, viewportHeight));
2818 2871
2819 EXPECT_NEAR(viewportWidth, webViewHelper.webView() 2872 EXPECT_NEAR(viewportWidth,
2820 ->mainFrameImpl() 2873 webViewHelper.webView()
2821 ->frameView() 2874 ->mainFrameImpl()
2822 ->layoutSize() 2875 ->frameView()
2823 .width(), 2876 ->layoutSize()
2877 .width(),
2824 1.0f); 2878 1.0f);
2825 EXPECT_NEAR(viewportHeight, webViewHelper.webView() 2879 EXPECT_NEAR(viewportHeight,
2826 ->mainFrameImpl() 2880 webViewHelper.webView()
2827 ->frameView() 2881 ->mainFrameImpl()
2828 ->layoutSize() 2882 ->frameView()
2829 .height(), 2883 ->layoutSize()
2884 .height(),
2830 1.0f); 2885 1.0f);
2831 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f); 2886 EXPECT_NEAR(1.0f, webViewHelper.webView()->pageScaleFactor(), 0.01f);
2832 } 2887 }
2833 2888
2834 TEST_P(ParameterizedWebFrameTest, 2889 TEST_P(ParameterizedWebFrameTest,
2835 DesktopPageCanBeZoomedInWhenWideViewportIsTurnedOff) { 2890 DesktopPageCanBeZoomedInWhenWideViewportIsTurnedOff) {
2836 registerMockedHttpURLLoad("no_viewport_tag.html"); 2891 registerMockedHttpURLLoad("no_viewport_tag.html");
2837 2892
2838 FixedLayoutTestWebViewClient client; 2893 FixedLayoutTestWebViewClient client;
2839 int viewportWidth = 640; 2894 int viewportWidth = 640;
(...skipping 16 matching lines...) Expand all
2856 TEST_P(ParameterizedWebFrameTest, AtViewportInsideAtMediaInitialViewport) { 2911 TEST_P(ParameterizedWebFrameTest, AtViewportInsideAtMediaInitialViewport) {
2857 registerMockedHttpURLLoad("viewport-inside-media.html"); 2912 registerMockedHttpURLLoad("viewport-inside-media.html");
2858 2913
2859 FixedLayoutTestWebViewClient client; 2914 FixedLayoutTestWebViewClient client;
2860 FrameTestHelpers::WebViewHelper webViewHelper; 2915 FrameTestHelpers::WebViewHelper webViewHelper;
2861 webViewHelper.initializeAndLoad(m_baseURL + "viewport-inside-media.html", 2916 webViewHelper.initializeAndLoad(m_baseURL + "viewport-inside-media.html",
2862 true, nullptr, &client, nullptr, 2917 true, nullptr, &client, nullptr,
2863 enableViewportSettings); 2918 enableViewportSettings);
2864 webViewHelper.resize(WebSize(640, 480)); 2919 webViewHelper.resize(WebSize(640, 480));
2865 2920
2866 EXPECT_EQ(2000, webViewHelper.webView() 2921 EXPECT_EQ(2000,
2867 ->mainFrameImpl() 2922 webViewHelper.webView()
2868 ->frameView() 2923 ->mainFrameImpl()
2869 ->layoutSize() 2924 ->frameView()
2870 .width()); 2925 ->layoutSize()
2926 .width());
2871 2927
2872 webViewHelper.resize(WebSize(1200, 480)); 2928 webViewHelper.resize(WebSize(1200, 480));
2873 2929
2874 EXPECT_EQ(1200, webViewHelper.webView() 2930 EXPECT_EQ(1200,
2875 ->mainFrameImpl() 2931 webViewHelper.webView()
2876 ->frameView() 2932 ->mainFrameImpl()
2877 ->layoutSize() 2933 ->frameView()
2878 .width()); 2934 ->layoutSize()
2935 .width());
2879 } 2936 }
2880 2937
2881 TEST_P(ParameterizedWebFrameTest, AtViewportAffectingAtMediaRecalcCount) { 2938 TEST_P(ParameterizedWebFrameTest, AtViewportAffectingAtMediaRecalcCount) {
2882 registerMockedHttpURLLoad("viewport-and-media.html"); 2939 registerMockedHttpURLLoad("viewport-and-media.html");
2883 2940
2884 FixedLayoutTestWebViewClient client; 2941 FixedLayoutTestWebViewClient client;
2885 FrameTestHelpers::WebViewHelper webViewHelper; 2942 FrameTestHelpers::WebViewHelper webViewHelper;
2886 webViewHelper.initialize(true, nullptr, &client, nullptr, 2943 webViewHelper.initialize(true, nullptr, &client, nullptr,
2887 enableViewportSettings); 2944 enableViewportSettings);
2888 webViewHelper.resize(WebSize(640, 480)); 2945 webViewHelper.resize(WebSize(640, 480));
2889 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), 2946 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(),
2890 m_baseURL + "viewport-and-media.html"); 2947 m_baseURL + "viewport-and-media.html");
2891 2948
2892 Document* document = 2949 Document* document =
2893 webViewHelper.webView()->mainFrameImpl()->frame()->document(); 2950 webViewHelper.webView()->mainFrameImpl()->frame()->document();
2894 EXPECT_EQ(2000, webViewHelper.webView() 2951 EXPECT_EQ(2000,
2895 ->mainFrameImpl() 2952 webViewHelper.webView()
2896 ->frameView() 2953 ->mainFrameImpl()
2897 ->layoutSize() 2954 ->frameView()
2898 .width()); 2955 ->layoutSize()
2956 .width());
2899 2957
2900 // The styleForElementCount() should match the number of elements for a single 2958 // The styleForElementCount() should match the number of elements for a single
2901 // pass of computed styles construction for the document. 2959 // pass of computed styles construction for the document.
2902 EXPECT_EQ(10u, document->styleEngine().styleForElementCount()); 2960 EXPECT_EQ(10u, document->styleEngine().styleForElementCount());
2903 EXPECT_EQ(Color(0, 128, 0), 2961 EXPECT_EQ(Color(0, 128, 0),
2904 document->body()->computedStyle()->visitedDependentColor( 2962 document->body()->computedStyle()->visitedDependentColor(
2905 CSSPropertyColor)); 2963 CSSPropertyColor));
2906 } 2964 }
2907 2965
2908 TEST_P(ParameterizedWebFrameTest, AtViewportWithViewportLengths) { 2966 TEST_P(ParameterizedWebFrameTest, AtViewportWithViewportLengths) {
(...skipping 3384 matching lines...) Expand 10 before | Expand all | Expand 10 after
6293 document->execCommand("InsertText", false, "_wellcome_.", exceptionState); 6351 document->execCommand("InsertText", false, "_wellcome_.", exceptionState);
6294 EXPECT_FALSE(exceptionState.hadException()); 6352 EXPECT_FALSE(exceptionState.hadException());
6295 6353
6296 const int allTextBeginOffset = 0; 6354 const int allTextBeginOffset = 0;
6297 const int allTextLength = 11; 6355 const int allTextLength = 11;
6298 frame->selectRange(WebRange(allTextBeginOffset, allTextLength)); 6356 frame->selectRange(WebRange(allTextBeginOffset, allTextLength));
6299 EphemeralRange selectionRange = 6357 EphemeralRange selectionRange =
6300 frame->frame()->selection().selection().toNormalizedEphemeralRange(); 6358 frame->frame()->selection().selection().toNormalizedEphemeralRange();
6301 6359
6302 EXPECT_EQ(1, spellcheck.numberOfTimesChecked()); 6360 EXPECT_EQ(1, spellcheck.numberOfTimesChecked());
6303 EXPECT_EQ(1U, document->markers() 6361 EXPECT_EQ(1U,
6304 .markersInRange(selectionRange, DocumentMarker::Spelling) 6362 document->markers()
6305 .size()); 6363 .markersInRange(selectionRange, DocumentMarker::Spelling)
6364 .size());
6306 6365
6307 frame->replaceMisspelledRange("welcome"); 6366 frame->replaceMisspelledRange("welcome");
6308 EXPECT_EQ("_welcome_.", 6367 EXPECT_EQ("_welcome_.",
6309 WebFrameContentDumper::dumpWebViewAsText( 6368 WebFrameContentDumper::dumpWebViewAsText(
6310 webViewHelper.webView(), std::numeric_limits<size_t>::max()) 6369 webViewHelper.webView(), std::numeric_limits<size_t>::max())
6311 .utf8()); 6370 .utf8());
6312 } 6371 }
6313 6372
6314 TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkers) { 6373 TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkers) {
6315 registerMockedHttpURLLoad("spell.html"); 6374 registerMockedHttpURLLoad("spell.html");
(...skipping 15 matching lines...) Expand all
6331 EXPECT_FALSE(exceptionState.hadException()); 6390 EXPECT_FALSE(exceptionState.hadException());
6332 6391
6333 frame->removeSpellingMarkers(); 6392 frame->removeSpellingMarkers();
6334 6393
6335 const int allTextBeginOffset = 0; 6394 const int allTextBeginOffset = 0;
6336 const int allTextLength = 11; 6395 const int allTextLength = 11;
6337 frame->selectRange(WebRange(allTextBeginOffset, allTextLength)); 6396 frame->selectRange(WebRange(allTextBeginOffset, allTextLength));
6338 EphemeralRange selectionRange = 6397 EphemeralRange selectionRange =
6339 frame->frame()->selection().selection().toNormalizedEphemeralRange(); 6398 frame->frame()->selection().selection().toNormalizedEphemeralRange();
6340 6399
6341 EXPECT_EQ(0U, document->markers() 6400 EXPECT_EQ(0U,
6342 .markersInRange(selectionRange, DocumentMarker::Spelling) 6401 document->markers()
6343 .size()); 6402 .markersInRange(selectionRange, DocumentMarker::Spelling)
6403 .size());
6344 } 6404 }
6345 6405
6346 TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkersUnderWords) { 6406 TEST_P(ParameterizedWebFrameTest, RemoveSpellingMarkersUnderWords) {
6347 registerMockedHttpURLLoad("spell.html"); 6407 registerMockedHttpURLLoad("spell.html");
6348 FrameTestHelpers::WebViewHelper webViewHelper; 6408 FrameTestHelpers::WebViewHelper webViewHelper;
6349 webViewHelper.initializeAndLoad(m_baseURL + "spell.html"); 6409 webViewHelper.initializeAndLoad(m_baseURL + "spell.html");
6350 SpellCheckClient spellcheck; 6410 SpellCheckClient spellcheck;
6351 webViewHelper.webView()->setSpellCheckClient(&spellcheck); 6411 webViewHelper.webView()->setSpellCheckClient(&spellcheck);
6352 6412
6353 LocalFrame* frame = webViewHelper.webView()->mainFrameImpl()->frame(); 6413 LocalFrame* frame = webViewHelper.webView()->mainFrameImpl()->frame();
(...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after
7340 TestDidNavigateCommitTypeWebFrameClient client; 7400 TestDidNavigateCommitTypeWebFrameClient client;
7341 FrameTestHelpers::WebViewHelper webViewHelper; 7401 FrameTestHelpers::WebViewHelper webViewHelper;
7342 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad( 7402 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(
7343 m_baseURL + "push_state.html", true, &client); 7403 m_baseURL + "push_state.html", true, &client);
7344 Persistent<HistoryItem> item = 7404 Persistent<HistoryItem> item =
7345 toLocalFrame(webViewImpl->page()->mainFrame())->loader().currentItem(); 7405 toLocalFrame(webViewImpl->page()->mainFrame())->loader().currentItem();
7346 runPendingTasks(); 7406 runPendingTasks();
7347 7407
7348 toLocalFrame(webViewImpl->page()->mainFrame()) 7408 toLocalFrame(webViewImpl->page()->mainFrame())
7349 ->loader() 7409 ->loader()
7350 .load( 7410 .load(FrameLoadRequest(
7351 FrameLoadRequest( 7411 nullptr,
7352 nullptr, FrameLoader::resourceRequestFromHistoryItem( 7412 FrameLoader::resourceRequestFromHistoryItem(
7353 item.get(), WebCachePolicy::UseProtocolCachePolicy)), 7413 item.get(), WebCachePolicy::UseProtocolCachePolicy)),
7354 FrameLoadTypeBackForward, item.get(), HistorySameDocumentLoad); 7414 FrameLoadTypeBackForward, item.get(), HistorySameDocumentLoad);
7355 EXPECT_EQ(WebBackForwardCommit, client.lastCommitType()); 7415 EXPECT_EQ(WebBackForwardCommit, client.lastCommitType());
7356 } 7416 }
7357 7417
7358 class TestHistoryWebFrameClient : public FrameTestHelpers::TestWebFrameClient { 7418 class TestHistoryWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
7359 public: 7419 public:
7360 TestHistoryWebFrameClient() { m_replacesCurrentHistoryItem = false; } 7420 TestHistoryWebFrameClient() { m_replacesCurrentHistoryItem = false; }
7361 7421
7362 void didStartProvisionalLoad(WebDataSource* dataSource) { 7422 void didStartProvisionalLoad(WebDataSource* dataSource) {
7363 m_replacesCurrentHistoryItem = dataSource->replacesCurrentHistoryItem(); 7423 m_replacesCurrentHistoryItem = dataSource->replacesCurrentHistoryItem();
7364 } 7424 }
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after
9098 ASSERT_EQ(mainFrame()->firstChild(), remoteFrame); 9158 ASSERT_EQ(mainFrame()->firstChild(), remoteFrame);
9099 EXPECT_EQ(uniqueName.utf8(), 9159 EXPECT_EQ(uniqueName.utf8(),
9100 WebString(remoteFrame->frame()->tree().uniqueName()).utf8()); 9160 WebString(remoteFrame->frame()->tree().uniqueName()).utf8());
9101 9161
9102 // Swap back to a LocalFrame. 9162 // Swap back to a LocalFrame.
9103 RemoteToLocalSwapWebFrameClient client(remoteFrame); 9163 RemoteToLocalSwapWebFrameClient client(remoteFrame);
9104 WebLocalFrame* localFrame = WebLocalFrame::createProvisional( 9164 WebLocalFrame* localFrame = WebLocalFrame::createProvisional(
9105 &client, nullptr, nullptr, remoteFrame, WebSandboxFlags::None); 9165 &client, nullptr, nullptr, remoteFrame, WebSandboxFlags::None);
9106 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); 9166 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html");
9107 EXPECT_EQ(uniqueName.utf8(), localFrame->uniqueName().utf8()); 9167 EXPECT_EQ(uniqueName.utf8(), localFrame->uniqueName().utf8());
9108 EXPECT_EQ(uniqueName.utf8(), WebString(toWebLocalFrameImpl(localFrame) 9168 EXPECT_EQ(uniqueName.utf8(),
9109 ->frame() 9169 WebString(toWebLocalFrameImpl(localFrame)
9110 ->loader() 9170 ->frame()
9111 .currentItem() 9171 ->loader()
9112 ->target()) 9172 .currentItem()
9113 .utf8()); 9173 ->target())
9174 .utf8());
9114 9175
9115 // Repeat with no name on the frame. 9176 // Repeat with no name on the frame.
9116 // (note that uniqueName is immutable after first real commit). 9177 // (note that uniqueName is immutable after first real commit).
9117 localFrame->setName(""); 9178 localFrame->setName("");
9118 WebString uniqueName2 = localFrame->uniqueName(); 9179 WebString uniqueName2 = localFrame->uniqueName();
9119 EXPECT_EQ("frame1", uniqueName2.utf8()); 9180 EXPECT_EQ("frame1", uniqueName2.utf8());
9120 9181
9121 FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient2; 9182 FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient2;
9122 WebRemoteFrameImpl* remoteFrame2 = WebRemoteFrameImpl::create( 9183 WebRemoteFrameImpl* remoteFrame2 = WebRemoteFrameImpl::create(
9123 WebTreeScopeType::Document, &remoteFrameClient2); 9184 WebTreeScopeType::Document, &remoteFrameClient2);
9124 localFrame->swap(remoteFrame2); 9185 localFrame->swap(remoteFrame2);
9125 ASSERT_TRUE(mainFrame()->firstChild()); 9186 ASSERT_TRUE(mainFrame()->firstChild());
9126 ASSERT_EQ(mainFrame()->firstChild(), remoteFrame2); 9187 ASSERT_EQ(mainFrame()->firstChild(), remoteFrame2);
9127 EXPECT_EQ(uniqueName2.utf8(), 9188 EXPECT_EQ(uniqueName2.utf8(),
9128 WebString(remoteFrame2->frame()->tree().uniqueName()).utf8()); 9189 WebString(remoteFrame2->frame()->tree().uniqueName()).utf8());
9129 9190
9130 RemoteToLocalSwapWebFrameClient client2(remoteFrame2); 9191 RemoteToLocalSwapWebFrameClient client2(remoteFrame2);
9131 WebLocalFrame* localFrame2 = WebLocalFrame::createProvisional( 9192 WebLocalFrame* localFrame2 = WebLocalFrame::createProvisional(
9132 &client2, nullptr, nullptr, remoteFrame2, WebSandboxFlags::None); 9193 &client2, nullptr, nullptr, remoteFrame2, WebSandboxFlags::None);
9133 FrameTestHelpers::loadFrame(localFrame2, m_baseURL + "subframe-hello.html"); 9194 FrameTestHelpers::loadFrame(localFrame2, m_baseURL + "subframe-hello.html");
9134 EXPECT_EQ(uniqueName2.utf8(), localFrame2->uniqueName().utf8()); 9195 EXPECT_EQ(uniqueName2.utf8(), localFrame2->uniqueName().utf8());
9135 EXPECT_EQ(uniqueName2.utf8(), WebString(toWebLocalFrameImpl(localFrame2) 9196 EXPECT_EQ(uniqueName2.utf8(),
9136 ->frame() 9197 WebString(toWebLocalFrameImpl(localFrame2)
9137 ->loader() 9198 ->frame()
9138 .currentItem() 9199 ->loader()
9139 ->target()) 9200 .currentItem()
9140 .utf8()); 9201 ->target())
9202 .utf8());
9141 9203
9142 // Manually reset to break WebViewHelper's dependency on the stack allocated 9204 // Manually reset to break WebViewHelper's dependency on the stack allocated
9143 // TestWebFrameClient. 9205 // TestWebFrameClient.
9144 reset(); 9206 reset();
9145 remoteFrame->close(); 9207 remoteFrame->close();
9146 remoteFrame2->close(); 9208 remoteFrame2->close();
9147 } 9209 }
9148 9210
9149 class RemoteNavigationClient 9211 class RemoteNavigationClient
9150 : public FrameTestHelpers::TestWebRemoteFrameClient { 9212 : public FrameTestHelpers::TestWebRemoteFrameClient {
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
9817 registerMockedHttpURLLoad("overscroll/overscroll.html"); 9879 registerMockedHttpURLLoad("overscroll/overscroll.html");
9818 FrameTestHelpers::WebViewHelper webViewHelper; 9880 FrameTestHelpers::WebViewHelper webViewHelper;
9819 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html", 9881 webViewHelper.initializeAndLoad(m_baseURL + "overscroll/overscroll.html",
9820 true, nullptr, &client, nullptr, 9882 true, nullptr, &client, nullptr,
9821 configureAndroid); 9883 configureAndroid);
9822 webViewHelper.resize(WebSize(200, 200)); 9884 webViewHelper.resize(WebSize(200, 200));
9823 9885
9824 // Calculation of accumulatedRootOverscroll and unusedDelta on multiple 9886 // Calculation of accumulatedRootOverscroll and unusedDelta on multiple
9825 // scrollUpdate. 9887 // scrollUpdate.
9826 ScrollBegin(&webViewHelper); 9888 ScrollBegin(&webViewHelper);
9827 EXPECT_CALL(client, didOverscroll(WebFloatSize(8, 16), WebFloatSize(8, 16), 9889 EXPECT_CALL(client,
9828 WebFloatPoint(100, 100), WebFloatSize())); 9890 didOverscroll(WebFloatSize(8, 16), WebFloatSize(8, 16),
9891 WebFloatPoint(100, 100), WebFloatSize()));
9829 ScrollUpdate(&webViewHelper, -308, -316); 9892 ScrollUpdate(&webViewHelper, -308, -316);
9830 Mock::VerifyAndClearExpectations(&client); 9893 Mock::VerifyAndClearExpectations(&client);
9831 9894
9832 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 13), WebFloatSize(8, 29), 9895 EXPECT_CALL(client,
9833 WebFloatPoint(100, 100), WebFloatSize())); 9896 didOverscroll(WebFloatSize(0, 13), WebFloatSize(8, 29),
9897 WebFloatPoint(100, 100), WebFloatSize()));
9834 ScrollUpdate(&webViewHelper, 0, -13); 9898 ScrollUpdate(&webViewHelper, 0, -13);
9835 Mock::VerifyAndClearExpectations(&client); 9899 Mock::VerifyAndClearExpectations(&client);
9836 9900
9837 EXPECT_CALL(client, didOverscroll(WebFloatSize(20, 13), WebFloatSize(28, 42), 9901 EXPECT_CALL(client,
9838 WebFloatPoint(100, 100), WebFloatSize())); 9902 didOverscroll(WebFloatSize(20, 13), WebFloatSize(28, 42),
9903 WebFloatPoint(100, 100), WebFloatSize()));
9839 ScrollUpdate(&webViewHelper, -20, -13); 9904 ScrollUpdate(&webViewHelper, -20, -13);
9840 Mock::VerifyAndClearExpectations(&client); 9905 Mock::VerifyAndClearExpectations(&client);
9841 9906
9842 // Overscroll is not reported. 9907 // Overscroll is not reported.
9843 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); 9908 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
9844 ScrollUpdate(&webViewHelper, 0, 1); 9909 ScrollUpdate(&webViewHelper, 0, 1);
9845 Mock::VerifyAndClearExpectations(&client); 9910 Mock::VerifyAndClearExpectations(&client);
9846 9911
9847 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); 9912 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
9848 ScrollUpdate(&webViewHelper, 1, 0); 9913 ScrollUpdate(&webViewHelper, 1, 0);
(...skipping 26 matching lines...) Expand all
9875 9940
9876 // Scroll the Div to the end. 9941 // Scroll the Div to the end.
9877 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); 9942 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
9878 ScrollUpdate(&webViewHelper, 0, -316); 9943 ScrollUpdate(&webViewHelper, 0, -316);
9879 Mock::VerifyAndClearExpectations(&client); 9944 Mock::VerifyAndClearExpectations(&client);
9880 9945
9881 ScrollEnd(&webViewHelper); 9946 ScrollEnd(&webViewHelper);
9882 ScrollBegin(&webViewHelper); 9947 ScrollBegin(&webViewHelper);
9883 9948
9884 // Now On Scrolling DIV, scroll is bubbled and root layer is over-scrolled. 9949 // Now On Scrolling DIV, scroll is bubbled and root layer is over-scrolled.
9885 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 100), WebFloatSize(0, 100), 9950 EXPECT_CALL(client,
9886 WebFloatPoint(100, 100), WebFloatSize())); 9951 didOverscroll(WebFloatSize(0, 100), WebFloatSize(0, 100),
9952 WebFloatPoint(100, 100), WebFloatSize()));
9887 ScrollUpdate(&webViewHelper, 0, -100); 9953 ScrollUpdate(&webViewHelper, 0, -100);
9888 ScrollUpdate(&webViewHelper, 0, -100); 9954 ScrollUpdate(&webViewHelper, 0, -100);
9889 Mock::VerifyAndClearExpectations(&client); 9955 Mock::VerifyAndClearExpectations(&client);
9890 9956
9891 // TODO(bokan): This has never worked but by the accident that this test was 9957 // TODO(bokan): This has never worked but by the accident that this test was
9892 // being run in a WebView without a size. This test should be fixed along with 9958 // being run in a WebView without a size. This test should be fixed along with
9893 // the bug, crbug.com/589320. 9959 // the bug, crbug.com/589320.
9894 // Page scrolls vertically, but over-scrolls horizontally. 9960 // Page scrolls vertically, but over-scrolls horizontally.
9895 // EXPECT_CALL(client, didOverscroll(WebFloatSize(-100, 0), WebFloatSize(-100, 9961 // EXPECT_CALL(client, didOverscroll(WebFloatSize(-100, 0), WebFloatSize(-100,
9896 // 0), WebFloatPoint(100, 100), WebFloatSize())); 9962 // 0), WebFloatPoint(100, 100), WebFloatSize()));
(...skipping 25 matching lines...) Expand all
9922 9988
9923 // Scroll the Div to the end. 9989 // Scroll the Div to the end.
9924 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); 9990 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
9925 ScrollUpdate(&webViewHelper, 0, -316); 9991 ScrollUpdate(&webViewHelper, 0, -316);
9926 Mock::VerifyAndClearExpectations(&client); 9992 Mock::VerifyAndClearExpectations(&client);
9927 9993
9928 ScrollEnd(&webViewHelper); 9994 ScrollEnd(&webViewHelper);
9929 ScrollBegin(&webViewHelper); 9995 ScrollBegin(&webViewHelper);
9930 9996
9931 // Now On Scrolling DIV, scroll is bubbled and root layer is over-scrolled. 9997 // Now On Scrolling DIV, scroll is bubbled and root layer is over-scrolled.
9932 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50), 9998 EXPECT_CALL(client,
9933 WebFloatPoint(100, 100), WebFloatSize())); 9999 didOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50),
10000 WebFloatPoint(100, 100), WebFloatSize()));
9934 ScrollUpdate(&webViewHelper, 0, -150); 10001 ScrollUpdate(&webViewHelper, 0, -150);
9935 Mock::VerifyAndClearExpectations(&client); 10002 Mock::VerifyAndClearExpectations(&client);
9936 } 10003 }
9937 10004
9938 TEST_P(WebFrameOverscrollTest, RootLayerOverscrolledOnInnerIFrameOverScroll) { 10005 TEST_P(WebFrameOverscrollTest, RootLayerOverscrolledOnInnerIFrameOverScroll) {
9939 OverscrollWebViewClient client; 10006 OverscrollWebViewClient client;
9940 registerMockedHttpURLLoad("overscroll/iframe-overscroll.html"); 10007 registerMockedHttpURLLoad("overscroll/iframe-overscroll.html");
9941 registerMockedHttpURLLoad("overscroll/scrollable-iframe.html"); 10008 registerMockedHttpURLLoad("overscroll/scrollable-iframe.html");
9942 FrameTestHelpers::WebViewHelper webViewHelper; 10009 FrameTestHelpers::WebViewHelper webViewHelper;
9943 webViewHelper.initializeAndLoad( 10010 webViewHelper.initializeAndLoad(
(...skipping 11 matching lines...) Expand all
9955 10022
9956 // This scroll will again target the iframe but wont bubble further up. Make 10023 // This scroll will again target the iframe but wont bubble further up. Make
9957 // sure that the unused scroll isn't handled as overscroll. 10024 // sure that the unused scroll isn't handled as overscroll.
9958 ScrollUpdate(&webViewHelper, 0, -50); 10025 ScrollUpdate(&webViewHelper, 0, -50);
9959 Mock::VerifyAndClearExpectations(&client); 10026 Mock::VerifyAndClearExpectations(&client);
9960 10027
9961 ScrollEnd(&webViewHelper); 10028 ScrollEnd(&webViewHelper);
9962 ScrollBegin(&webViewHelper); 10029 ScrollBegin(&webViewHelper);
9963 10030
9964 // Now On Scrolling IFrame, scroll is bubbled and root layer is over-scrolled. 10031 // Now On Scrolling IFrame, scroll is bubbled and root layer is over-scrolled.
9965 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50), 10032 EXPECT_CALL(client,
9966 WebFloatPoint(100, 100), WebFloatSize())); 10033 didOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50),
10034 WebFloatPoint(100, 100), WebFloatSize()));
9967 ScrollUpdate(&webViewHelper, 0, -150); 10035 ScrollUpdate(&webViewHelper, 0, -150);
9968 Mock::VerifyAndClearExpectations(&client); 10036 Mock::VerifyAndClearExpectations(&client);
9969 10037
9970 ScrollEnd(&webViewHelper); 10038 ScrollEnd(&webViewHelper);
9971 } 10039 }
9972 10040
9973 TEST_P(WebFrameOverscrollTest, ScaledPageRootLayerOverscrolled) { 10041 TEST_P(WebFrameOverscrollTest, ScaledPageRootLayerOverscrolled) {
9974 OverscrollWebViewClient client; 10042 OverscrollWebViewClient client;
9975 registerMockedHttpURLLoad("overscroll/overscroll.html"); 10043 registerMockedHttpURLLoad("overscroll/overscroll.html");
9976 FrameTestHelpers::WebViewHelper webViewHelper; 10044 FrameTestHelpers::WebViewHelper webViewHelper;
9977 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad( 10045 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(
9978 m_baseURL + "overscroll/overscroll.html", true, nullptr, &client, nullptr, 10046 m_baseURL + "overscroll/overscroll.html", true, nullptr, &client, nullptr,
9979 configureAndroid); 10047 configureAndroid);
9980 webViewHelper.resize(WebSize(200, 200)); 10048 webViewHelper.resize(WebSize(200, 200));
9981 webViewImpl->setPageScaleFactor(3.0); 10049 webViewImpl->setPageScaleFactor(3.0);
9982 10050
9983 // Calculation of accumulatedRootOverscroll and unusedDelta on scaled page. 10051 // Calculation of accumulatedRootOverscroll and unusedDelta on scaled page.
9984 // The point is (99, 99) because we clamp in the division by 3 to 33 so when 10052 // The point is (99, 99) because we clamp in the division by 3 to 33 so when
9985 // we go back to viewport coordinates it becomes (99, 99). 10053 // we go back to viewport coordinates it becomes (99, 99).
9986 ScrollBegin(&webViewHelper); 10054 ScrollBegin(&webViewHelper);
9987 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -30), 10055 EXPECT_CALL(client,
9988 WebFloatPoint(99, 99), WebFloatSize())); 10056 didOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -30),
10057 WebFloatPoint(99, 99), WebFloatSize()));
9989 ScrollUpdate(&webViewHelper, 0, 30); 10058 ScrollUpdate(&webViewHelper, 0, 30);
9990 Mock::VerifyAndClearExpectations(&client); 10059 Mock::VerifyAndClearExpectations(&client);
9991 10060
9992 EXPECT_CALL(client, didOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -60), 10061 EXPECT_CALL(client,
9993 WebFloatPoint(99, 99), WebFloatSize())); 10062 didOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -60),
10063 WebFloatPoint(99, 99), WebFloatSize()));
9994 ScrollUpdate(&webViewHelper, 0, 30); 10064 ScrollUpdate(&webViewHelper, 0, 30);
9995 Mock::VerifyAndClearExpectations(&client); 10065 Mock::VerifyAndClearExpectations(&client);
9996 10066
9997 EXPECT_CALL(client, 10067 EXPECT_CALL(client,
9998 didOverscroll(WebFloatSize(-30, -30), WebFloatSize(-30, -90), 10068 didOverscroll(WebFloatSize(-30, -30), WebFloatSize(-30, -90),
9999 WebFloatPoint(99, 99), WebFloatSize())); 10069 WebFloatPoint(99, 99), WebFloatSize()));
10000 ScrollUpdate(&webViewHelper, 30, 30); 10070 ScrollUpdate(&webViewHelper, 30, 30);
10001 Mock::VerifyAndClearExpectations(&client); 10071 Mock::VerifyAndClearExpectations(&client);
10002 10072
10003 EXPECT_CALL(client, 10073 EXPECT_CALL(client,
(...skipping 23 matching lines...) Expand all
10027 WebFloatPoint(100, 100), WebFloatSize())); 10097 WebFloatPoint(100, 100), WebFloatSize()));
10028 ScrollUpdate(&webViewHelper, 10, 10); 10098 ScrollUpdate(&webViewHelper, 10, 10);
10029 Mock::VerifyAndClearExpectations(&client); 10099 Mock::VerifyAndClearExpectations(&client);
10030 10100
10031 EXPECT_CALL(client, 10101 EXPECT_CALL(client,
10032 didOverscroll(WebFloatSize(0, -0.10), WebFloatSize(-10, -10.10), 10102 didOverscroll(WebFloatSize(0, -0.10), WebFloatSize(-10, -10.10),
10033 WebFloatPoint(100, 100), WebFloatSize())); 10103 WebFloatPoint(100, 100), WebFloatSize()));
10034 ScrollUpdate(&webViewHelper, 0, 0.10); 10104 ScrollUpdate(&webViewHelper, 0, 0.10);
10035 Mock::VerifyAndClearExpectations(&client); 10105 Mock::VerifyAndClearExpectations(&client);
10036 10106
10037 EXPECT_CALL(client, didOverscroll(WebFloatSize(-0.10, 0), 10107 EXPECT_CALL(
10038 WebFloatSize(-10.10, -10.10), 10108 client,
10039 WebFloatPoint(100, 100), WebFloatSize())); 10109 didOverscroll(WebFloatSize(-0.10, 0), WebFloatSize(-10.10, -10.10),
10110 WebFloatPoint(100, 100), WebFloatSize()));
10040 ScrollUpdate(&webViewHelper, 0.10, 0); 10111 ScrollUpdate(&webViewHelper, 0.10, 0);
10041 Mock::VerifyAndClearExpectations(&client); 10112 Mock::VerifyAndClearExpectations(&client);
10042 10113
10043 // For residual values overscrollDelta should be reset and didOverscroll 10114 // For residual values overscrollDelta should be reset and didOverscroll
10044 // shouldn't be called. 10115 // shouldn't be called.
10045 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); 10116 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
10046 ScrollUpdate(&webViewHelper, 0, 0.09); 10117 ScrollUpdate(&webViewHelper, 0, 0.09);
10047 Mock::VerifyAndClearExpectations(&client); 10118 Mock::VerifyAndClearExpectations(&client);
10048 10119
10049 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); 10120 EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0);
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
10402 FrameTestHelpers::WebViewHelper helper; 10473 FrameTestHelpers::WebViewHelper helper;
10403 WebViewImpl* webView = helper.initializeAndLoad(url, true, 0); 10474 WebViewImpl* webView = helper.initializeAndLoad(url, true, 0);
10404 webView->resize(WebSize(400, 400)); 10475 webView->resize(WebSize(400, 400));
10405 10476
10406 uint64_t sequence = Platform::current()->clipboard()->sequenceNumber( 10477 uint64_t sequence = Platform::current()->clipboard()->sequenceNumber(
10407 WebClipboard::BufferStandard); 10478 WebClipboard::BufferStandard);
10408 10479
10409 WebLocalFrame* localFrame = webView->mainFrameImpl(); 10480 WebLocalFrame* localFrame = webView->mainFrameImpl();
10410 localFrame->copyImageAt(WebPoint(50, 50)); 10481 localFrame->copyImageAt(WebPoint(50, 50));
10411 10482
10412 EXPECT_NE(sequence, Platform::current()->clipboard()->sequenceNumber( 10483 EXPECT_NE(sequence,
10413 WebClipboard::BufferStandard)); 10484 Platform::current()->clipboard()->sequenceNumber(
10485 WebClipboard::BufferStandard));
10414 10486
10415 WebImage image = 10487 WebImage image =
10416 static_cast<WebMockClipboard*>(Platform::current()->clipboard()) 10488 static_cast<WebMockClipboard*>(Platform::current()->clipboard())
10417 ->readRawImage(WebClipboard::Buffer()); 10489 ->readRawImage(WebClipboard::Buffer());
10418 10490
10419 SkAutoLockPixels autoLock(image.getSkBitmap()); 10491 SkAutoLockPixels autoLock(image.getSkBitmap());
10420 EXPECT_EQ(SkColorSetARGB(255, 255, 0, 0), image.getSkBitmap().getColor(0, 0)); 10492 EXPECT_EQ(SkColorSetARGB(255, 255, 0, 0), image.getSkBitmap().getColor(0, 0));
10421 }; 10493 };
10422 10494
10423 TEST_F(WebFrameTest, CopyImageAtWithPinchZoom) { 10495 TEST_F(WebFrameTest, CopyImageAtWithPinchZoom) {
10424 std::string url = m_baseURL + "canvas-copy-image.html"; 10496 std::string url = m_baseURL + "canvas-copy-image.html";
10425 registerMockedURLLoadFromBase(m_baseURL, "canvas-copy-image.html"); 10497 registerMockedURLLoadFromBase(m_baseURL, "canvas-copy-image.html");
10426 10498
10427 FrameTestHelpers::WebViewHelper helper; 10499 FrameTestHelpers::WebViewHelper helper;
10428 WebViewImpl* webView = helper.initializeAndLoad(url, true, 0); 10500 WebViewImpl* webView = helper.initializeAndLoad(url, true, 0);
10429 webView->resize(WebSize(400, 400)); 10501 webView->resize(WebSize(400, 400));
10430 webView->updateAllLifecyclePhases(); 10502 webView->updateAllLifecyclePhases();
10431 webView->setPageScaleFactor(2); 10503 webView->setPageScaleFactor(2);
10432 webView->setVisualViewportOffset(WebFloatPoint(200, 200)); 10504 webView->setVisualViewportOffset(WebFloatPoint(200, 200));
10433 10505
10434 uint64_t sequence = Platform::current()->clipboard()->sequenceNumber( 10506 uint64_t sequence = Platform::current()->clipboard()->sequenceNumber(
10435 WebClipboard::BufferStandard); 10507 WebClipboard::BufferStandard);
10436 10508
10437 WebLocalFrame* localFrame = webView->mainFrameImpl(); 10509 WebLocalFrame* localFrame = webView->mainFrameImpl();
10438 localFrame->copyImageAt(WebPoint(0, 0)); 10510 localFrame->copyImageAt(WebPoint(0, 0));
10439 10511
10440 EXPECT_NE(sequence, Platform::current()->clipboard()->sequenceNumber( 10512 EXPECT_NE(sequence,
10441 WebClipboard::BufferStandard)); 10513 Platform::current()->clipboard()->sequenceNumber(
10514 WebClipboard::BufferStandard));
10442 10515
10443 WebImage image = 10516 WebImage image =
10444 static_cast<WebMockClipboard*>(Platform::current()->clipboard()) 10517 static_cast<WebMockClipboard*>(Platform::current()->clipboard())
10445 ->readRawImage(WebClipboard::Buffer()); 10518 ->readRawImage(WebClipboard::Buffer());
10446 10519
10447 SkAutoLockPixels autoLock(image.getSkBitmap()); 10520 SkAutoLockPixels autoLock(image.getSkBitmap());
10448 EXPECT_EQ(SkColorSetARGB(255, 255, 0, 0), image.getSkBitmap().getColor(0, 0)); 10521 EXPECT_EQ(SkColorSetARGB(255, 255, 0, 0), image.getSkBitmap().getColor(0, 0));
10449 }; 10522 };
10450 10523
10451 TEST_F(WebFrameTest, CopyImageWithImageMap) { 10524 TEST_F(WebFrameTest, CopyImageWithImageMap) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
10486 10559
10487 std::string redirectURL = m_baseURL + "foo.html"; 10560 std::string redirectURL = m_baseURL + "foo.html";
10488 URLTestHelpers::registerMockedURLLoad(toKURL(redirectURL), 10561 URLTestHelpers::registerMockedURLLoad(toKURL(redirectURL),
10489 testing::webTestDataPath("foo.html")); 10562 testing::webTestDataPath("foo.html"));
10490 WebURLRequest request(toKURL("javascript:location='" + redirectURL + "'")); 10563 WebURLRequest request(toKURL("javascript:location='" + redirectURL + "'"));
10491 helper.webView()->mainFrameImpl()->loadRequest(request); 10564 helper.webView()->mainFrameImpl()->loadRequest(request);
10492 10565
10493 // Normally, the result of the JS url replaces the existing contents on the 10566 // Normally, the result of the JS url replaces the existing contents on the
10494 // Document. However, if the JS triggers a navigation, the contents should 10567 // Document. However, if the JS triggers a navigation, the contents should
10495 // not be replaced. 10568 // not be replaced.
10496 EXPECT_EQ("", toLocalFrame(helper.webView()->page()->mainFrame()) 10569 EXPECT_EQ("",
10497 ->document() 10570 toLocalFrame(helper.webView()->page()->mainFrame())
10498 ->documentElement() 10571 ->document()
10499 ->innerText()); 10572 ->documentElement()
10573 ->innerText());
10500 } 10574 }
10501 10575
10502 class TestResourcePriorityWebFrameClient 10576 class TestResourcePriorityWebFrameClient
10503 : public FrameTestHelpers::TestWebFrameClient { 10577 : public FrameTestHelpers::TestWebFrameClient {
10504 public: 10578 public:
10505 class ExpectedRequest { 10579 class ExpectedRequest {
10506 public: 10580 public:
10507 ExpectedRequest(const KURL& url, WebURLRequest::Priority priority) 10581 ExpectedRequest(const KURL& url, WebURLRequest::Priority priority)
10508 : url(url), priority(priority), seen(false) {} 10582 : url(url), priority(priority), seen(false) {}
10509 10583
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
11386 11460
11387 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); 11461 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached());
11388 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); 11462 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading());
11389 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); 11463 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad());
11390 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); 11464 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents());
11391 11465
11392 webViewHelper.reset(); 11466 webViewHelper.reset();
11393 } 11467 }
11394 11468
11395 } // namespace blink 11469 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698