OLD | NEW |
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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 ->SuspendScheduledTasks(); | 476 ->SuspendScheduledTasks(); |
477 web_view_helper.WebView() | 477 web_view_helper.WebView() |
478 ->MainFrameImpl() | 478 ->MainFrameImpl() |
479 ->RequestExecuteScriptAndReturnValue( | 479 ->RequestExecuteScriptAndReturnValue( |
480 WebScriptSource(WebString("'hello';")), false, &callback_helper); | 480 WebScriptSource(WebString("'hello';")), false, &callback_helper); |
481 RunPendingTasks(); | 481 RunPendingTasks(); |
482 EXPECT_FALSE(callback_helper.DidComplete()); | 482 EXPECT_FALSE(callback_helper.DidComplete()); |
483 | 483 |
484 // If the frame navigates, pending scripts should be removed, but the callback | 484 // If the frame navigates, pending scripts should be removed, but the callback |
485 // should always be ran. | 485 // should always be ran. |
486 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 486 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
487 base_url_ + "bar.html"); | 487 base_url_ + "bar.html"); |
488 EXPECT_TRUE(callback_helper.DidComplete()); | 488 EXPECT_TRUE(callback_helper.DidComplete()); |
489 EXPECT_EQ(String(), callback_helper.StringValue()); | 489 EXPECT_EQ(String(), callback_helper.StringValue()); |
490 } | 490 } |
491 | 491 |
492 TEST_P(ParameterizedWebFrameTest, RequestExecuteV8Function) { | 492 TEST_P(ParameterizedWebFrameTest, RequestExecuteV8Function) { |
493 RegisterMockedHttpURLLoad("foo.html"); | 493 RegisterMockedHttpURLLoad("foo.html"); |
494 | 494 |
495 FrameTestHelpers::WebViewHelper web_view_helper; | 495 FrameTestHelpers::WebViewHelper web_view_helper; |
496 web_view_helper.InitializeAndLoad(base_url_ + "foo.html"); | 496 web_view_helper.InitializeAndLoad(base_url_ + "foo.html"); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 WebSearchableFormData searchable_data_form(forms[0]); | 630 WebSearchableFormData searchable_data_form(forms[0]); |
631 } | 631 } |
632 | 632 |
633 TEST_P(ParameterizedWebFrameTest, ChromePageJavascript) { | 633 TEST_P(ParameterizedWebFrameTest, ChromePageJavascript) { |
634 RegisterMockedChromeURLLoad("history.html"); | 634 RegisterMockedChromeURLLoad("history.html"); |
635 | 635 |
636 FrameTestHelpers::WebViewHelper web_view_helper; | 636 FrameTestHelpers::WebViewHelper web_view_helper; |
637 web_view_helper.InitializeAndLoad(chrome_url_ + "history.html"); | 637 web_view_helper.InitializeAndLoad(chrome_url_ + "history.html"); |
638 | 638 |
639 // Try to run JS against the chrome-style URL. | 639 // Try to run JS against the chrome-style URL. |
640 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 640 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
641 "javascript:document.body.appendChild(document." | 641 "javascript:document.body.appendChild(document." |
642 "createTextNode('Clobbered'))"); | 642 "createTextNode('Clobbered'))"); |
643 | 643 |
644 // Now retrieve the frame's text and ensure it was modified by running | 644 // Now retrieve the frame's text and ensure it was modified by running |
645 // javascript. | 645 // javascript. |
646 std::string content = | 646 std::string content = |
647 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) | 647 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) |
648 .Utf8(); | 648 .Utf8(); |
649 EXPECT_NE(std::string::npos, content.find("Clobbered")); | 649 EXPECT_NE(std::string::npos, content.find("Clobbered")); |
650 } | 650 } |
651 | 651 |
652 TEST_P(ParameterizedWebFrameTest, ChromePageNoJavascript) { | 652 TEST_P(ParameterizedWebFrameTest, ChromePageNoJavascript) { |
653 RegisterMockedChromeURLLoad("history.html"); | 653 RegisterMockedChromeURLLoad("history.html"); |
654 | 654 |
655 FrameTestHelpers::WebViewHelper web_view_helper; | 655 FrameTestHelpers::WebViewHelper web_view_helper; |
656 web_view_helper.InitializeAndLoad(chrome_url_ + "history.html"); | 656 web_view_helper.InitializeAndLoad(chrome_url_ + "history.html"); |
657 | 657 |
658 // Try to run JS against the chrome-style URL after prohibiting it. | 658 // Try to run JS against the chrome-style URL after prohibiting it. |
659 WebSecurityPolicy::RegisterURLSchemeAsNotAllowingJavascriptURLs("chrome"); | 659 WebSecurityPolicy::RegisterURLSchemeAsNotAllowingJavascriptURLs("chrome"); |
660 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 660 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
661 "javascript:document.body.appendChild(document." | 661 "javascript:document.body.appendChild(document." |
662 "createTextNode('Clobbered'))"); | 662 "createTextNode('Clobbered'))"); |
663 | 663 |
664 // Now retrieve the frame's text and ensure it wasn't modified by running | 664 // Now retrieve the frame's text and ensure it wasn't modified by running |
665 // javascript. | 665 // javascript. |
666 std::string content = | 666 std::string content = |
667 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) | 667 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) |
668 .Utf8(); | 668 .Utf8(); |
669 EXPECT_EQ(std::string::npos, content.find("Clobbered")); | 669 EXPECT_EQ(std::string::npos, content.find("Clobbered")); |
670 } | 670 } |
671 | 671 |
672 TEST_P(ParameterizedWebFrameTest, LocationSetHostWithMissingPort) { | 672 TEST_P(ParameterizedWebFrameTest, LocationSetHostWithMissingPort) { |
673 std::string file_name = "print-location-href.html"; | 673 std::string file_name = "print-location-href.html"; |
674 RegisterMockedHttpURLLoad(file_name); | 674 RegisterMockedHttpURLLoad(file_name); |
675 RegisterMockedURLLoadFromBase("http://internal.test:0/", file_name); | 675 RegisterMockedURLLoadFromBase("http://internal.test:0/", file_name); |
676 | 676 |
677 FrameTestHelpers::WebViewHelper web_view_helper; | 677 FrameTestHelpers::WebViewHelper web_view_helper; |
678 web_view_helper.InitializeAndLoad(base_url_ + file_name); | 678 web_view_helper.InitializeAndLoad(base_url_ + file_name); |
679 | 679 |
680 // Setting host to "hostname:" should be treated as "hostname:0". | 680 // Setting host to "hostname:" should be treated as "hostname:0". |
681 FrameTestHelpers::LoadFrame( | 681 FrameTestHelpers::LoadFrame( |
682 web_view_helper.WebView()->MainFrame(), | 682 web_view_helper.WebView()->MainFrameImpl(), |
683 "javascript:location.host = 'internal.test:'; void 0;"); | 683 "javascript:location.host = 'internal.test:'; void 0;"); |
684 | 684 |
685 FrameTestHelpers::LoadFrame( | 685 FrameTestHelpers::LoadFrame( |
686 web_view_helper.WebView()->MainFrame(), | 686 web_view_helper.WebView()->MainFrameImpl(), |
687 "javascript:document.body.textContent = location.href; void 0;"); | 687 "javascript:document.body.textContent = location.href; void 0;"); |
688 | 688 |
689 std::string content = | 689 std::string content = |
690 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) | 690 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) |
691 .Utf8(); | 691 .Utf8(); |
692 EXPECT_EQ("http://internal.test:0/" + file_name, content); | 692 EXPECT_EQ("http://internal.test:0/" + file_name, content); |
693 } | 693 } |
694 | 694 |
695 TEST_P(ParameterizedWebFrameTest, LocationSetEmptyPort) { | 695 TEST_P(ParameterizedWebFrameTest, LocationSetEmptyPort) { |
696 std::string file_name = "print-location-href.html"; | 696 std::string file_name = "print-location-href.html"; |
697 RegisterMockedHttpURLLoad(file_name); | 697 RegisterMockedHttpURLLoad(file_name); |
698 RegisterMockedURLLoadFromBase("http://internal.test:0/", file_name); | 698 RegisterMockedURLLoadFromBase("http://internal.test:0/", file_name); |
699 | 699 |
700 FrameTestHelpers::WebViewHelper web_view_helper; | 700 FrameTestHelpers::WebViewHelper web_view_helper; |
701 web_view_helper.InitializeAndLoad(base_url_ + file_name); | 701 web_view_helper.InitializeAndLoad(base_url_ + file_name); |
702 | 702 |
703 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 703 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
704 "javascript:location.port = ''; void 0;"); | 704 "javascript:location.port = ''; void 0;"); |
705 | 705 |
706 FrameTestHelpers::LoadFrame( | 706 FrameTestHelpers::LoadFrame( |
707 web_view_helper.WebView()->MainFrame(), | 707 web_view_helper.WebView()->MainFrameImpl(), |
708 "javascript:document.body.textContent = location.href; void 0;"); | 708 "javascript:document.body.textContent = location.href; void 0;"); |
709 | 709 |
710 std::string content = | 710 std::string content = |
711 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) | 711 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) |
712 .Utf8(); | 712 .Utf8(); |
713 EXPECT_EQ("http://internal.test:0/" + file_name, content); | 713 EXPECT_EQ("http://internal.test:0/" + file_name, content); |
714 } | 714 } |
715 | 715 |
716 class EvaluateOnLoadWebFrameClient | 716 class EvaluateOnLoadWebFrameClient |
717 : public FrameTestHelpers::TestWebFrameClient { | 717 : public FrameTestHelpers::TestWebFrameClient { |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 FixedLayoutTestWebViewClient client; | 1267 FixedLayoutTestWebViewClient client; |
1268 client.screen_info_.device_scale_factor = 1; | 1268 client.screen_info_.device_scale_factor = 1; |
1269 int viewport_width = 640; | 1269 int viewport_width = 640; |
1270 int viewport_height = 480; | 1270 int viewport_height = 480; |
1271 | 1271 |
1272 // Make sure we initialize to minimum scale, even if the window size | 1272 // Make sure we initialize to minimum scale, even if the window size |
1273 // only becomes available after the load begins. | 1273 // only becomes available after the load begins. |
1274 FrameTestHelpers::WebViewHelper web_view_helper; | 1274 FrameTestHelpers::WebViewHelper web_view_helper; |
1275 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); | 1275 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); |
1276 web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); | 1276 web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); |
1277 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 1277 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
1278 base_url_ + "fixed_layout.html"); | 1278 base_url_ + "fixed_layout.html"); |
1279 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 1279 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
1280 | 1280 |
1281 int default_fixed_layout_width = 980; | 1281 int default_fixed_layout_width = 980; |
1282 float minimum_page_scale_factor = | 1282 float minimum_page_scale_factor = |
1283 viewport_width / (float)default_fixed_layout_width; | 1283 viewport_width / (float)default_fixed_layout_width; |
1284 EXPECT_EQ(minimum_page_scale_factor, | 1284 EXPECT_EQ(minimum_page_scale_factor, |
1285 web_view_helper.WebView()->PageScaleFactor()); | 1285 web_view_helper.WebView()->PageScaleFactor()); |
1286 EXPECT_EQ(minimum_page_scale_factor, | 1286 EXPECT_EQ(minimum_page_scale_factor, |
1287 web_view_helper.WebView()->MinimumPageScaleFactor()); | 1287 web_view_helper.WebView()->MinimumPageScaleFactor()); |
(...skipping 21 matching lines...) Expand all Loading... |
1309 FixedLayoutTestWebViewClient client; | 1309 FixedLayoutTestWebViewClient client; |
1310 client.screen_info_.device_scale_factor = 1; | 1310 client.screen_info_.device_scale_factor = 1; |
1311 int viewport_width = 640; | 1311 int viewport_width = 640; |
1312 int viewport_height = 480; | 1312 int viewport_height = 480; |
1313 | 1313 |
1314 // Make sure we initialize to minimum scale, even if the window size | 1314 // Make sure we initialize to minimum scale, even if the window size |
1315 // only becomes available after the load begins. | 1315 // only becomes available after the load begins. |
1316 FrameTestHelpers::WebViewHelper web_view_helper; | 1316 FrameTestHelpers::WebViewHelper web_view_helper; |
1317 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); | 1317 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); |
1318 web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); | 1318 web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); |
1319 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 1319 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
1320 base_url_ + "wide_document.html"); | 1320 base_url_ + "wide_document.html"); |
1321 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 1321 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
1322 | 1322 |
1323 int wide_document_width = 1500; | 1323 int wide_document_width = 1500; |
1324 float minimum_page_scale_factor = viewport_width / (float)wide_document_width; | 1324 float minimum_page_scale_factor = viewport_width / (float)wide_document_width; |
1325 EXPECT_EQ(minimum_page_scale_factor, | 1325 EXPECT_EQ(minimum_page_scale_factor, |
1326 web_view_helper.WebView()->PageScaleFactor()); | 1326 web_view_helper.WebView()->PageScaleFactor()); |
1327 EXPECT_EQ(minimum_page_scale_factor, | 1327 EXPECT_EQ(minimum_page_scale_factor, |
1328 web_view_helper.WebView()->MinimumPageScaleFactor()); | 1328 web_view_helper.WebView()->MinimumPageScaleFactor()); |
1329 | 1329 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 FixedLayoutTestWebViewClient client; | 1507 FixedLayoutTestWebViewClient client; |
1508 client.screen_info_.device_scale_factor = 1; | 1508 client.screen_info_.device_scale_factor = 1; |
1509 int viewport_width = 640; | 1509 int viewport_width = 640; |
1510 int viewport_height = 480; | 1510 int viewport_height = 480; |
1511 | 1511 |
1512 FrameTestHelpers::WebViewHelper web_view_helper; | 1512 FrameTestHelpers::WebViewHelper web_view_helper; |
1513 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); | 1513 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); |
1514 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); | 1514 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); |
1515 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); | 1515 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); |
1516 FrameTestHelpers::LoadFrame( | 1516 FrameTestHelpers::LoadFrame( |
1517 web_view_helper.WebView()->MainFrame(), | 1517 web_view_helper.WebView()->MainFrameImpl(), |
1518 base_url_ + "viewport/viewport-legacy-xhtmlmp.html"); | 1518 base_url_ + "viewport/viewport-legacy-xhtmlmp.html"); |
1519 | 1519 |
1520 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 1520 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
1521 EXPECT_EQ(viewport_width, web_view_helper.WebView() | 1521 EXPECT_EQ(viewport_width, web_view_helper.WebView() |
1522 ->MainFrameImpl() | 1522 ->MainFrameImpl() |
1523 ->GetFrameView() | 1523 ->GetFrameView() |
1524 ->ContentsSize() | 1524 ->ContentsSize() |
1525 .Width()); | 1525 .Width()); |
1526 EXPECT_EQ(viewport_height, web_view_helper.WebView() | 1526 EXPECT_EQ(viewport_height, web_view_helper.WebView() |
1527 ->MainFrameImpl() | 1527 ->MainFrameImpl() |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2052 int viewport_width = 640; | 2052 int viewport_width = 640; |
2053 int viewport_height = 480; | 2053 int viewport_height = 480; |
2054 | 2054 |
2055 FrameTestHelpers::WebViewHelper web_view_helper; | 2055 FrameTestHelpers::WebViewHelper web_view_helper; |
2056 | 2056 |
2057 web_view_helper.InitializeAndLoad(base_url_ + "200-by-300.html", nullptr, | 2057 web_view_helper.InitializeAndLoad(base_url_ + "200-by-300.html", nullptr, |
2058 &client, nullptr, ConfigureAndroid); | 2058 &client, nullptr, ConfigureAndroid); |
2059 web_view_helper.WebView()->GetSettings()->SetForceZeroLayoutHeight(true); | 2059 web_view_helper.WebView()->GetSettings()->SetForceZeroLayoutHeight(true); |
2060 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2060 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2061 | 2061 |
2062 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2062 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2063 base_url_ + "large-div.html"); | 2063 base_url_ + "large-div.html"); |
2064 web_view_helper.WebView()->UpdateAllLifecyclePhases(); | 2064 web_view_helper.WebView()->UpdateAllLifecyclePhases(); |
2065 | 2065 |
2066 EXPECT_EQ(0, web_view_helper.WebView() | 2066 EXPECT_EQ(0, web_view_helper.WebView() |
2067 ->MainFrameImpl() | 2067 ->MainFrameImpl() |
2068 ->GetFrameView() | 2068 ->GetFrameView() |
2069 ->GetLayoutSize() | 2069 ->GetLayoutSize() |
2070 .Height()); | 2070 .Height()); |
2071 } | 2071 } |
2072 | 2072 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2106 | 2106 |
2107 FrameTestHelpers::WebViewHelper web_view_helper; | 2107 FrameTestHelpers::WebViewHelper web_view_helper; |
2108 web_view_helper.InitializeAndLoad("about:blank", nullptr, &client, nullptr, | 2108 web_view_helper.InitializeAndLoad("about:blank", nullptr, &client, nullptr, |
2109 ConfigureAndroid); | 2109 ConfigureAndroid); |
2110 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); | 2110 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); |
2111 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); | 2111 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); |
2112 web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( | 2112 web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( |
2113 true); | 2113 true); |
2114 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2114 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2115 | 2115 |
2116 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2116 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2117 base_url_ + "wide_document_width_viewport.html"); | 2117 base_url_ + "wide_document_width_viewport.html"); |
2118 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2118 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2119 | 2119 |
2120 int wide_document_width = 800; | 2120 int wide_document_width = 800; |
2121 float minimum_page_scale_factor = viewport_width / (float)wide_document_width; | 2121 float minimum_page_scale_factor = viewport_width / (float)wide_document_width; |
2122 EXPECT_EQ(minimum_page_scale_factor, | 2122 EXPECT_EQ(minimum_page_scale_factor, |
2123 web_view_helper.WebView()->PageScaleFactor()); | 2123 web_view_helper.WebView()->PageScaleFactor()); |
2124 EXPECT_EQ(minimum_page_scale_factor, | 2124 EXPECT_EQ(minimum_page_scale_factor, |
2125 web_view_helper.WebView()->MinimumPageScaleFactor()); | 2125 web_view_helper.WebView()->MinimumPageScaleFactor()); |
2126 } | 2126 } |
2127 | 2127 |
2128 TEST_P(ParameterizedWebFrameTest, WideViewportQuirkClobbersHeight) { | 2128 TEST_P(ParameterizedWebFrameTest, WideViewportQuirkClobbersHeight) { |
2129 RegisterMockedHttpURLLoad("viewport-height-1000.html"); | 2129 RegisterMockedHttpURLLoad("viewport-height-1000.html"); |
2130 | 2130 |
2131 FixedLayoutTestWebViewClient client; | 2131 FixedLayoutTestWebViewClient client; |
2132 client.screen_info_.device_scale_factor = 1; | 2132 client.screen_info_.device_scale_factor = 1; |
2133 int viewport_width = 600; | 2133 int viewport_width = 600; |
2134 int viewport_height = 800; | 2134 int viewport_height = 800; |
2135 | 2135 |
2136 FrameTestHelpers::WebViewHelper web_view_helper; | 2136 FrameTestHelpers::WebViewHelper web_view_helper; |
2137 web_view_helper.InitializeAndLoad("about:blank", nullptr, &client, nullptr, | 2137 web_view_helper.InitializeAndLoad("about:blank", nullptr, &client, nullptr, |
2138 ConfigureAndroid); | 2138 ConfigureAndroid); |
2139 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); | 2139 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); |
2140 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(false); | 2140 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(false); |
2141 web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( | 2141 web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( |
2142 true); | 2142 true); |
2143 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2143 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2144 | 2144 |
2145 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2145 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2146 base_url_ + "viewport-height-1000.html"); | 2146 base_url_ + "viewport-height-1000.html"); |
2147 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2147 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2148 | 2148 |
2149 EXPECT_EQ(800, web_view_helper.WebView() | 2149 EXPECT_EQ(800, web_view_helper.WebView() |
2150 ->MainFrameImpl() | 2150 ->MainFrameImpl() |
2151 ->GetFrameView() | 2151 ->GetFrameView() |
2152 ->GetLayoutSize() | 2152 ->GetLayoutSize() |
2153 .Height()); | 2153 .Height()); |
2154 EXPECT_EQ(1, web_view_helper.WebView()->PageScaleFactor()); | 2154 EXPECT_EQ(1, web_view_helper.WebView()->PageScaleFactor()); |
2155 } | 2155 } |
2156 | 2156 |
2157 TEST_P(ParameterizedWebFrameTest, LayoutSize320Quirk) { | 2157 TEST_P(ParameterizedWebFrameTest, LayoutSize320Quirk) { |
2158 RegisterMockedHttpURLLoad("viewport/viewport-30.html"); | 2158 RegisterMockedHttpURLLoad("viewport/viewport-30.html"); |
2159 | 2159 |
2160 FixedLayoutTestWebViewClient client; | 2160 FixedLayoutTestWebViewClient client; |
2161 client.screen_info_.device_scale_factor = 1; | 2161 client.screen_info_.device_scale_factor = 1; |
2162 int viewport_width = 600; | 2162 int viewport_width = 600; |
2163 int viewport_height = 800; | 2163 int viewport_height = 800; |
2164 | 2164 |
2165 FrameTestHelpers::WebViewHelper web_view_helper; | 2165 FrameTestHelpers::WebViewHelper web_view_helper; |
2166 web_view_helper.InitializeAndLoad("about:blank", nullptr, &client, nullptr, | 2166 web_view_helper.InitializeAndLoad("about:blank", nullptr, &client, nullptr, |
2167 ConfigureAndroid); | 2167 ConfigureAndroid); |
2168 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); | 2168 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); |
2169 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); | 2169 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); |
2170 web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( | 2170 web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( |
2171 true); | 2171 true); |
2172 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2172 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2173 | 2173 |
2174 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2174 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2175 base_url_ + "viewport/viewport-30.html"); | 2175 base_url_ + "viewport/viewport-30.html"); |
2176 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2176 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2177 | 2177 |
2178 EXPECT_EQ(600, web_view_helper.WebView() | 2178 EXPECT_EQ(600, web_view_helper.WebView() |
2179 ->MainFrameImpl() | 2179 ->MainFrameImpl() |
2180 ->GetFrameView() | 2180 ->GetFrameView() |
2181 ->GetLayoutSize() | 2181 ->GetLayoutSize() |
2182 .Width()); | 2182 .Width()); |
2183 EXPECT_EQ(800, web_view_helper.WebView() | 2183 EXPECT_EQ(800, web_view_helper.WebView() |
2184 ->MainFrameImpl() | 2184 ->MainFrameImpl() |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2241 int viewport_width = 640; | 2241 int viewport_width = 640; |
2242 int viewport_height = 480; | 2242 int viewport_height = 480; |
2243 | 2243 |
2244 FrameTestHelpers::WebViewHelper web_view_helper; | 2244 FrameTestHelpers::WebViewHelper web_view_helper; |
2245 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); | 2245 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); |
2246 web_view_helper.WebView()->GetSettings()->SetViewportMetaZeroValuesQuirk( | 2246 web_view_helper.WebView()->GetSettings()->SetViewportMetaZeroValuesQuirk( |
2247 true); | 2247 true); |
2248 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); | 2248 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); |
2249 web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( | 2249 web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( |
2250 true); | 2250 true); |
2251 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2251 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2252 base_url_ + "viewport-zero-values.html"); | 2252 base_url_ + "viewport-zero-values.html"); |
2253 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2253 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2254 | 2254 |
2255 EXPECT_EQ(viewport_width, web_view_helper.WebView() | 2255 EXPECT_EQ(viewport_width, web_view_helper.WebView() |
2256 ->MainFrameImpl() | 2256 ->MainFrameImpl() |
2257 ->GetFrameView() | 2257 ->GetFrameView() |
2258 ->GetLayoutSize() | 2258 ->GetLayoutSize() |
2259 .Width()); | 2259 .Width()); |
2260 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); | 2260 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); |
2261 | 2261 |
(...skipping 10 matching lines...) Expand all Loading... |
2272 TEST_P(ParameterizedWebFrameTest, OverflowHiddenDisablesScrolling) { | 2272 TEST_P(ParameterizedWebFrameTest, OverflowHiddenDisablesScrolling) { |
2273 RegisterMockedHttpURLLoad("body-overflow-hidden.html"); | 2273 RegisterMockedHttpURLLoad("body-overflow-hidden.html"); |
2274 | 2274 |
2275 FixedLayoutTestWebViewClient client; | 2275 FixedLayoutTestWebViewClient client; |
2276 client.screen_info_.device_scale_factor = 1; | 2276 client.screen_info_.device_scale_factor = 1; |
2277 int viewport_width = 640; | 2277 int viewport_width = 640; |
2278 int viewport_height = 480; | 2278 int viewport_height = 480; |
2279 | 2279 |
2280 FrameTestHelpers::WebViewHelper web_view_helper; | 2280 FrameTestHelpers::WebViewHelper web_view_helper; |
2281 web_view_helper.Initialize(nullptr, &client); | 2281 web_view_helper.Initialize(nullptr, &client); |
2282 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2282 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2283 base_url_ + "body-overflow-hidden.html"); | 2283 base_url_ + "body-overflow-hidden.html"); |
2284 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2284 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2285 | 2285 |
2286 LocalFrameView* view = | 2286 LocalFrameView* view = |
2287 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); | 2287 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); |
2288 EXPECT_FALSE(view->UserInputScrollable(kVerticalScrollbar)); | 2288 EXPECT_FALSE(view->UserInputScrollable(kVerticalScrollbar)); |
2289 EXPECT_FALSE(view->UserInputScrollable(kHorizontalScrollbar)); | 2289 EXPECT_FALSE(view->UserInputScrollable(kHorizontalScrollbar)); |
2290 } | 2290 } |
2291 | 2291 |
2292 TEST_P(ParameterizedWebFrameTest, | 2292 TEST_P(ParameterizedWebFrameTest, |
2293 OverflowHiddenDisablesScrollingWithSetCanHaveScrollbars) { | 2293 OverflowHiddenDisablesScrollingWithSetCanHaveScrollbars) { |
2294 RegisterMockedHttpURLLoad("body-overflow-hidden-short.html"); | 2294 RegisterMockedHttpURLLoad("body-overflow-hidden-short.html"); |
2295 | 2295 |
2296 FixedLayoutTestWebViewClient client; | 2296 FixedLayoutTestWebViewClient client; |
2297 client.screen_info_.device_scale_factor = 1; | 2297 client.screen_info_.device_scale_factor = 1; |
2298 int viewport_width = 640; | 2298 int viewport_width = 640; |
2299 int viewport_height = 480; | 2299 int viewport_height = 480; |
2300 | 2300 |
2301 FrameTestHelpers::WebViewHelper web_view_helper; | 2301 FrameTestHelpers::WebViewHelper web_view_helper; |
2302 web_view_helper.Initialize(nullptr, &client); | 2302 web_view_helper.Initialize(nullptr, &client); |
2303 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2303 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2304 base_url_ + "body-overflow-hidden-short.html"); | 2304 base_url_ + "body-overflow-hidden-short.html"); |
2305 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2305 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2306 | 2306 |
2307 LocalFrameView* view = | 2307 LocalFrameView* view = |
2308 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); | 2308 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); |
2309 EXPECT_FALSE(view->UserInputScrollable(kVerticalScrollbar)); | 2309 EXPECT_FALSE(view->UserInputScrollable(kVerticalScrollbar)); |
2310 EXPECT_FALSE(view->UserInputScrollable(kHorizontalScrollbar)); | 2310 EXPECT_FALSE(view->UserInputScrollable(kHorizontalScrollbar)); |
2311 | 2311 |
2312 web_view_helper.WebView()->MainFrameImpl()->SetCanHaveScrollbars(true); | 2312 web_view_helper.WebView()->MainFrameImpl()->SetCanHaveScrollbars(true); |
2313 EXPECT_FALSE(view->UserInputScrollable(kVerticalScrollbar)); | 2313 EXPECT_FALSE(view->UserInputScrollable(kVerticalScrollbar)); |
2314 EXPECT_FALSE(view->UserInputScrollable(kHorizontalScrollbar)); | 2314 EXPECT_FALSE(view->UserInputScrollable(kHorizontalScrollbar)); |
2315 } | 2315 } |
2316 | 2316 |
2317 TEST_F(WebFrameTest, IgnoreOverflowHiddenQuirk) { | 2317 TEST_F(WebFrameTest, IgnoreOverflowHiddenQuirk) { |
2318 RegisterMockedHttpURLLoad("body-overflow-hidden.html"); | 2318 RegisterMockedHttpURLLoad("body-overflow-hidden.html"); |
2319 | 2319 |
2320 FixedLayoutTestWebViewClient client; | 2320 FixedLayoutTestWebViewClient client; |
2321 client.screen_info_.device_scale_factor = 1; | 2321 client.screen_info_.device_scale_factor = 1; |
2322 int viewport_width = 640; | 2322 int viewport_width = 640; |
2323 int viewport_height = 480; | 2323 int viewport_height = 480; |
2324 | 2324 |
2325 FrameTestHelpers::WebViewHelper web_view_helper; | 2325 FrameTestHelpers::WebViewHelper web_view_helper; |
2326 web_view_helper.Initialize(nullptr, &client); | 2326 web_view_helper.Initialize(nullptr, &client); |
2327 web_view_helper.WebView() | 2327 web_view_helper.WebView() |
2328 ->GetSettings() | 2328 ->GetSettings() |
2329 ->SetIgnoreMainFrameOverflowHiddenQuirk(true); | 2329 ->SetIgnoreMainFrameOverflowHiddenQuirk(true); |
2330 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2330 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2331 base_url_ + "body-overflow-hidden.html"); | 2331 base_url_ + "body-overflow-hidden.html"); |
2332 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2332 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2333 | 2333 |
2334 LocalFrameView* view = | 2334 LocalFrameView* view = |
2335 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); | 2335 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); |
2336 EXPECT_TRUE(view->UserInputScrollable(kVerticalScrollbar)); | 2336 EXPECT_TRUE(view->UserInputScrollable(kVerticalScrollbar)); |
2337 } | 2337 } |
2338 | 2338 |
2339 TEST_P(ParameterizedWebFrameTest, NonZeroValuesNoQuirk) { | 2339 TEST_P(ParameterizedWebFrameTest, NonZeroValuesNoQuirk) { |
2340 RegisterMockedHttpURLLoad("viewport-nonzero-values.html"); | 2340 RegisterMockedHttpURLLoad("viewport-nonzero-values.html"); |
2341 | 2341 |
2342 FixedLayoutTestWebViewClient client; | 2342 FixedLayoutTestWebViewClient client; |
2343 client.screen_info_.device_scale_factor = 1; | 2343 client.screen_info_.device_scale_factor = 1; |
2344 int viewport_width = 640; | 2344 int viewport_width = 640; |
2345 int viewport_height = 480; | 2345 int viewport_height = 480; |
2346 float expected_page_scale_factor = 0.5f; | 2346 float expected_page_scale_factor = 0.5f; |
2347 | 2347 |
2348 FrameTestHelpers::WebViewHelper web_view_helper; | 2348 FrameTestHelpers::WebViewHelper web_view_helper; |
2349 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); | 2349 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); |
2350 web_view_helper.WebView()->GetSettings()->SetViewportMetaZeroValuesQuirk( | 2350 web_view_helper.WebView()->GetSettings()->SetViewportMetaZeroValuesQuirk( |
2351 true); | 2351 true); |
2352 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); | 2352 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); |
2353 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2353 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2354 base_url_ + "viewport-nonzero-values.html"); | 2354 base_url_ + "viewport-nonzero-values.html"); |
2355 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2355 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2356 | 2356 |
2357 EXPECT_EQ(viewport_width / expected_page_scale_factor, | 2357 EXPECT_EQ(viewport_width / expected_page_scale_factor, |
2358 web_view_helper.WebView() | 2358 web_view_helper.WebView() |
2359 ->MainFrameImpl() | 2359 ->MainFrameImpl() |
2360 ->GetFrameView() | 2360 ->GetFrameView() |
2361 ->GetLayoutSize() | 2361 ->GetLayoutSize() |
2362 .Width()); | 2362 .Width()); |
2363 EXPECT_EQ(expected_page_scale_factor, | 2363 EXPECT_EQ(expected_page_scale_factor, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2454 RegisterMockedHttpURLLoad("fixed_layout.html"); | 2454 RegisterMockedHttpURLLoad("fixed_layout.html"); |
2455 | 2455 |
2456 FixedLayoutTestWebViewClient client; | 2456 FixedLayoutTestWebViewClient client; |
2457 client.screen_info_.device_scale_factor = 1; | 2457 client.screen_info_.device_scale_factor = 1; |
2458 int viewport_width = 640; | 2458 int viewport_width = 640; |
2459 int viewport_height = 480; | 2459 int viewport_height = 480; |
2460 | 2460 |
2461 FrameTestHelpers::WebViewHelper web_view_helper; | 2461 FrameTestHelpers::WebViewHelper web_view_helper; |
2462 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); | 2462 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); |
2463 web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); | 2463 web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); |
2464 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2464 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2465 base_url_ + "fixed_layout.html"); | 2465 base_url_ + "fixed_layout.html"); |
2466 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2466 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2467 | 2467 |
2468 int default_fixed_layout_width = 980; | 2468 int default_fixed_layout_width = 980; |
2469 float minimum_page_scale_factor = | 2469 float minimum_page_scale_factor = |
2470 viewport_width / (float)default_fixed_layout_width; | 2470 viewport_width / (float)default_fixed_layout_width; |
2471 EXPECT_EQ(minimum_page_scale_factor, | 2471 EXPECT_EQ(minimum_page_scale_factor, |
2472 ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) | 2472 ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) |
2473 ->Loader() | 2473 ->Loader() |
2474 .GetDocumentLoader() | 2474 .GetDocumentLoader() |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2947 .Width()); | 2947 .Width()); |
2948 } | 2948 } |
2949 | 2949 |
2950 TEST_P(ParameterizedWebFrameTest, AtViewportAffectingAtMediaRecalcCount) { | 2950 TEST_P(ParameterizedWebFrameTest, AtViewportAffectingAtMediaRecalcCount) { |
2951 RegisterMockedHttpURLLoad("viewport-and-media.html"); | 2951 RegisterMockedHttpURLLoad("viewport-and-media.html"); |
2952 | 2952 |
2953 FixedLayoutTestWebViewClient client; | 2953 FixedLayoutTestWebViewClient client; |
2954 FrameTestHelpers::WebViewHelper web_view_helper; | 2954 FrameTestHelpers::WebViewHelper web_view_helper; |
2955 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); | 2955 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); |
2956 web_view_helper.Resize(WebSize(640, 480)); | 2956 web_view_helper.Resize(WebSize(640, 480)); |
2957 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2957 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2958 base_url_ + "viewport-and-media.html"); | 2958 base_url_ + "viewport-and-media.html"); |
2959 | 2959 |
2960 Document* document = | 2960 Document* document = |
2961 web_view_helper.WebView()->MainFrameImpl()->GetFrame()->GetDocument(); | 2961 web_view_helper.WebView()->MainFrameImpl()->GetFrame()->GetDocument(); |
2962 EXPECT_EQ(2000, web_view_helper.WebView() | 2962 EXPECT_EQ(2000, web_view_helper.WebView() |
2963 ->MainFrameImpl() | 2963 ->MainFrameImpl() |
2964 ->GetFrameView() | 2964 ->GetFrameView() |
2965 ->GetLayoutSize() | 2965 ->GetLayoutSize() |
2966 .Width()); | 2966 .Width()); |
2967 | 2967 |
2968 // The styleForElementCount() should match the number of elements for a single | 2968 // The styleForElementCount() should match the number of elements for a single |
2969 // pass of computed styles construction for the document. | 2969 // pass of computed styles construction for the document. |
2970 EXPECT_EQ(10u, document->GetStyleEngine().StyleForElementCount()); | 2970 EXPECT_EQ(10u, document->GetStyleEngine().StyleForElementCount()); |
2971 EXPECT_EQ(Color(0, 128, 0), | 2971 EXPECT_EQ(Color(0, 128, 0), |
2972 document->body()->GetComputedStyle()->VisitedDependentColor( | 2972 document->body()->GetComputedStyle()->VisitedDependentColor( |
2973 CSSPropertyColor)); | 2973 CSSPropertyColor)); |
2974 } | 2974 } |
2975 | 2975 |
2976 TEST_P(ParameterizedWebFrameTest, AtViewportWithViewportLengths) { | 2976 TEST_P(ParameterizedWebFrameTest, AtViewportWithViewportLengths) { |
2977 RegisterMockedHttpURLLoad("viewport-lengths.html"); | 2977 RegisterMockedHttpURLLoad("viewport-lengths.html"); |
2978 | 2978 |
2979 FixedLayoutTestWebViewClient client; | 2979 FixedLayoutTestWebViewClient client; |
2980 FrameTestHelpers::WebViewHelper web_view_helper; | 2980 FrameTestHelpers::WebViewHelper web_view_helper; |
2981 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); | 2981 web_view_helper.Initialize(nullptr, &client, nullptr, ConfigureAndroid); |
2982 web_view_helper.Resize(WebSize(800, 600)); | 2982 web_view_helper.Resize(WebSize(800, 600)); |
2983 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2983 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2984 base_url_ + "viewport-lengths.html"); | 2984 base_url_ + "viewport-lengths.html"); |
2985 | 2985 |
2986 LocalFrameView* view = | 2986 LocalFrameView* view = |
2987 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); | 2987 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); |
2988 EXPECT_EQ(400, view->GetLayoutSize().Width()); | 2988 EXPECT_EQ(400, view->GetLayoutSize().Width()); |
2989 EXPECT_EQ(300, view->GetLayoutSize().Height()); | 2989 EXPECT_EQ(300, view->GetLayoutSize().Height()); |
2990 | 2990 |
2991 web_view_helper.Resize(WebSize(1000, 400)); | 2991 web_view_helper.Resize(WebSize(1000, 400)); |
2992 | 2992 |
2993 EXPECT_EQ(500, view->GetLayoutSize().Width()); | 2993 EXPECT_EQ(500, view->GetLayoutSize().Width()); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3200 int view_height = 500; | 3200 int view_height = 500; |
3201 | 3201 |
3202 std::unique_ptr<FakeCompositingWebViewClient> | 3202 std::unique_ptr<FakeCompositingWebViewClient> |
3203 fake_compositing_web_view_client = | 3203 fake_compositing_web_view_client = |
3204 WTF::MakeUnique<FakeCompositingWebViewClient>(); | 3204 WTF::MakeUnique<FakeCompositingWebViewClient>(); |
3205 FrameTestHelpers::WebViewHelper web_view_helper; | 3205 FrameTestHelpers::WebViewHelper web_view_helper; |
3206 web_view_helper.Initialize(nullptr, fake_compositing_web_view_client.get(), | 3206 web_view_helper.Initialize(nullptr, fake_compositing_web_view_client.get(), |
3207 nullptr, &ConfigureCompositingWebView); | 3207 nullptr, &ConfigureCompositingWebView); |
3208 | 3208 |
3209 web_view_helper.Resize(WebSize(view_width, view_height)); | 3209 web_view_helper.Resize(WebSize(view_width, view_height)); |
3210 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 3210 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
3211 base_url_ + "large-div.html"); | 3211 base_url_ + "large-div.html"); |
3212 | 3212 |
3213 LocalFrameView* view = | 3213 LocalFrameView* view = |
3214 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); | 3214 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); |
3215 EXPECT_TRUE( | 3215 EXPECT_TRUE( |
3216 view->GetLayoutViewItem().Compositor()->LayerForHorizontalScrollbar()); | 3216 view->GetLayoutViewItem().Compositor()->LayerForHorizontalScrollbar()); |
3217 EXPECT_TRUE( | 3217 EXPECT_TRUE( |
3218 view->GetLayoutViewItem().Compositor()->LayerForVerticalScrollbar()); | 3218 view->GetLayoutViewItem().Compositor()->LayerForVerticalScrollbar()); |
3219 | 3219 |
3220 web_view_helper.Resize(WebSize(view_width * 10, view_height * 10)); | 3220 web_view_helper.Resize(WebSize(view_width * 10, view_height * 10)); |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4190 | 4190 |
4191 TEST_P(ParameterizedWebFrameTest, ReloadDoesntSetRedirect) { | 4191 TEST_P(ParameterizedWebFrameTest, ReloadDoesntSetRedirect) { |
4192 // Test for case in http://crbug.com/73104. Reloading a frame very quickly | 4192 // Test for case in http://crbug.com/73104. Reloading a frame very quickly |
4193 // would sometimes call decidePolicyForNavigation with isRedirect=true | 4193 // would sometimes call decidePolicyForNavigation with isRedirect=true |
4194 RegisterMockedHttpURLLoad("form.html"); | 4194 RegisterMockedHttpURLLoad("form.html"); |
4195 | 4195 |
4196 TestReloadDoesntRedirectWebFrameClient web_frame_client; | 4196 TestReloadDoesntRedirectWebFrameClient web_frame_client; |
4197 FrameTestHelpers::WebViewHelper web_view_helper; | 4197 FrameTestHelpers::WebViewHelper web_view_helper; |
4198 web_view_helper.InitializeAndLoad(base_url_ + "form.html", &web_frame_client); | 4198 web_view_helper.InitializeAndLoad(base_url_ + "form.html", &web_frame_client); |
4199 | 4199 |
4200 web_view_helper.WebView()->MainFrame()->Reload( | 4200 web_view_helper.WebView()->MainFrameImpl()->Reload( |
4201 WebFrameLoadType::kReloadBypassingCache); | 4201 WebFrameLoadType::kReloadBypassingCache); |
4202 // start another reload before request is delivered. | 4202 // start another reload before request is delivered. |
4203 FrameTestHelpers::ReloadFrameBypassingCache( | 4203 FrameTestHelpers::ReloadFrameBypassingCache( |
4204 web_view_helper.WebView()->MainFrame()); | 4204 web_view_helper.WebView()->MainFrameImpl()); |
4205 } | 4205 } |
4206 | 4206 |
4207 class ClearScrollStateOnCommitWebFrameClient | 4207 class ClearScrollStateOnCommitWebFrameClient |
4208 : public FrameTestHelpers::TestWebFrameClient { | 4208 : public FrameTestHelpers::TestWebFrameClient { |
4209 public: | 4209 public: |
4210 void DidCommitProvisionalLoad(const WebHistoryItem&, | 4210 void DidCommitProvisionalLoad(const WebHistoryItem&, |
4211 WebHistoryCommitType) override { | 4211 WebHistoryCommitType) override { |
4212 Frame()->View()->ResetScrollAndScaleState(); | 4212 Frame()->View()->ResetScrollAndScaleState(); |
4213 } | 4213 } |
4214 }; | 4214 }; |
(...skipping 12 matching lines...) Expand all Loading... |
4227 | 4227 |
4228 ClearScrollStateOnCommitWebFrameClient client; | 4228 ClearScrollStateOnCommitWebFrameClient client; |
4229 FrameTestHelpers::WebViewHelper web_view_helper; | 4229 FrameTestHelpers::WebViewHelper web_view_helper; |
4230 web_view_helper.InitializeAndLoad(base_url_ + first_url, &client); | 4230 web_view_helper.InitializeAndLoad(base_url_ + first_url, &client); |
4231 web_view_helper.Resize(WebSize(kPageWidth, kPageHeight)); | 4231 web_view_helper.Resize(WebSize(kPageWidth, kPageHeight)); |
4232 web_view_helper.WebView()->MainFrame()->SetScrollOffset( | 4232 web_view_helper.WebView()->MainFrame()->SetScrollOffset( |
4233 WebSize(kPageWidth / 4, kPageHeight / 4)); | 4233 WebSize(kPageWidth / 4, kPageHeight / 4)); |
4234 web_view_helper.WebView()->SetPageScaleFactor(kPageScaleFactor); | 4234 web_view_helper.WebView()->SetPageScaleFactor(kPageScaleFactor); |
4235 | 4235 |
4236 // Reload the page and end up at the same url. State should not be propagated. | 4236 // Reload the page and end up at the same url. State should not be propagated. |
4237 web_view_helper.WebView()->MainFrame()->ReloadWithOverrideURL( | 4237 web_view_helper.WebView()->MainFrameImpl()->ReloadWithOverrideURL( |
4238 ToKURL(base_url_ + first_url), WebFrameLoadType::kReload); | 4238 ToKURL(base_url_ + first_url), WebFrameLoadType::kReload); |
4239 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( | 4239 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( |
4240 web_view_helper.WebView()->MainFrame()); | 4240 web_view_helper.WebView()->MainFrame()); |
4241 EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width); | 4241 EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width); |
4242 EXPECT_EQ(0, | 4242 EXPECT_EQ(0, |
4243 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height); | 4243 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height); |
4244 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); | 4244 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); |
4245 | 4245 |
4246 // Reload the page using the cache. State should not be propagated. | 4246 // Reload the page using the cache. State should not be propagated. |
4247 web_view_helper.WebView()->MainFrame()->ReloadWithOverrideURL( | 4247 web_view_helper.WebView()->MainFrameImpl()->ReloadWithOverrideURL( |
4248 ToKURL(base_url_ + second_url), WebFrameLoadType::kReload); | 4248 ToKURL(base_url_ + second_url), WebFrameLoadType::kReload); |
4249 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( | 4249 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( |
4250 web_view_helper.WebView()->MainFrame()); | 4250 web_view_helper.WebView()->MainFrame()); |
4251 EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width); | 4251 EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width); |
4252 EXPECT_EQ(0, | 4252 EXPECT_EQ(0, |
4253 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height); | 4253 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height); |
4254 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); | 4254 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); |
4255 | 4255 |
4256 // Reload the page while bypassing the cache. State should not be propagated. | 4256 // Reload the page while bypassing the cache. State should not be propagated. |
4257 web_view_helper.WebView()->MainFrame()->ReloadWithOverrideURL( | 4257 web_view_helper.WebView()->MainFrameImpl()->ReloadWithOverrideURL( |
4258 ToKURL(base_url_ + third_url), WebFrameLoadType::kReloadBypassingCache); | 4258 ToKURL(base_url_ + third_url), WebFrameLoadType::kReloadBypassingCache); |
4259 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( | 4259 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( |
4260 web_view_helper.WebView()->MainFrame()); | 4260 web_view_helper.WebView()->MainFrame()); |
4261 EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width); | 4261 EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width); |
4262 EXPECT_EQ(0, | 4262 EXPECT_EQ(0, |
4263 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height); | 4263 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height); |
4264 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); | 4264 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); |
4265 } | 4265 } |
4266 | 4266 |
4267 TEST_P(ParameterizedWebFrameTest, ReloadWhileProvisional) { | 4267 TEST_P(ParameterizedWebFrameTest, ReloadWhileProvisional) { |
4268 // Test that reloading while the previous load is still pending does not cause | 4268 // Test that reloading while the previous load is still pending does not cause |
4269 // the initial request to get lost. | 4269 // the initial request to get lost. |
4270 RegisterMockedHttpURLLoad("fixed_layout.html"); | 4270 RegisterMockedHttpURLLoad("fixed_layout.html"); |
4271 | 4271 |
4272 FrameTestHelpers::WebViewHelper web_view_helper; | 4272 FrameTestHelpers::WebViewHelper web_view_helper; |
4273 web_view_helper.Initialize(); | 4273 web_view_helper.Initialize(); |
4274 WebURLRequest request(ToKURL(base_url_ + "fixed_layout.html")); | 4274 WebURLRequest request(ToKURL(base_url_ + "fixed_layout.html")); |
4275 web_view_helper.WebView()->MainFrame()->LoadRequest(request); | 4275 web_view_helper.WebView()->MainFrameImpl()->LoadRequest(request); |
4276 // start reload before first request is delivered. | 4276 // start reload before first request is delivered. |
4277 FrameTestHelpers::ReloadFrameBypassingCache( | 4277 FrameTestHelpers::ReloadFrameBypassingCache( |
4278 web_view_helper.WebView()->MainFrame()); | 4278 web_view_helper.WebView()->MainFrameImpl()); |
4279 | 4279 |
4280 WebDataSource* data_source = | 4280 WebDataSource* data_source = |
4281 web_view_helper.WebView()->MainFrameImpl()->DataSource(); | 4281 web_view_helper.WebView()->MainFrameImpl()->DataSource(); |
4282 ASSERT_TRUE(data_source); | 4282 ASSERT_TRUE(data_source); |
4283 EXPECT_EQ(ToKURL(base_url_ + "fixed_layout.html"), | 4283 EXPECT_EQ(ToKURL(base_url_ + "fixed_layout.html"), |
4284 KURL(data_source->GetRequest().Url())); | 4284 KURL(data_source->GetRequest().Url())); |
4285 } | 4285 } |
4286 | 4286 |
4287 TEST_P(ParameterizedWebFrameTest, AppendRedirects) { | 4287 TEST_P(ParameterizedWebFrameTest, AppendRedirects) { |
4288 const std::string first_url = "about:blank"; | 4288 const std::string first_url = "about:blank"; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4528 Vector<std::unique_ptr<ContextLifetimeTestWebFrameClient::Notification>> | 4528 Vector<std::unique_ptr<ContextLifetimeTestWebFrameClient::Notification>> |
4529 release_notifications; | 4529 release_notifications; |
4530 ContextLifetimeTestWebFrameClient web_frame_client(create_notifications, | 4530 ContextLifetimeTestWebFrameClient web_frame_client(create_notifications, |
4531 release_notifications); | 4531 release_notifications); |
4532 FrameTestHelpers::WebViewHelper web_view_helper; | 4532 FrameTestHelpers::WebViewHelper web_view_helper; |
4533 web_view_helper.InitializeAndLoad( | 4533 web_view_helper.InitializeAndLoad( |
4534 base_url_ + "context_notifications_test.html", &web_frame_client); | 4534 base_url_ + "context_notifications_test.html", &web_frame_client); |
4535 | 4535 |
4536 // Refresh, we should get two release notifications and two more create | 4536 // Refresh, we should get two release notifications and two more create |
4537 // notifications. | 4537 // notifications. |
4538 FrameTestHelpers::ReloadFrame(web_view_helper.WebView()->MainFrame()); | 4538 FrameTestHelpers::ReloadFrame(web_view_helper.WebView()->MainFrameImpl()); |
4539 ASSERT_EQ(4u, create_notifications.size()); | 4539 ASSERT_EQ(4u, create_notifications.size()); |
4540 ASSERT_EQ(2u, release_notifications.size()); | 4540 ASSERT_EQ(2u, release_notifications.size()); |
4541 | 4541 |
4542 // The two release notifications we got should be exactly the same as the | 4542 // The two release notifications we got should be exactly the same as the |
4543 // first two create notifications. | 4543 // first two create notifications. |
4544 for (size_t i = 0; i < release_notifications.size(); ++i) { | 4544 for (size_t i = 0; i < release_notifications.size(); ++i) { |
4545 EXPECT_TRUE(release_notifications[i]->Equals( | 4545 EXPECT_TRUE(release_notifications[i]->Equals( |
4546 create_notifications[create_notifications.size() - 3 - i].get())); | 4546 create_notifications[create_notifications.size() - 3 - i].get())); |
4547 } | 4547 } |
4548 | 4548 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4775 }; | 4775 }; |
4776 | 4776 |
4777 TEST_P(ParameterizedWebFrameTest, ExecuteScriptDuringDidCreateScriptContext) { | 4777 TEST_P(ParameterizedWebFrameTest, ExecuteScriptDuringDidCreateScriptContext) { |
4778 RegisterMockedHttpURLLoad("hello_world.html"); | 4778 RegisterMockedHttpURLLoad("hello_world.html"); |
4779 | 4779 |
4780 TestExecuteScriptDuringDidCreateScriptContext web_frame_client; | 4780 TestExecuteScriptDuringDidCreateScriptContext web_frame_client; |
4781 FrameTestHelpers::WebViewHelper web_view_helper; | 4781 FrameTestHelpers::WebViewHelper web_view_helper; |
4782 web_view_helper.InitializeAndLoad(base_url_ + "hello_world.html", | 4782 web_view_helper.InitializeAndLoad(base_url_ + "hello_world.html", |
4783 &web_frame_client); | 4783 &web_frame_client); |
4784 | 4784 |
4785 FrameTestHelpers::ReloadFrame(web_view_helper.WebView()->MainFrame()); | 4785 FrameTestHelpers::ReloadFrame(web_view_helper.WebView()->MainFrameImpl()); |
4786 } | 4786 } |
4787 | 4787 |
4788 class FindUpdateWebFrameClient : public FrameTestHelpers::TestWebFrameClient { | 4788 class FindUpdateWebFrameClient : public FrameTestHelpers::TestWebFrameClient { |
4789 public: | 4789 public: |
4790 FindUpdateWebFrameClient() | 4790 FindUpdateWebFrameClient() |
4791 : find_results_are_ready_(false), count_(-1), active_index_(-1) {} | 4791 : find_results_are_ready_(false), count_(-1), active_index_(-1) {} |
4792 | 4792 |
4793 void ReportFindInPageMatchCount(int, int count, bool final_update) override { | 4793 void ReportFindInPageMatchCount(int, int count, bool final_update) override { |
4794 count_ = count; | 4794 count_ = count; |
4795 if (final_update) | 4795 if (final_update) |
(...skipping 1117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5913 | 5913 |
5914 web_view_helper_.Initialize(nullptr, &fake_selection_web_view_client_); | 5914 web_view_helper_.Initialize(nullptr, &fake_selection_web_view_client_); |
5915 web_view_helper_.WebView()->GetSettings()->SetDefaultFontSize(12); | 5915 web_view_helper_.WebView()->GetSettings()->SetDefaultFontSize(12); |
5916 web_view_helper_.WebView()->SetDefaultPageScaleLimits(1, 1); | 5916 web_view_helper_.WebView()->SetDefaultPageScaleLimits(1, 1); |
5917 web_view_helper_.Resize(WebSize(640, 480)); | 5917 web_view_helper_.Resize(WebSize(640, 480)); |
5918 } | 5918 } |
5919 | 5919 |
5920 void RunTestWithNoSelection(const char* test_file) { | 5920 void RunTestWithNoSelection(const char* test_file) { |
5921 RegisterMockedHttpURLLoad(test_file); | 5921 RegisterMockedHttpURLLoad(test_file); |
5922 web_view_helper_.WebView()->SetFocus(true); | 5922 web_view_helper_.WebView()->SetFocus(true); |
5923 FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrame(), | 5923 FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrameImpl(), |
5924 base_url_ + test_file); | 5924 base_url_ + test_file); |
5925 web_view_helper_.WebView()->UpdateAllLifecyclePhases(); | 5925 web_view_helper_.WebView()->UpdateAllLifecyclePhases(); |
5926 | 5926 |
5927 const WebSelection* selection = fake_selection_layer_tree_view_.Selection(); | 5927 const WebSelection* selection = fake_selection_layer_tree_view_.Selection(); |
5928 const WebSelectionBound* select_start = | 5928 const WebSelectionBound* select_start = |
5929 fake_selection_layer_tree_view_.Start(); | 5929 fake_selection_layer_tree_view_.Start(); |
5930 const WebSelectionBound* select_end = fake_selection_layer_tree_view_.end(); | 5930 const WebSelectionBound* select_end = fake_selection_layer_tree_view_.end(); |
5931 | 5931 |
5932 EXPECT_FALSE(selection); | 5932 EXPECT_FALSE(selection); |
5933 EXPECT_FALSE(select_start); | 5933 EXPECT_FALSE(select_start); |
5934 EXPECT_FALSE(select_end); | 5934 EXPECT_FALSE(select_end); |
5935 } | 5935 } |
5936 | 5936 |
5937 void RunTest(const char* test_file) { | 5937 void RunTest(const char* test_file) { |
5938 RegisterMockedHttpURLLoad(test_file); | 5938 RegisterMockedHttpURLLoad(test_file); |
5939 web_view_helper_.WebView()->SetFocus(true); | 5939 web_view_helper_.WebView()->SetFocus(true); |
5940 FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrame(), | 5940 FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrameImpl(), |
5941 base_url_ + test_file); | 5941 base_url_ + test_file); |
5942 web_view_helper_.WebView()->UpdateAllLifecyclePhases(); | 5942 web_view_helper_.WebView()->UpdateAllLifecyclePhases(); |
5943 | 5943 |
5944 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | 5944 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
5945 v8::Local<v8::Value> result = | 5945 v8::Local<v8::Value> result = |
5946 web_view_helper_.WebView() | 5946 web_view_helper_.WebView() |
5947 ->MainFrameImpl() | 5947 ->MainFrameImpl() |
5948 ->ExecuteScriptAndReturnValue(WebScriptSource("expectedResult")); | 5948 ->ExecuteScriptAndReturnValue(WebScriptSource("expectedResult")); |
5949 ASSERT_FALSE(result.IsEmpty() || (*result)->IsUndefined()); | 5949 ASSERT_FALSE(result.IsEmpty() || (*result)->IsUndefined()); |
5950 | 5950 |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6434 | 6434 |
6435 private: | 6435 private: |
6436 bool commit_called_; | 6436 bool commit_called_; |
6437 }; | 6437 }; |
6438 | 6438 |
6439 TEST_P(ParameterizedWebFrameTest, ReplaceNavigationAfterHistoryNavigation) { | 6439 TEST_P(ParameterizedWebFrameTest, ReplaceNavigationAfterHistoryNavigation) { |
6440 TestSubstituteDataWebFrameClient web_frame_client; | 6440 TestSubstituteDataWebFrameClient web_frame_client; |
6441 | 6441 |
6442 FrameTestHelpers::WebViewHelper web_view_helper; | 6442 FrameTestHelpers::WebViewHelper web_view_helper; |
6443 web_view_helper.InitializeAndLoad("about:blank", &web_frame_client); | 6443 web_view_helper.InitializeAndLoad("about:blank", &web_frame_client); |
6444 WebFrame* frame = web_view_helper.WebView()->MainFrame(); | 6444 WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); |
6445 | 6445 |
6446 // Load a url as a history navigation that will return an error. | 6446 // Load a url as a history navigation that will return an error. |
6447 // TestSubstituteDataWebFrameClient will start a SubstituteData load in | 6447 // TestSubstituteDataWebFrameClient will start a SubstituteData load in |
6448 // response to the load failure, which should get fully committed. Due to | 6448 // response to the load failure, which should get fully committed. Due to |
6449 // https://bugs.webkit.org/show_bug.cgi?id=91685, | 6449 // https://bugs.webkit.org/show_bug.cgi?id=91685, |
6450 // FrameLoader::didReceiveData() wasn't getting called in this case, which | 6450 // FrameLoader::didReceiveData() wasn't getting called in this case, which |
6451 // resulted in the SubstituteData document not getting displayed. | 6451 // resulted in the SubstituteData document not getting displayed. |
6452 WebURLError error; | 6452 WebURLError error; |
6453 error.reason = 1337; | 6453 error.reason = 1337; |
6454 error.domain = "WebFrameTest"; | 6454 error.domain = "WebFrameTest"; |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6961 } | 6961 } |
6962 | 6962 |
6963 TEST_P(ParameterizedWebFrameTest, DidAccessInitialDocumentViaJavascriptUrl) { | 6963 TEST_P(ParameterizedWebFrameTest, DidAccessInitialDocumentViaJavascriptUrl) { |
6964 TestAccessInitialDocumentWebFrameClient web_frame_client; | 6964 TestAccessInitialDocumentWebFrameClient web_frame_client; |
6965 FrameTestHelpers::WebViewHelper web_view_helper; | 6965 FrameTestHelpers::WebViewHelper web_view_helper; |
6966 web_view_helper.Initialize(&web_frame_client); | 6966 web_view_helper.Initialize(&web_frame_client); |
6967 RunPendingTasks(); | 6967 RunPendingTasks(); |
6968 EXPECT_EQ(0, web_frame_client.did_access_initial_document_); | 6968 EXPECT_EQ(0, web_frame_client.did_access_initial_document_); |
6969 | 6969 |
6970 // Access the initial document from a javascript: URL. | 6970 // Access the initial document from a javascript: URL. |
6971 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 6971 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
6972 "javascript:document.body.appendChild(document." | 6972 "javascript:document.body.appendChild(document." |
6973 "createTextNode('Modified'))"); | 6973 "createTextNode('Modified'))"); |
6974 EXPECT_EQ(1, web_frame_client.did_access_initial_document_); | 6974 EXPECT_EQ(1, web_frame_client.did_access_initial_document_); |
6975 | 6975 |
6976 web_view_helper.Reset(); | 6976 web_view_helper.Reset(); |
6977 } | 6977 } |
6978 | 6978 |
6979 TEST_P(ParameterizedWebFrameTest, DidAccessInitialDocumentBodyBeforeModalDialog) | 6979 TEST_P(ParameterizedWebFrameTest, DidAccessInitialDocumentBodyBeforeModalDialog) |
6980 { | 6980 { |
6981 TestAccessInitialDocumentWebFrameClient web_frame_client; | 6981 TestAccessInitialDocumentWebFrameClient web_frame_client; |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7294 EXPECT_EQ(WebCachePolicy::kValidatingCacheData, | 7294 EXPECT_EQ(WebCachePolicy::kValidatingCacheData, |
7295 frame->DataSource()->GetRequest().GetCachePolicy()); | 7295 frame->DataSource()->GetRequest().GetCachePolicy()); |
7296 } | 7296 } |
7297 | 7297 |
7298 TEST_P(ParameterizedWebFrameTest, BackDuringChildFrameReload) { | 7298 TEST_P(ParameterizedWebFrameTest, BackDuringChildFrameReload) { |
7299 RegisterMockedHttpURLLoad("page_with_blank_iframe.html"); | 7299 RegisterMockedHttpURLLoad("page_with_blank_iframe.html"); |
7300 FrameTestHelpers::WebViewHelper web_view_helper; | 7300 FrameTestHelpers::WebViewHelper web_view_helper; |
7301 web_view_helper.InitializeAndLoad(base_url_ + "page_with_blank_iframe.html"); | 7301 web_view_helper.InitializeAndLoad(base_url_ + "page_with_blank_iframe.html"); |
7302 WebLocalFrameBase* main_frame = web_view_helper.LocalMainFrame(); | 7302 WebLocalFrameBase* main_frame = web_view_helper.LocalMainFrame(); |
7303 const FrameLoader& main_frame_loader = main_frame->GetFrame()->Loader(); | 7303 const FrameLoader& main_frame_loader = main_frame->GetFrame()->Loader(); |
7304 WebFrame* child_frame = main_frame->FirstChild(); | 7304 WebLocalFrame* child_frame = main_frame->FirstChild()->ToWebLocalFrame(); |
7305 ASSERT_TRUE(child_frame); | 7305 ASSERT_TRUE(child_frame); |
7306 | 7306 |
7307 // Start a history navigation, then have a different frame commit a | 7307 // Start a history navigation, then have a different frame commit a |
7308 // navigation. In this case, reload an about:blank frame, which will commit | 7308 // navigation. In this case, reload an about:blank frame, which will commit |
7309 // synchronously. After the history navigation completes, both the | 7309 // synchronously. After the history navigation completes, both the |
7310 // appropriate document url and the current history item should reflect the | 7310 // appropriate document url and the current history item should reflect the |
7311 // history navigation. | 7311 // history navigation. |
7312 RegisterMockedHttpURLLoad("white-1x1.png"); | 7312 RegisterMockedHttpURLLoad("white-1x1.png"); |
7313 WebHistoryItem item; | 7313 WebHistoryItem item; |
7314 item.Initialize(); | 7314 item.Initialize(); |
7315 WebURL history_url(ToKURL(base_url_ + "white-1x1.png")); | 7315 WebURL history_url(ToKURL(base_url_ + "white-1x1.png")); |
7316 item.SetURLString(history_url.GetString()); | 7316 item.SetURLString(history_url.GetString()); |
7317 WebURLRequest request = main_frame->RequestFromHistoryItem( | 7317 WebURLRequest request = main_frame->RequestFromHistoryItem( |
7318 item, WebCachePolicy::kUseProtocolCachePolicy); | 7318 item, WebCachePolicy::kUseProtocolCachePolicy); |
7319 main_frame->Load(request, WebFrameLoadType::kBackForward, item); | 7319 main_frame->Load(request, WebFrameLoadType::kBackForward, item); |
7320 | 7320 |
7321 FrameTestHelpers::ReloadFrame(child_frame); | 7321 FrameTestHelpers::ReloadFrame(child_frame); |
7322 EXPECT_EQ(item.UrlString(), main_frame->GetDocument().Url().GetString()); | 7322 EXPECT_EQ(item.UrlString(), main_frame->GetDocument().Url().GetString()); |
7323 EXPECT_EQ(item.UrlString(), WebString(main_frame_loader.GetDocumentLoader() | 7323 EXPECT_EQ(item.UrlString(), WebString(main_frame_loader.GetDocumentLoader() |
7324 ->GetHistoryItem() | 7324 ->GetHistoryItem() |
7325 ->UrlString())); | 7325 ->UrlString())); |
7326 } | 7326 } |
7327 | 7327 |
7328 TEST_P(ParameterizedWebFrameTest, ReloadPost) { | 7328 TEST_P(ParameterizedWebFrameTest, ReloadPost) { |
7329 RegisterMockedHttpURLLoad("reload_post.html"); | 7329 RegisterMockedHttpURLLoad("reload_post.html"); |
7330 FrameTestHelpers::WebViewHelper web_view_helper; | 7330 FrameTestHelpers::WebViewHelper web_view_helper; |
7331 web_view_helper.InitializeAndLoad(base_url_ + "reload_post.html"); | 7331 web_view_helper.InitializeAndLoad(base_url_ + "reload_post.html"); |
7332 WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); | 7332 WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); |
7333 | 7333 |
7334 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 7334 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
7335 "javascript:document.forms[0].submit()"); | 7335 "javascript:document.forms[0].submit()"); |
7336 // Pump requests one more time after the javascript URL has executed to | 7336 // Pump requests one more time after the javascript URL has executed to |
7337 // trigger the actual POST load request. | 7337 // trigger the actual POST load request. |
7338 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( | 7338 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( |
7339 web_view_helper.WebView()->MainFrame()); | 7339 web_view_helper.WebView()->MainFrame()); |
7340 EXPECT_EQ(WebString::FromUTF8("POST"), | 7340 EXPECT_EQ(WebString::FromUTF8("POST"), |
7341 frame->DataSource()->GetRequest().HttpMethod()); | 7341 frame->DataSource()->GetRequest().HttpMethod()); |
7342 | 7342 |
7343 FrameTestHelpers::ReloadFrame(frame); | 7343 FrameTestHelpers::ReloadFrame(frame); |
7344 EXPECT_EQ(WebCachePolicy::kValidatingCacheData, | 7344 EXPECT_EQ(WebCachePolicy::kValidatingCacheData, |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7517 NavigateToSameNoConditionalRequestForSubresource) { | 7517 NavigateToSameNoConditionalRequestForSubresource) { |
7518 RegisterMockedHttpURLLoad("foo_with_image.html"); | 7518 RegisterMockedHttpURLLoad("foo_with_image.html"); |
7519 RegisterMockedHttpURLLoad("white-1x1.png"); | 7519 RegisterMockedHttpURLLoad("white-1x1.png"); |
7520 TestSameDocumentWithImageWebFrameClient client; | 7520 TestSameDocumentWithImageWebFrameClient client; |
7521 FrameTestHelpers::WebViewHelper web_view_helper; | 7521 FrameTestHelpers::WebViewHelper web_view_helper; |
7522 web_view_helper.InitializeAndLoad(base_url_ + "foo_with_image.html", &client, | 7522 web_view_helper.InitializeAndLoad(base_url_ + "foo_with_image.html", &client, |
7523 nullptr, nullptr, | 7523 nullptr, nullptr, |
7524 &ConfigureLoadsImagesAutomatically); | 7524 &ConfigureLoadsImagesAutomatically); |
7525 | 7525 |
7526 WebCache::Clear(); | 7526 WebCache::Clear(); |
7527 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 7527 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
7528 base_url_ + "foo_with_image.html"); | 7528 base_url_ + "foo_with_image.html"); |
7529 | 7529 |
7530 // 2 images are requested, and each triggers 2 willSendRequest() calls, | 7530 // 2 images are requested, and each triggers 2 willSendRequest() calls, |
7531 // once for preloading and once for the real request. | 7531 // once for preloading and once for the real request. |
7532 EXPECT_EQ(client.NumOfImageRequests(), 4); | 7532 EXPECT_EQ(client.NumOfImageRequests(), 4); |
7533 } | 7533 } |
7534 | 7534 |
7535 TEST_P(ParameterizedWebFrameTest, WebNodeImageContents) { | 7535 TEST_P(ParameterizedWebFrameTest, WebNodeImageContents) { |
7536 FrameTestHelpers::WebViewHelper web_view_helper; | 7536 FrameTestHelpers::WebViewHelper web_view_helper; |
7537 web_view_helper.InitializeAndLoad("about:blank"); | 7537 web_view_helper.InitializeAndLoad("about:blank"); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7681 | 7681 |
7682 TestHistoryWebFrameClient client; | 7682 TestHistoryWebFrameClient client; |
7683 FrameTestHelpers::WebViewHelper web_view_helper; | 7683 FrameTestHelpers::WebViewHelper web_view_helper; |
7684 web_view_helper.InitializeAndLoad("about:blank", &client); | 7684 web_view_helper.InitializeAndLoad("about:blank", &client); |
7685 | 7685 |
7686 WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); | 7686 WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); |
7687 | 7687 |
7688 frame->ExecuteScript(WebScriptSource(WebString::FromUTF8( | 7688 frame->ExecuteScript(WebScriptSource(WebString::FromUTF8( |
7689 "document.body.appendChild(document.createElement('iframe'))"))); | 7689 "document.body.appendChild(document.createElement('iframe'))"))); |
7690 | 7690 |
7691 WebFrame* iframe = frame->FirstChild(); | 7691 WebLocalFrame* iframe = frame->FirstChild()->ToWebLocalFrame(); |
7692 ASSERT_EQ(&client.ChildClient(), ToWebLocalFrameBase(iframe)->Client()); | 7692 ASSERT_EQ(&client.ChildClient(), ToWebLocalFrameBase(iframe)->Client()); |
7693 | 7693 |
7694 std::string url1 = base_url_ + "history.html"; | 7694 std::string url1 = base_url_ + "history.html"; |
7695 FrameTestHelpers::LoadFrame(iframe, url1); | 7695 FrameTestHelpers::LoadFrame(iframe, url1); |
7696 EXPECT_EQ(url1, iframe->GetDocument().Url().GetString().Utf8()); | 7696 EXPECT_EQ(url1, iframe->GetDocument().Url().GetString().Utf8()); |
7697 EXPECT_TRUE(client.ChildClient().ReplacesCurrentHistoryItem()); | 7697 EXPECT_TRUE(client.ChildClient().ReplacesCurrentHistoryItem()); |
7698 | 7698 |
7699 std::string url2 = base_url_ + "find.html"; | 7699 std::string url2 = base_url_ + "find.html"; |
7700 FrameTestHelpers::LoadFrame(iframe, url2); | 7700 FrameTestHelpers::LoadFrame(iframe, url2); |
7701 EXPECT_EQ(url2, iframe->GetDocument().Url().GetString().Utf8()); | 7701 EXPECT_EQ(url2, iframe->GetDocument().Url().GetString().Utf8()); |
7702 EXPECT_FALSE(client.ChildClient().ReplacesCurrentHistoryItem()); | 7702 EXPECT_FALSE(client.ChildClient().ReplacesCurrentHistoryItem()); |
7703 } | 7703 } |
7704 | 7704 |
7705 // Tests that a navigation in a frame with a non-blank initial URL will create | 7705 // Tests that a navigation in a frame with a non-blank initial URL will create |
7706 // a new history item, unlike the case above. | 7706 // a new history item, unlike the case above. |
7707 TEST_P(ParameterizedWebFrameTest, FirstNonBlankSubframeNavigation) { | 7707 TEST_P(ParameterizedWebFrameTest, FirstNonBlankSubframeNavigation) { |
7708 RegisterMockedHttpURLLoad("history.html"); | 7708 RegisterMockedHttpURLLoad("history.html"); |
7709 RegisterMockedHttpURLLoad("find.html"); | 7709 RegisterMockedHttpURLLoad("find.html"); |
7710 | 7710 |
7711 TestHistoryWebFrameClient client; | 7711 TestHistoryWebFrameClient client; |
7712 FrameTestHelpers::WebViewHelper web_view_helper; | 7712 FrameTestHelpers::WebViewHelper web_view_helper; |
7713 web_view_helper.InitializeAndLoad("about:blank", &client); | 7713 web_view_helper.InitializeAndLoad("about:blank", &client); |
7714 | 7714 |
7715 WebFrame* frame = web_view_helper.WebView()->MainFrame(); | 7715 WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); |
7716 | 7716 |
7717 std::string url1 = base_url_ + "history.html"; | 7717 std::string url1 = base_url_ + "history.html"; |
7718 FrameTestHelpers::LoadFrame( | 7718 FrameTestHelpers::LoadFrame( |
7719 frame, | 7719 frame, |
7720 "javascript:var f = document.createElement('iframe'); " | 7720 "javascript:var f = document.createElement('iframe'); " |
7721 "f.src = '" + | 7721 "f.src = '" + |
7722 url1 + | 7722 url1 + |
7723 "';" | 7723 "';" |
7724 "document.body.appendChild(f)"); | 7724 "document.body.appendChild(f)"); |
7725 | 7725 |
7726 WebFrame* iframe = frame->FirstChild(); | 7726 WebLocalFrame* iframe = frame->FirstChild()->ToWebLocalFrame(); |
7727 EXPECT_EQ(url1, iframe->GetDocument().Url().GetString().Utf8()); | 7727 EXPECT_EQ(url1, iframe->GetDocument().Url().GetString().Utf8()); |
7728 | 7728 |
7729 std::string url2 = base_url_ + "find.html"; | 7729 std::string url2 = base_url_ + "find.html"; |
7730 FrameTestHelpers::LoadFrame(iframe, url2); | 7730 FrameTestHelpers::LoadFrame(iframe, url2); |
7731 EXPECT_EQ(url2, iframe->GetDocument().Url().GetString().Utf8()); | 7731 EXPECT_EQ(url2, iframe->GetDocument().Url().GetString().Utf8()); |
7732 EXPECT_FALSE(client.ChildClient().ReplacesCurrentHistoryItem()); | 7732 EXPECT_FALSE(client.ChildClient().ReplacesCurrentHistoryItem()); |
7733 } | 7733 } |
7734 | 7734 |
7735 // Test verifies that layout will change a layer's scrollable attibutes | 7735 // Test verifies that layout will change a layer's scrollable attibutes |
7736 TEST_F(WebFrameTest, overflowHiddenRewrite) { | 7736 TEST_F(WebFrameTest, overflowHiddenRewrite) { |
7737 RegisterMockedHttpURLLoad("non-scrollable.html"); | 7737 RegisterMockedHttpURLLoad("non-scrollable.html"); |
7738 std::unique_ptr<FakeCompositingWebViewClient> | 7738 std::unique_ptr<FakeCompositingWebViewClient> |
7739 fake_compositing_web_view_client = | 7739 fake_compositing_web_view_client = |
7740 WTF::MakeUnique<FakeCompositingWebViewClient>(); | 7740 WTF::MakeUnique<FakeCompositingWebViewClient>(); |
7741 FrameTestHelpers::WebViewHelper web_view_helper; | 7741 FrameTestHelpers::WebViewHelper web_view_helper; |
7742 web_view_helper.Initialize(nullptr, fake_compositing_web_view_client.get(), | 7742 web_view_helper.Initialize(nullptr, fake_compositing_web_view_client.get(), |
7743 nullptr, &ConfigureCompositingWebView); | 7743 nullptr, &ConfigureCompositingWebView); |
7744 | 7744 |
7745 web_view_helper.Resize(WebSize(100, 100)); | 7745 web_view_helper.Resize(WebSize(100, 100)); |
7746 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 7746 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
7747 base_url_ + "non-scrollable.html"); | 7747 base_url_ + "non-scrollable.html"); |
7748 | 7748 |
7749 PaintLayerCompositor* compositor = web_view_helper.WebView()->Compositor(); | 7749 PaintLayerCompositor* compositor = web_view_helper.WebView()->Compositor(); |
7750 ASSERT_TRUE(compositor->ScrollLayer()); | 7750 ASSERT_TRUE(compositor->ScrollLayer()); |
7751 | 7751 |
7752 // Verify that the WebLayer is not scrollable initially. | 7752 // Verify that the WebLayer is not scrollable initially. |
7753 GraphicsLayer* scroll_layer = compositor->ScrollLayer(); | 7753 GraphicsLayer* scroll_layer = compositor->ScrollLayer(); |
7754 WebLayer* web_scroll_layer = scroll_layer->PlatformLayer(); | 7754 WebLayer* web_scroll_layer = scroll_layer->PlatformLayer(); |
7755 ASSERT_FALSE(web_scroll_layer->UserScrollableHorizontal()); | 7755 ASSERT_FALSE(web_scroll_layer->UserScrollableHorizontal()); |
7756 ASSERT_FALSE(web_scroll_layer->UserScrollableVertical()); | 7756 ASSERT_FALSE(web_scroll_layer->UserScrollableVertical()); |
7757 | 7757 |
7758 // Call javascript to make the layer scrollable, and verify it. | 7758 // Call javascript to make the layer scrollable, and verify it. |
7759 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); | 7759 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); |
7760 frame->ExecuteScript(WebScriptSource("allowScroll();")); | 7760 frame->ExecuteScript(WebScriptSource("allowScroll();")); |
7761 web_view_helper.WebView()->UpdateAllLifecyclePhases(); | 7761 web_view_helper.WebView()->UpdateAllLifecyclePhases(); |
7762 ASSERT_TRUE(web_scroll_layer->UserScrollableHorizontal()); | 7762 ASSERT_TRUE(web_scroll_layer->UserScrollableHorizontal()); |
7763 ASSERT_TRUE(web_scroll_layer->UserScrollableVertical()); | 7763 ASSERT_TRUE(web_scroll_layer->UserScrollableVertical()); |
7764 } | 7764 } |
7765 | 7765 |
7766 // Test that currentHistoryItem reflects the current page, not the provisional | 7766 // Test that currentHistoryItem reflects the current page, not the provisional |
7767 // load. | 7767 // load. |
7768 TEST_P(ParameterizedWebFrameTest, CurrentHistoryItem) { | 7768 TEST_P(ParameterizedWebFrameTest, CurrentHistoryItem) { |
7769 RegisterMockedHttpURLLoad("fixed_layout.html"); | 7769 RegisterMockedHttpURLLoad("fixed_layout.html"); |
7770 std::string url = base_url_ + "fixed_layout.html"; | 7770 std::string url = base_url_ + "fixed_layout.html"; |
7771 | 7771 |
7772 FrameTestHelpers::WebViewHelper web_view_helper; | 7772 FrameTestHelpers::WebViewHelper web_view_helper; |
7773 web_view_helper.Initialize(); | 7773 web_view_helper.Initialize(); |
7774 WebFrame* frame = web_view_helper.WebView()->MainFrame(); | 7774 WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); |
7775 const FrameLoader& main_frame_loader = | 7775 const FrameLoader& main_frame_loader = |
7776 web_view_helper.WebView()->MainFrameImpl()->GetFrame()->Loader(); | 7776 web_view_helper.WebView()->MainFrameImpl()->GetFrame()->Loader(); |
7777 WebURLRequest request(ToKURL(url)); | 7777 WebURLRequest request(ToKURL(url)); |
7778 frame->LoadRequest(request); | 7778 frame->LoadRequest(request); |
7779 | 7779 |
7780 // Before commit, there is no history item. | 7780 // Before commit, there is no history item. |
7781 EXPECT_FALSE(main_frame_loader.GetDocumentLoader()->GetHistoryItem()); | 7781 EXPECT_FALSE(main_frame_loader.GetDocumentLoader()->GetHistoryItem()); |
7782 | 7782 |
7783 FrameTestHelpers::PumpPendingRequestsForFrameToLoad(frame); | 7783 FrameTestHelpers::PumpPendingRequestsForFrameToLoad(frame); |
7784 | 7784 |
(...skipping 2876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10661 client.AddExpectedRequest(ToKURL("http://internal.test/image_slow.pl"), | 10661 client.AddExpectedRequest(ToKURL("http://internal.test/image_slow.pl"), |
10662 WebURLRequest::kPriorityLow); | 10662 WebURLRequest::kPriorityLow); |
10663 client.AddExpectedRequest( | 10663 client.AddExpectedRequest( |
10664 ToKURL("http://internal.test/image_slow_out_of_viewport.pl"), | 10664 ToKURL("http://internal.test/image_slow_out_of_viewport.pl"), |
10665 WebURLRequest::kPriorityLow); | 10665 WebURLRequest::kPriorityLow); |
10666 | 10666 |
10667 FrameTestHelpers::WebViewHelper helper; | 10667 FrameTestHelpers::WebViewHelper helper; |
10668 helper.Initialize(&client); | 10668 helper.Initialize(&client); |
10669 helper.Resize(WebSize(640, 480)); | 10669 helper.Resize(WebSize(640, 480)); |
10670 FrameTestHelpers::LoadFrame( | 10670 FrameTestHelpers::LoadFrame( |
10671 helper.WebView()->MainFrame(), | 10671 helper.WebView()->MainFrameImpl(), |
10672 base_url_ + "promote_img_in_viewport_priority.html"); | 10672 base_url_ + "promote_img_in_viewport_priority.html"); |
10673 | 10673 |
10674 // Ensure the image in the viewport got promoted after the request was sent. | 10674 // Ensure the image in the viewport got promoted after the request was sent. |
10675 Resource* image = ToWebLocalFrameBase(helper.WebView()->MainFrame()) | 10675 Resource* image = ToWebLocalFrameBase(helper.WebView()->MainFrame()) |
10676 ->GetFrame() | 10676 ->GetFrame() |
10677 ->GetDocument() | 10677 ->GetDocument() |
10678 ->Fetcher() | 10678 ->Fetcher() |
10679 ->AllResources() | 10679 ->AllResources() |
10680 .at(ToKURL("http://internal.test/image_slow.pl")); | 10680 .at(ToKURL("http://internal.test/image_slow.pl")); |
10681 DCHECK(image); | 10681 DCHECK(image); |
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12035 if (obj->IsText()) { | 12035 if (obj->IsText()) { |
12036 LayoutText* layout_text = ToLayoutText(obj); | 12036 LayoutText* layout_text = ToLayoutText(obj); |
12037 text = layout_text->GetText(); | 12037 text = layout_text->GetText(); |
12038 break; | 12038 break; |
12039 } | 12039 } |
12040 } | 12040 } |
12041 EXPECT_EQ("foo alt", text.Utf8()); | 12041 EXPECT_EQ("foo alt", text.Utf8()); |
12042 } | 12042 } |
12043 | 12043 |
12044 } // namespace blink | 12044 } // namespace blink |
OLD | NEW |