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", true); | 496 web_view_helper.InitializeAndLoad(base_url_ + "foo.html", true); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Pass true to enable JavaScript. | 636 // Pass true to enable JavaScript. |
637 FrameTestHelpers::WebViewHelper web_view_helper; | 637 FrameTestHelpers::WebViewHelper web_view_helper; |
638 web_view_helper.InitializeAndLoad(chrome_url_ + "history.html", true); | 638 web_view_helper.InitializeAndLoad(chrome_url_ + "history.html", true); |
639 | 639 |
640 // Try to run JS against the chrome-style URL. | 640 // Try to run JS against the chrome-style URL. |
641 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 641 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
642 "javascript:document.body.appendChild(document." | 642 "javascript:document.body.appendChild(document." |
643 "createTextNode('Clobbered'))"); | 643 "createTextNode('Clobbered'))"); |
644 | 644 |
645 // Now retrieve the frame's text and ensure it was modified by running | 645 // Now retrieve the frame's text and ensure it was modified by running |
646 // javascript. | 646 // javascript. |
647 std::string content = | 647 std::string content = |
648 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) | 648 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) |
649 .Utf8(); | 649 .Utf8(); |
650 EXPECT_NE(std::string::npos, content.find("Clobbered")); | 650 EXPECT_NE(std::string::npos, content.find("Clobbered")); |
651 } | 651 } |
652 | 652 |
653 TEST_P(ParameterizedWebFrameTest, ChromePageNoJavascript) { | 653 TEST_P(ParameterizedWebFrameTest, ChromePageNoJavascript) { |
654 RegisterMockedChromeURLLoad("history.html"); | 654 RegisterMockedChromeURLLoad("history.html"); |
655 | 655 |
656 /// Pass true to enable JavaScript. | 656 /// Pass true to enable JavaScript. |
657 FrameTestHelpers::WebViewHelper web_view_helper; | 657 FrameTestHelpers::WebViewHelper web_view_helper; |
658 web_view_helper.InitializeAndLoad(chrome_url_ + "history.html", true); | 658 web_view_helper.InitializeAndLoad(chrome_url_ + "history.html", true); |
659 | 659 |
660 // Try to run JS against the chrome-style URL after prohibiting it. | 660 // Try to run JS against the chrome-style URL after prohibiting it. |
661 WebSecurityPolicy::RegisterURLSchemeAsNotAllowingJavascriptURLs("chrome"); | 661 WebSecurityPolicy::RegisterURLSchemeAsNotAllowingJavascriptURLs("chrome"); |
662 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 662 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
663 "javascript:document.body.appendChild(document." | 663 "javascript:document.body.appendChild(document." |
664 "createTextNode('Clobbered'))"); | 664 "createTextNode('Clobbered'))"); |
665 | 665 |
666 // Now retrieve the frame's text and ensure it wasn't modified by running | 666 // Now retrieve the frame's text and ensure it wasn't modified by running |
667 // javascript. | 667 // javascript. |
668 std::string content = | 668 std::string content = |
669 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) | 669 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) |
670 .Utf8(); | 670 .Utf8(); |
671 EXPECT_EQ(std::string::npos, content.find("Clobbered")); | 671 EXPECT_EQ(std::string::npos, content.find("Clobbered")); |
672 } | 672 } |
673 | 673 |
674 TEST_P(ParameterizedWebFrameTest, LocationSetHostWithMissingPort) { | 674 TEST_P(ParameterizedWebFrameTest, LocationSetHostWithMissingPort) { |
675 std::string file_name = "print-location-href.html"; | 675 std::string file_name = "print-location-href.html"; |
676 RegisterMockedHttpURLLoad(file_name); | 676 RegisterMockedHttpURLLoad(file_name); |
677 RegisterMockedURLLoadFromBase("http://internal.test:0/", file_name); | 677 RegisterMockedURLLoadFromBase("http://internal.test:0/", file_name); |
678 | 678 |
679 FrameTestHelpers::WebViewHelper web_view_helper; | 679 FrameTestHelpers::WebViewHelper web_view_helper; |
680 | 680 |
681 /// Pass true to enable JavaScript. | 681 /// Pass true to enable JavaScript. |
682 web_view_helper.InitializeAndLoad(base_url_ + file_name, true); | 682 web_view_helper.InitializeAndLoad(base_url_ + file_name, true); |
683 | 683 |
684 // Setting host to "hostname:" should be treated as "hostname:0". | 684 // Setting host to "hostname:" should be treated as "hostname:0". |
685 FrameTestHelpers::LoadFrame( | 685 FrameTestHelpers::LoadFrame( |
686 web_view_helper.WebView()->MainFrame(), | 686 web_view_helper.WebView()->MainFrameImpl(), |
687 "javascript:location.host = 'internal.test:'; void 0;"); | 687 "javascript:location.host = 'internal.test:'; void 0;"); |
688 | 688 |
689 FrameTestHelpers::LoadFrame( | 689 FrameTestHelpers::LoadFrame( |
690 web_view_helper.WebView()->MainFrame(), | 690 web_view_helper.WebView()->MainFrameImpl(), |
691 "javascript:document.body.textContent = location.href; void 0;"); | 691 "javascript:document.body.textContent = location.href; void 0;"); |
692 | 692 |
693 std::string content = | 693 std::string content = |
694 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) | 694 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) |
695 .Utf8(); | 695 .Utf8(); |
696 EXPECT_EQ("http://internal.test:0/" + file_name, content); | 696 EXPECT_EQ("http://internal.test:0/" + file_name, content); |
697 } | 697 } |
698 | 698 |
699 TEST_P(ParameterizedWebFrameTest, LocationSetEmptyPort) { | 699 TEST_P(ParameterizedWebFrameTest, LocationSetEmptyPort) { |
700 std::string file_name = "print-location-href.html"; | 700 std::string file_name = "print-location-href.html"; |
701 RegisterMockedHttpURLLoad(file_name); | 701 RegisterMockedHttpURLLoad(file_name); |
702 RegisterMockedURLLoadFromBase("http://internal.test:0/", file_name); | 702 RegisterMockedURLLoadFromBase("http://internal.test:0/", file_name); |
703 | 703 |
704 FrameTestHelpers::WebViewHelper web_view_helper; | 704 FrameTestHelpers::WebViewHelper web_view_helper; |
705 | 705 |
706 /// Pass true to enable JavaScript. | 706 /// Pass true to enable JavaScript. |
707 web_view_helper.InitializeAndLoad(base_url_ + file_name, true); | 707 web_view_helper.InitializeAndLoad(base_url_ + file_name, true); |
708 | 708 |
709 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 709 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
710 "javascript:location.port = ''; void 0;"); | 710 "javascript:location.port = ''; void 0;"); |
711 | 711 |
712 FrameTestHelpers::LoadFrame( | 712 FrameTestHelpers::LoadFrame( |
713 web_view_helper.WebView()->MainFrame(), | 713 web_view_helper.WebView()->MainFrameImpl(), |
714 "javascript:document.body.textContent = location.href; void 0;"); | 714 "javascript:document.body.textContent = location.href; void 0;"); |
715 | 715 |
716 std::string content = | 716 std::string content = |
717 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) | 717 WebFrameContentDumper::DumpWebViewAsText(web_view_helper.WebView(), 1024) |
718 .Utf8(); | 718 .Utf8(); |
719 EXPECT_EQ("http://internal.test:0/" + file_name, content); | 719 EXPECT_EQ("http://internal.test:0/" + file_name, content); |
720 } | 720 } |
721 | 721 |
722 class EvaluateOnLoadWebFrameClient | 722 class EvaluateOnLoadWebFrameClient |
723 : public FrameTestHelpers::TestWebFrameClient { | 723 : public FrameTestHelpers::TestWebFrameClient { |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 FixedLayoutTestWebViewClient client; | 1277 FixedLayoutTestWebViewClient client; |
1278 client.screen_info_.device_scale_factor = 1; | 1278 client.screen_info_.device_scale_factor = 1; |
1279 int viewport_width = 640; | 1279 int viewport_width = 640; |
1280 int viewport_height = 480; | 1280 int viewport_height = 480; |
1281 | 1281 |
1282 // Make sure we initialize to minimum scale, even if the window size | 1282 // Make sure we initialize to minimum scale, even if the window size |
1283 // only becomes available after the load begins. | 1283 // only becomes available after the load begins. |
1284 FrameTestHelpers::WebViewHelper web_view_helper; | 1284 FrameTestHelpers::WebViewHelper web_view_helper; |
1285 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); | 1285 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); |
1286 web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); | 1286 web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); |
1287 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 1287 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
1288 base_url_ + "fixed_layout.html"); | 1288 base_url_ + "fixed_layout.html"); |
1289 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 1289 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
1290 | 1290 |
1291 int default_fixed_layout_width = 980; | 1291 int default_fixed_layout_width = 980; |
1292 float minimum_page_scale_factor = | 1292 float minimum_page_scale_factor = |
1293 viewport_width / (float)default_fixed_layout_width; | 1293 viewport_width / (float)default_fixed_layout_width; |
1294 EXPECT_EQ(minimum_page_scale_factor, | 1294 EXPECT_EQ(minimum_page_scale_factor, |
1295 web_view_helper.WebView()->PageScaleFactor()); | 1295 web_view_helper.WebView()->PageScaleFactor()); |
1296 EXPECT_EQ(minimum_page_scale_factor, | 1296 EXPECT_EQ(minimum_page_scale_factor, |
1297 web_view_helper.WebView()->MinimumPageScaleFactor()); | 1297 web_view_helper.WebView()->MinimumPageScaleFactor()); |
(...skipping 21 matching lines...) Expand all Loading... |
1319 FixedLayoutTestWebViewClient client; | 1319 FixedLayoutTestWebViewClient client; |
1320 client.screen_info_.device_scale_factor = 1; | 1320 client.screen_info_.device_scale_factor = 1; |
1321 int viewport_width = 640; | 1321 int viewport_width = 640; |
1322 int viewport_height = 480; | 1322 int viewport_height = 480; |
1323 | 1323 |
1324 // Make sure we initialize to minimum scale, even if the window size | 1324 // Make sure we initialize to minimum scale, even if the window size |
1325 // only becomes available after the load begins. | 1325 // only becomes available after the load begins. |
1326 FrameTestHelpers::WebViewHelper web_view_helper; | 1326 FrameTestHelpers::WebViewHelper web_view_helper; |
1327 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); | 1327 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); |
1328 web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); | 1328 web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); |
1329 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 1329 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
1330 base_url_ + "wide_document.html"); | 1330 base_url_ + "wide_document.html"); |
1331 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 1331 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
1332 | 1332 |
1333 int wide_document_width = 1500; | 1333 int wide_document_width = 1500; |
1334 float minimum_page_scale_factor = viewport_width / (float)wide_document_width; | 1334 float minimum_page_scale_factor = viewport_width / (float)wide_document_width; |
1335 EXPECT_EQ(minimum_page_scale_factor, | 1335 EXPECT_EQ(minimum_page_scale_factor, |
1336 web_view_helper.WebView()->PageScaleFactor()); | 1336 web_view_helper.WebView()->PageScaleFactor()); |
1337 EXPECT_EQ(minimum_page_scale_factor, | 1337 EXPECT_EQ(minimum_page_scale_factor, |
1338 web_view_helper.WebView()->MinimumPageScaleFactor()); | 1338 web_view_helper.WebView()->MinimumPageScaleFactor()); |
1339 | 1339 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 FixedLayoutTestWebViewClient client; | 1518 FixedLayoutTestWebViewClient client; |
1519 client.screen_info_.device_scale_factor = 1; | 1519 client.screen_info_.device_scale_factor = 1; |
1520 int viewport_width = 640; | 1520 int viewport_width = 640; |
1521 int viewport_height = 480; | 1521 int viewport_height = 480; |
1522 | 1522 |
1523 FrameTestHelpers::WebViewHelper web_view_helper; | 1523 FrameTestHelpers::WebViewHelper web_view_helper; |
1524 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); | 1524 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); |
1525 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); | 1525 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); |
1526 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); | 1526 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); |
1527 FrameTestHelpers::LoadFrame( | 1527 FrameTestHelpers::LoadFrame( |
1528 web_view_helper.WebView()->MainFrame(), | 1528 web_view_helper.WebView()->MainFrameImpl(), |
1529 base_url_ + "viewport/viewport-legacy-xhtmlmp.html"); | 1529 base_url_ + "viewport/viewport-legacy-xhtmlmp.html"); |
1530 | 1530 |
1531 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 1531 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
1532 EXPECT_EQ(viewport_width, web_view_helper.WebView() | 1532 EXPECT_EQ(viewport_width, web_view_helper.WebView() |
1533 ->MainFrameImpl() | 1533 ->MainFrameImpl() |
1534 ->GetFrameView() | 1534 ->GetFrameView() |
1535 ->ContentsSize() | 1535 ->ContentsSize() |
1536 .Width()); | 1536 .Width()); |
1537 EXPECT_EQ(viewport_height, web_view_helper.WebView() | 1537 EXPECT_EQ(viewport_height, web_view_helper.WebView() |
1538 ->MainFrameImpl() | 1538 ->MainFrameImpl() |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2080 int viewport_height = 480; | 2080 int viewport_height = 480; |
2081 | 2081 |
2082 FrameTestHelpers::WebViewHelper web_view_helper; | 2082 FrameTestHelpers::WebViewHelper web_view_helper; |
2083 | 2083 |
2084 web_view_helper.InitializeAndLoad(base_url_ + "200-by-300.html", true, | 2084 web_view_helper.InitializeAndLoad(base_url_ + "200-by-300.html", true, |
2085 nullptr, &client, nullptr, | 2085 nullptr, &client, nullptr, |
2086 ConfigureAndroid); | 2086 ConfigureAndroid); |
2087 web_view_helper.WebView()->GetSettings()->SetForceZeroLayoutHeight(true); | 2087 web_view_helper.WebView()->GetSettings()->SetForceZeroLayoutHeight(true); |
2088 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2088 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2089 | 2089 |
2090 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2090 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2091 base_url_ + "large-div.html"); | 2091 base_url_ + "large-div.html"); |
2092 web_view_helper.WebView()->UpdateAllLifecyclePhases(); | 2092 web_view_helper.WebView()->UpdateAllLifecyclePhases(); |
2093 | 2093 |
2094 EXPECT_EQ(0, web_view_helper.WebView() | 2094 EXPECT_EQ(0, web_view_helper.WebView() |
2095 ->MainFrameImpl() | 2095 ->MainFrameImpl() |
2096 ->GetFrameView() | 2096 ->GetFrameView() |
2097 ->GetLayoutSize() | 2097 ->GetLayoutSize() |
2098 .Height()); | 2098 .Height()); |
2099 } | 2099 } |
2100 | 2100 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2135 | 2135 |
2136 FrameTestHelpers::WebViewHelper web_view_helper; | 2136 FrameTestHelpers::WebViewHelper web_view_helper; |
2137 web_view_helper.InitializeAndLoad("about:blank", true, nullptr, &client, | 2137 web_view_helper.InitializeAndLoad("about:blank", true, nullptr, &client, |
2138 nullptr, ConfigureAndroid); | 2138 nullptr, ConfigureAndroid); |
2139 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); | 2139 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); |
2140 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); | 2140 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); |
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_ + "wide_document_width_viewport.html"); | 2146 base_url_ + "wide_document_width_viewport.html"); |
2147 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2147 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2148 | 2148 |
2149 int wide_document_width = 800; | 2149 int wide_document_width = 800; |
2150 float minimum_page_scale_factor = viewport_width / (float)wide_document_width; | 2150 float minimum_page_scale_factor = viewport_width / (float)wide_document_width; |
2151 EXPECT_EQ(minimum_page_scale_factor, | 2151 EXPECT_EQ(minimum_page_scale_factor, |
2152 web_view_helper.WebView()->PageScaleFactor()); | 2152 web_view_helper.WebView()->PageScaleFactor()); |
2153 EXPECT_EQ(minimum_page_scale_factor, | 2153 EXPECT_EQ(minimum_page_scale_factor, |
2154 web_view_helper.WebView()->MinimumPageScaleFactor()); | 2154 web_view_helper.WebView()->MinimumPageScaleFactor()); |
2155 } | 2155 } |
2156 | 2156 |
2157 TEST_P(ParameterizedWebFrameTest, WideViewportQuirkClobbersHeight) { | 2157 TEST_P(ParameterizedWebFrameTest, WideViewportQuirkClobbersHeight) { |
2158 RegisterMockedHttpURLLoad("viewport-height-1000.html"); | 2158 RegisterMockedHttpURLLoad("viewport-height-1000.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", true, nullptr, &client, | 2166 web_view_helper.InitializeAndLoad("about:blank", true, nullptr, &client, |
2167 nullptr, ConfigureAndroid); | 2167 nullptr, ConfigureAndroid); |
2168 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); | 2168 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); |
2169 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(false); | 2169 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(false); |
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-height-1000.html"); | 2175 base_url_ + "viewport-height-1000.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(800, web_view_helper.WebView() | 2178 EXPECT_EQ(800, web_view_helper.WebView() |
2179 ->MainFrameImpl() | 2179 ->MainFrameImpl() |
2180 ->GetFrameView() | 2180 ->GetFrameView() |
2181 ->GetLayoutSize() | 2181 ->GetLayoutSize() |
2182 .Height()); | 2182 .Height()); |
2183 EXPECT_EQ(1, web_view_helper.WebView()->PageScaleFactor()); | 2183 EXPECT_EQ(1, web_view_helper.WebView()->PageScaleFactor()); |
2184 } | 2184 } |
2185 | 2185 |
2186 TEST_P(ParameterizedWebFrameTest, LayoutSize320Quirk) { | 2186 TEST_P(ParameterizedWebFrameTest, LayoutSize320Quirk) { |
2187 RegisterMockedHttpURLLoad("viewport/viewport-30.html"); | 2187 RegisterMockedHttpURLLoad("viewport/viewport-30.html"); |
2188 | 2188 |
2189 FixedLayoutTestWebViewClient client; | 2189 FixedLayoutTestWebViewClient client; |
2190 client.screen_info_.device_scale_factor = 1; | 2190 client.screen_info_.device_scale_factor = 1; |
2191 int viewport_width = 600; | 2191 int viewport_width = 600; |
2192 int viewport_height = 800; | 2192 int viewport_height = 800; |
2193 | 2193 |
2194 FrameTestHelpers::WebViewHelper web_view_helper; | 2194 FrameTestHelpers::WebViewHelper web_view_helper; |
2195 web_view_helper.InitializeAndLoad("about:blank", true, nullptr, &client, | 2195 web_view_helper.InitializeAndLoad("about:blank", true, nullptr, &client, |
2196 nullptr, ConfigureAndroid); | 2196 nullptr, ConfigureAndroid); |
2197 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); | 2197 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); |
2198 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); | 2198 web_view_helper.WebView()->GetSettings()->SetUseWideViewport(true); |
2199 web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( | 2199 web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( |
2200 true); | 2200 true); |
2201 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2201 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2202 | 2202 |
2203 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2203 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2204 base_url_ + "viewport/viewport-30.html"); | 2204 base_url_ + "viewport/viewport-30.html"); |
2205 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2205 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2206 | 2206 |
2207 EXPECT_EQ(600, web_view_helper.WebView() | 2207 EXPECT_EQ(600, web_view_helper.WebView() |
2208 ->MainFrameImpl() | 2208 ->MainFrameImpl() |
2209 ->GetFrameView() | 2209 ->GetFrameView() |
2210 ->GetLayoutSize() | 2210 ->GetLayoutSize() |
2211 .Width()); | 2211 .Width()); |
2212 EXPECT_EQ(800, web_view_helper.WebView() | 2212 EXPECT_EQ(800, web_view_helper.WebView() |
2213 ->MainFrameImpl() | 2213 ->MainFrameImpl() |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2270 int viewport_width = 640; | 2270 int viewport_width = 640; |
2271 int viewport_height = 480; | 2271 int viewport_height = 480; |
2272 | 2272 |
2273 FrameTestHelpers::WebViewHelper web_view_helper; | 2273 FrameTestHelpers::WebViewHelper web_view_helper; |
2274 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); | 2274 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); |
2275 web_view_helper.WebView()->GetSettings()->SetViewportMetaZeroValuesQuirk( | 2275 web_view_helper.WebView()->GetSettings()->SetViewportMetaZeroValuesQuirk( |
2276 true); | 2276 true); |
2277 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); | 2277 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); |
2278 web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( | 2278 web_view_helper.WebView()->GetSettings()->SetViewportMetaLayoutSizeQuirk( |
2279 true); | 2279 true); |
2280 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2280 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2281 base_url_ + "viewport-zero-values.html"); | 2281 base_url_ + "viewport-zero-values.html"); |
2282 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2282 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2283 | 2283 |
2284 EXPECT_EQ(viewport_width, web_view_helper.WebView() | 2284 EXPECT_EQ(viewport_width, web_view_helper.WebView() |
2285 ->MainFrameImpl() | 2285 ->MainFrameImpl() |
2286 ->GetFrameView() | 2286 ->GetFrameView() |
2287 ->GetLayoutSize() | 2287 ->GetLayoutSize() |
2288 .Width()); | 2288 .Width()); |
2289 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); | 2289 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); |
2290 | 2290 |
(...skipping 10 matching lines...) Expand all Loading... |
2301 TEST_P(ParameterizedWebFrameTest, OverflowHiddenDisablesScrolling) { | 2301 TEST_P(ParameterizedWebFrameTest, OverflowHiddenDisablesScrolling) { |
2302 RegisterMockedHttpURLLoad("body-overflow-hidden.html"); | 2302 RegisterMockedHttpURLLoad("body-overflow-hidden.html"); |
2303 | 2303 |
2304 FixedLayoutTestWebViewClient client; | 2304 FixedLayoutTestWebViewClient client; |
2305 client.screen_info_.device_scale_factor = 1; | 2305 client.screen_info_.device_scale_factor = 1; |
2306 int viewport_width = 640; | 2306 int viewport_width = 640; |
2307 int viewport_height = 480; | 2307 int viewport_height = 480; |
2308 | 2308 |
2309 FrameTestHelpers::WebViewHelper web_view_helper; | 2309 FrameTestHelpers::WebViewHelper web_view_helper; |
2310 web_view_helper.Initialize(true, nullptr, &client, nullptr); | 2310 web_view_helper.Initialize(true, nullptr, &client, nullptr); |
2311 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2311 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2312 base_url_ + "body-overflow-hidden.html"); | 2312 base_url_ + "body-overflow-hidden.html"); |
2313 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2313 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2314 | 2314 |
2315 LocalFrameView* view = | 2315 LocalFrameView* view = |
2316 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); | 2316 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); |
2317 EXPECT_FALSE(view->UserInputScrollable(kVerticalScrollbar)); | 2317 EXPECT_FALSE(view->UserInputScrollable(kVerticalScrollbar)); |
2318 EXPECT_FALSE(view->UserInputScrollable(kHorizontalScrollbar)); | 2318 EXPECT_FALSE(view->UserInputScrollable(kHorizontalScrollbar)); |
2319 } | 2319 } |
2320 | 2320 |
2321 TEST_P(ParameterizedWebFrameTest, | 2321 TEST_P(ParameterizedWebFrameTest, |
2322 OverflowHiddenDisablesScrollingWithSetCanHaveScrollbars) { | 2322 OverflowHiddenDisablesScrollingWithSetCanHaveScrollbars) { |
2323 RegisterMockedHttpURLLoad("body-overflow-hidden-short.html"); | 2323 RegisterMockedHttpURLLoad("body-overflow-hidden-short.html"); |
2324 | 2324 |
2325 FixedLayoutTestWebViewClient client; | 2325 FixedLayoutTestWebViewClient client; |
2326 client.screen_info_.device_scale_factor = 1; | 2326 client.screen_info_.device_scale_factor = 1; |
2327 int viewport_width = 640; | 2327 int viewport_width = 640; |
2328 int viewport_height = 480; | 2328 int viewport_height = 480; |
2329 | 2329 |
2330 FrameTestHelpers::WebViewHelper web_view_helper; | 2330 FrameTestHelpers::WebViewHelper web_view_helper; |
2331 web_view_helper.Initialize(true, nullptr, &client, nullptr); | 2331 web_view_helper.Initialize(true, nullptr, &client, nullptr); |
2332 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2332 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2333 base_url_ + "body-overflow-hidden-short.html"); | 2333 base_url_ + "body-overflow-hidden-short.html"); |
2334 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2334 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2335 | 2335 |
2336 LocalFrameView* view = | 2336 LocalFrameView* view = |
2337 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); | 2337 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); |
2338 EXPECT_FALSE(view->UserInputScrollable(kVerticalScrollbar)); | 2338 EXPECT_FALSE(view->UserInputScrollable(kVerticalScrollbar)); |
2339 EXPECT_FALSE(view->UserInputScrollable(kHorizontalScrollbar)); | 2339 EXPECT_FALSE(view->UserInputScrollable(kHorizontalScrollbar)); |
2340 | 2340 |
2341 web_view_helper.WebView()->MainFrameImpl()->SetCanHaveScrollbars(true); | 2341 web_view_helper.WebView()->MainFrameImpl()->SetCanHaveScrollbars(true); |
2342 EXPECT_FALSE(view->UserInputScrollable(kVerticalScrollbar)); | 2342 EXPECT_FALSE(view->UserInputScrollable(kVerticalScrollbar)); |
2343 EXPECT_FALSE(view->UserInputScrollable(kHorizontalScrollbar)); | 2343 EXPECT_FALSE(view->UserInputScrollable(kHorizontalScrollbar)); |
2344 } | 2344 } |
2345 | 2345 |
2346 TEST_F(WebFrameTest, IgnoreOverflowHiddenQuirk) { | 2346 TEST_F(WebFrameTest, IgnoreOverflowHiddenQuirk) { |
2347 RegisterMockedHttpURLLoad("body-overflow-hidden.html"); | 2347 RegisterMockedHttpURLLoad("body-overflow-hidden.html"); |
2348 | 2348 |
2349 FixedLayoutTestWebViewClient client; | 2349 FixedLayoutTestWebViewClient client; |
2350 client.screen_info_.device_scale_factor = 1; | 2350 client.screen_info_.device_scale_factor = 1; |
2351 int viewport_width = 640; | 2351 int viewport_width = 640; |
2352 int viewport_height = 480; | 2352 int viewport_height = 480; |
2353 | 2353 |
2354 FrameTestHelpers::WebViewHelper web_view_helper; | 2354 FrameTestHelpers::WebViewHelper web_view_helper; |
2355 web_view_helper.Initialize(true, nullptr, &client, nullptr); | 2355 web_view_helper.Initialize(true, nullptr, &client, nullptr); |
2356 web_view_helper.WebView() | 2356 web_view_helper.WebView() |
2357 ->GetSettings() | 2357 ->GetSettings() |
2358 ->SetIgnoreMainFrameOverflowHiddenQuirk(true); | 2358 ->SetIgnoreMainFrameOverflowHiddenQuirk(true); |
2359 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2359 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2360 base_url_ + "body-overflow-hidden.html"); | 2360 base_url_ + "body-overflow-hidden.html"); |
2361 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2361 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2362 | 2362 |
2363 LocalFrameView* view = | 2363 LocalFrameView* view = |
2364 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); | 2364 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); |
2365 EXPECT_TRUE(view->UserInputScrollable(kVerticalScrollbar)); | 2365 EXPECT_TRUE(view->UserInputScrollable(kVerticalScrollbar)); |
2366 } | 2366 } |
2367 | 2367 |
2368 TEST_P(ParameterizedWebFrameTest, NonZeroValuesNoQuirk) { | 2368 TEST_P(ParameterizedWebFrameTest, NonZeroValuesNoQuirk) { |
2369 RegisterMockedHttpURLLoad("viewport-nonzero-values.html"); | 2369 RegisterMockedHttpURLLoad("viewport-nonzero-values.html"); |
2370 | 2370 |
2371 FixedLayoutTestWebViewClient client; | 2371 FixedLayoutTestWebViewClient client; |
2372 client.screen_info_.device_scale_factor = 1; | 2372 client.screen_info_.device_scale_factor = 1; |
2373 int viewport_width = 640; | 2373 int viewport_width = 640; |
2374 int viewport_height = 480; | 2374 int viewport_height = 480; |
2375 float expected_page_scale_factor = 0.5f; | 2375 float expected_page_scale_factor = 0.5f; |
2376 | 2376 |
2377 FrameTestHelpers::WebViewHelper web_view_helper; | 2377 FrameTestHelpers::WebViewHelper web_view_helper; |
2378 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); | 2378 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); |
2379 web_view_helper.WebView()->GetSettings()->SetViewportMetaZeroValuesQuirk( | 2379 web_view_helper.WebView()->GetSettings()->SetViewportMetaZeroValuesQuirk( |
2380 true); | 2380 true); |
2381 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); | 2381 web_view_helper.WebView()->GetSettings()->SetWideViewportQuirkEnabled(true); |
2382 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2382 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2383 base_url_ + "viewport-nonzero-values.html"); | 2383 base_url_ + "viewport-nonzero-values.html"); |
2384 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2384 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2385 | 2385 |
2386 EXPECT_EQ(viewport_width / expected_page_scale_factor, | 2386 EXPECT_EQ(viewport_width / expected_page_scale_factor, |
2387 web_view_helper.WebView() | 2387 web_view_helper.WebView() |
2388 ->MainFrameImpl() | 2388 ->MainFrameImpl() |
2389 ->GetFrameView() | 2389 ->GetFrameView() |
2390 ->GetLayoutSize() | 2390 ->GetLayoutSize() |
2391 .Width()); | 2391 .Width()); |
2392 EXPECT_EQ(expected_page_scale_factor, | 2392 EXPECT_EQ(expected_page_scale_factor, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2486 RegisterMockedHttpURLLoad("fixed_layout.html"); | 2486 RegisterMockedHttpURLLoad("fixed_layout.html"); |
2487 | 2487 |
2488 FixedLayoutTestWebViewClient client; | 2488 FixedLayoutTestWebViewClient client; |
2489 client.screen_info_.device_scale_factor = 1; | 2489 client.screen_info_.device_scale_factor = 1; |
2490 int viewport_width = 640; | 2490 int viewport_width = 640; |
2491 int viewport_height = 480; | 2491 int viewport_height = 480; |
2492 | 2492 |
2493 FrameTestHelpers::WebViewHelper web_view_helper; | 2493 FrameTestHelpers::WebViewHelper web_view_helper; |
2494 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); | 2494 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); |
2495 web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); | 2495 web_view_helper.WebView()->SetDefaultPageScaleLimits(0.25f, 5); |
2496 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2496 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2497 base_url_ + "fixed_layout.html"); | 2497 base_url_ + "fixed_layout.html"); |
2498 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 2498 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
2499 | 2499 |
2500 int default_fixed_layout_width = 980; | 2500 int default_fixed_layout_width = 980; |
2501 float minimum_page_scale_factor = | 2501 float minimum_page_scale_factor = |
2502 viewport_width / (float)default_fixed_layout_width; | 2502 viewport_width / (float)default_fixed_layout_width; |
2503 EXPECT_EQ(minimum_page_scale_factor, | 2503 EXPECT_EQ(minimum_page_scale_factor, |
2504 ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) | 2504 ToLocalFrame(web_view_helper.WebView()->GetPage()->MainFrame()) |
2505 ->Loader() | 2505 ->Loader() |
2506 .GetDocumentLoader() | 2506 .GetDocumentLoader() |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2981 .Width()); | 2981 .Width()); |
2982 } | 2982 } |
2983 | 2983 |
2984 TEST_P(ParameterizedWebFrameTest, AtViewportAffectingAtMediaRecalcCount) { | 2984 TEST_P(ParameterizedWebFrameTest, AtViewportAffectingAtMediaRecalcCount) { |
2985 RegisterMockedHttpURLLoad("viewport-and-media.html"); | 2985 RegisterMockedHttpURLLoad("viewport-and-media.html"); |
2986 | 2986 |
2987 FixedLayoutTestWebViewClient client; | 2987 FixedLayoutTestWebViewClient client; |
2988 FrameTestHelpers::WebViewHelper web_view_helper; | 2988 FrameTestHelpers::WebViewHelper web_view_helper; |
2989 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); | 2989 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); |
2990 web_view_helper.Resize(WebSize(640, 480)); | 2990 web_view_helper.Resize(WebSize(640, 480)); |
2991 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 2991 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
2992 base_url_ + "viewport-and-media.html"); | 2992 base_url_ + "viewport-and-media.html"); |
2993 | 2993 |
2994 Document* document = | 2994 Document* document = |
2995 web_view_helper.WebView()->MainFrameImpl()->GetFrame()->GetDocument(); | 2995 web_view_helper.WebView()->MainFrameImpl()->GetFrame()->GetDocument(); |
2996 EXPECT_EQ(2000, web_view_helper.WebView() | 2996 EXPECT_EQ(2000, web_view_helper.WebView() |
2997 ->MainFrameImpl() | 2997 ->MainFrameImpl() |
2998 ->GetFrameView() | 2998 ->GetFrameView() |
2999 ->GetLayoutSize() | 2999 ->GetLayoutSize() |
3000 .Width()); | 3000 .Width()); |
3001 | 3001 |
3002 // The styleForElementCount() should match the number of elements for a single | 3002 // The styleForElementCount() should match the number of elements for a single |
3003 // pass of computed styles construction for the document. | 3003 // pass of computed styles construction for the document. |
3004 EXPECT_EQ(10u, document->GetStyleEngine().StyleForElementCount()); | 3004 EXPECT_EQ(10u, document->GetStyleEngine().StyleForElementCount()); |
3005 EXPECT_EQ(Color(0, 128, 0), | 3005 EXPECT_EQ(Color(0, 128, 0), |
3006 document->body()->GetComputedStyle()->VisitedDependentColor( | 3006 document->body()->GetComputedStyle()->VisitedDependentColor( |
3007 CSSPropertyColor)); | 3007 CSSPropertyColor)); |
3008 } | 3008 } |
3009 | 3009 |
3010 TEST_P(ParameterizedWebFrameTest, AtViewportWithViewportLengths) { | 3010 TEST_P(ParameterizedWebFrameTest, AtViewportWithViewportLengths) { |
3011 RegisterMockedHttpURLLoad("viewport-lengths.html"); | 3011 RegisterMockedHttpURLLoad("viewport-lengths.html"); |
3012 | 3012 |
3013 FixedLayoutTestWebViewClient client; | 3013 FixedLayoutTestWebViewClient client; |
3014 FrameTestHelpers::WebViewHelper web_view_helper; | 3014 FrameTestHelpers::WebViewHelper web_view_helper; |
3015 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); | 3015 web_view_helper.Initialize(true, nullptr, &client, nullptr, ConfigureAndroid); |
3016 web_view_helper.Resize(WebSize(800, 600)); | 3016 web_view_helper.Resize(WebSize(800, 600)); |
3017 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 3017 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
3018 base_url_ + "viewport-lengths.html"); | 3018 base_url_ + "viewport-lengths.html"); |
3019 | 3019 |
3020 LocalFrameView* view = | 3020 LocalFrameView* view = |
3021 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); | 3021 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); |
3022 EXPECT_EQ(400, view->GetLayoutSize().Width()); | 3022 EXPECT_EQ(400, view->GetLayoutSize().Width()); |
3023 EXPECT_EQ(300, view->GetLayoutSize().Height()); | 3023 EXPECT_EQ(300, view->GetLayoutSize().Height()); |
3024 | 3024 |
3025 web_view_helper.Resize(WebSize(1000, 400)); | 3025 web_view_helper.Resize(WebSize(1000, 400)); |
3026 | 3026 |
3027 EXPECT_EQ(500, view->GetLayoutSize().Width()); | 3027 EXPECT_EQ(500, view->GetLayoutSize().Width()); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3236 | 3236 |
3237 std::unique_ptr<FakeCompositingWebViewClient> | 3237 std::unique_ptr<FakeCompositingWebViewClient> |
3238 fake_compositing_web_view_client = | 3238 fake_compositing_web_view_client = |
3239 WTF::MakeUnique<FakeCompositingWebViewClient>(); | 3239 WTF::MakeUnique<FakeCompositingWebViewClient>(); |
3240 FrameTestHelpers::WebViewHelper web_view_helper; | 3240 FrameTestHelpers::WebViewHelper web_view_helper; |
3241 web_view_helper.Initialize(true, nullptr, | 3241 web_view_helper.Initialize(true, nullptr, |
3242 fake_compositing_web_view_client.get(), nullptr, | 3242 fake_compositing_web_view_client.get(), nullptr, |
3243 &ConfigureCompositingWebView); | 3243 &ConfigureCompositingWebView); |
3244 | 3244 |
3245 web_view_helper.Resize(WebSize(view_width, view_height)); | 3245 web_view_helper.Resize(WebSize(view_width, view_height)); |
3246 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 3246 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
3247 base_url_ + "large-div.html"); | 3247 base_url_ + "large-div.html"); |
3248 | 3248 |
3249 LocalFrameView* view = | 3249 LocalFrameView* view = |
3250 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); | 3250 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); |
3251 EXPECT_TRUE( | 3251 EXPECT_TRUE( |
3252 view->GetLayoutViewItem().Compositor()->LayerForHorizontalScrollbar()); | 3252 view->GetLayoutViewItem().Compositor()->LayerForHorizontalScrollbar()); |
3253 EXPECT_TRUE( | 3253 EXPECT_TRUE( |
3254 view->GetLayoutViewItem().Compositor()->LayerForVerticalScrollbar()); | 3254 view->GetLayoutViewItem().Compositor()->LayerForVerticalScrollbar()); |
3255 | 3255 |
3256 web_view_helper.Resize(WebSize(view_width * 10, view_height * 10)); | 3256 web_view_helper.Resize(WebSize(view_width * 10, view_height * 10)); |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4229 TEST_P(ParameterizedWebFrameTest, ReloadDoesntSetRedirect) { | 4229 TEST_P(ParameterizedWebFrameTest, ReloadDoesntSetRedirect) { |
4230 // Test for case in http://crbug.com/73104. Reloading a frame very quickly | 4230 // Test for case in http://crbug.com/73104. Reloading a frame very quickly |
4231 // would sometimes call decidePolicyForNavigation with isRedirect=true | 4231 // would sometimes call decidePolicyForNavigation with isRedirect=true |
4232 RegisterMockedHttpURLLoad("form.html"); | 4232 RegisterMockedHttpURLLoad("form.html"); |
4233 | 4233 |
4234 TestReloadDoesntRedirectWebFrameClient web_frame_client; | 4234 TestReloadDoesntRedirectWebFrameClient web_frame_client; |
4235 FrameTestHelpers::WebViewHelper web_view_helper; | 4235 FrameTestHelpers::WebViewHelper web_view_helper; |
4236 web_view_helper.InitializeAndLoad(base_url_ + "form.html", false, | 4236 web_view_helper.InitializeAndLoad(base_url_ + "form.html", false, |
4237 &web_frame_client); | 4237 &web_frame_client); |
4238 | 4238 |
4239 web_view_helper.WebView()->MainFrame()->Reload( | 4239 web_view_helper.WebView()->MainFrameImpl()->Reload( |
4240 WebFrameLoadType::kReloadBypassingCache); | 4240 WebFrameLoadType::kReloadBypassingCache); |
4241 // start another reload before request is delivered. | 4241 // start another reload before request is delivered. |
4242 FrameTestHelpers::ReloadFrameBypassingCache( | 4242 FrameTestHelpers::ReloadFrameBypassingCache( |
4243 web_view_helper.WebView()->MainFrame()); | 4243 web_view_helper.WebView()->MainFrameImpl()); |
4244 } | 4244 } |
4245 | 4245 |
4246 class ClearScrollStateOnCommitWebFrameClient | 4246 class ClearScrollStateOnCommitWebFrameClient |
4247 : public FrameTestHelpers::TestWebFrameClient { | 4247 : public FrameTestHelpers::TestWebFrameClient { |
4248 public: | 4248 public: |
4249 void DidCommitProvisionalLoad(const WebHistoryItem&, | 4249 void DidCommitProvisionalLoad(const WebHistoryItem&, |
4250 WebHistoryCommitType) override { | 4250 WebHistoryCommitType) override { |
4251 Frame()->View()->ResetScrollAndScaleState(); | 4251 Frame()->View()->ResetScrollAndScaleState(); |
4252 } | 4252 } |
4253 }; | 4253 }; |
(...skipping 12 matching lines...) Expand all Loading... |
4266 | 4266 |
4267 ClearScrollStateOnCommitWebFrameClient client; | 4267 ClearScrollStateOnCommitWebFrameClient client; |
4268 FrameTestHelpers::WebViewHelper web_view_helper; | 4268 FrameTestHelpers::WebViewHelper web_view_helper; |
4269 web_view_helper.InitializeAndLoad(base_url_ + first_url, true, &client); | 4269 web_view_helper.InitializeAndLoad(base_url_ + first_url, true, &client); |
4270 web_view_helper.Resize(WebSize(kPageWidth, kPageHeight)); | 4270 web_view_helper.Resize(WebSize(kPageWidth, kPageHeight)); |
4271 web_view_helper.WebView()->MainFrame()->SetScrollOffset( | 4271 web_view_helper.WebView()->MainFrame()->SetScrollOffset( |
4272 WebSize(kPageWidth / 4, kPageHeight / 4)); | 4272 WebSize(kPageWidth / 4, kPageHeight / 4)); |
4273 web_view_helper.WebView()->SetPageScaleFactor(kPageScaleFactor); | 4273 web_view_helper.WebView()->SetPageScaleFactor(kPageScaleFactor); |
4274 | 4274 |
4275 // Reload the page and end up at the same url. State should not be propagated. | 4275 // Reload the page and end up at the same url. State should not be propagated. |
4276 web_view_helper.WebView()->MainFrame()->ReloadWithOverrideURL( | 4276 web_view_helper.WebView()->MainFrameImpl()->ReloadWithOverrideURL( |
4277 ToKURL(base_url_ + first_url), WebFrameLoadType::kReload); | 4277 ToKURL(base_url_ + first_url), WebFrameLoadType::kReload); |
4278 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( | 4278 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( |
4279 web_view_helper.WebView()->MainFrame()); | 4279 web_view_helper.WebView()->MainFrame()); |
4280 EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width); | 4280 EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width); |
4281 EXPECT_EQ(0, | 4281 EXPECT_EQ(0, |
4282 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height); | 4282 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height); |
4283 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); | 4283 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); |
4284 | 4284 |
4285 // Reload the page using the cache. State should not be propagated. | 4285 // Reload the page using the cache. State should not be propagated. |
4286 web_view_helper.WebView()->MainFrame()->ReloadWithOverrideURL( | 4286 web_view_helper.WebView()->MainFrameImpl()->ReloadWithOverrideURL( |
4287 ToKURL(base_url_ + second_url), WebFrameLoadType::kReload); | 4287 ToKURL(base_url_ + second_url), WebFrameLoadType::kReload); |
4288 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( | 4288 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( |
4289 web_view_helper.WebView()->MainFrame()); | 4289 web_view_helper.WebView()->MainFrame()); |
4290 EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width); | 4290 EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width); |
4291 EXPECT_EQ(0, | 4291 EXPECT_EQ(0, |
4292 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height); | 4292 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height); |
4293 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); | 4293 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); |
4294 | 4294 |
4295 // Reload the page while bypassing the cache. State should not be propagated. | 4295 // Reload the page while bypassing the cache. State should not be propagated. |
4296 web_view_helper.WebView()->MainFrame()->ReloadWithOverrideURL( | 4296 web_view_helper.WebView()->MainFrameImpl()->ReloadWithOverrideURL( |
4297 ToKURL(base_url_ + third_url), WebFrameLoadType::kReloadBypassingCache); | 4297 ToKURL(base_url_ + third_url), WebFrameLoadType::kReloadBypassingCache); |
4298 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( | 4298 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( |
4299 web_view_helper.WebView()->MainFrame()); | 4299 web_view_helper.WebView()->MainFrame()); |
4300 EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width); | 4300 EXPECT_EQ(0, web_view_helper.WebView()->MainFrame()->GetScrollOffset().width); |
4301 EXPECT_EQ(0, | 4301 EXPECT_EQ(0, |
4302 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height); | 4302 web_view_helper.WebView()->MainFrame()->GetScrollOffset().height); |
4303 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); | 4303 EXPECT_EQ(1.0f, web_view_helper.WebView()->PageScaleFactor()); |
4304 } | 4304 } |
4305 | 4305 |
4306 TEST_P(ParameterizedWebFrameTest, ReloadWhileProvisional) { | 4306 TEST_P(ParameterizedWebFrameTest, ReloadWhileProvisional) { |
4307 // Test that reloading while the previous load is still pending does not cause | 4307 // Test that reloading while the previous load is still pending does not cause |
4308 // the initial request to get lost. | 4308 // the initial request to get lost. |
4309 RegisterMockedHttpURLLoad("fixed_layout.html"); | 4309 RegisterMockedHttpURLLoad("fixed_layout.html"); |
4310 | 4310 |
4311 FrameTestHelpers::WebViewHelper web_view_helper; | 4311 FrameTestHelpers::WebViewHelper web_view_helper; |
4312 web_view_helper.Initialize(); | 4312 web_view_helper.Initialize(); |
4313 WebURLRequest request(ToKURL(base_url_ + "fixed_layout.html")); | 4313 WebURLRequest request(ToKURL(base_url_ + "fixed_layout.html")); |
4314 web_view_helper.WebView()->MainFrame()->LoadRequest(request); | 4314 web_view_helper.WebView()->MainFrameImpl()->LoadRequest(request); |
4315 // start reload before first request is delivered. | 4315 // start reload before first request is delivered. |
4316 FrameTestHelpers::ReloadFrameBypassingCache( | 4316 FrameTestHelpers::ReloadFrameBypassingCache( |
4317 web_view_helper.WebView()->MainFrame()); | 4317 web_view_helper.WebView()->MainFrameImpl()); |
4318 | 4318 |
4319 WebDataSource* data_source = | 4319 WebDataSource* data_source = |
4320 web_view_helper.WebView()->MainFrameImpl()->DataSource(); | 4320 web_view_helper.WebView()->MainFrameImpl()->DataSource(); |
4321 ASSERT_TRUE(data_source); | 4321 ASSERT_TRUE(data_source); |
4322 EXPECT_EQ(ToKURL(base_url_ + "fixed_layout.html"), | 4322 EXPECT_EQ(ToKURL(base_url_ + "fixed_layout.html"), |
4323 KURL(data_source->GetRequest().Url())); | 4323 KURL(data_source->GetRequest().Url())); |
4324 } | 4324 } |
4325 | 4325 |
4326 TEST_P(ParameterizedWebFrameTest, AppendRedirects) { | 4326 TEST_P(ParameterizedWebFrameTest, AppendRedirects) { |
4327 const std::string first_url = "about:blank"; | 4327 const std::string first_url = "about:blank"; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4567 Vector<std::unique_ptr<ContextLifetimeTestWebFrameClient::Notification>> | 4567 Vector<std::unique_ptr<ContextLifetimeTestWebFrameClient::Notification>> |
4568 release_notifications; | 4568 release_notifications; |
4569 ContextLifetimeTestWebFrameClient web_frame_client(create_notifications, | 4569 ContextLifetimeTestWebFrameClient web_frame_client(create_notifications, |
4570 release_notifications); | 4570 release_notifications); |
4571 FrameTestHelpers::WebViewHelper web_view_helper; | 4571 FrameTestHelpers::WebViewHelper web_view_helper; |
4572 web_view_helper.InitializeAndLoad( | 4572 web_view_helper.InitializeAndLoad( |
4573 base_url_ + "context_notifications_test.html", true, &web_frame_client); | 4573 base_url_ + "context_notifications_test.html", true, &web_frame_client); |
4574 | 4574 |
4575 // Refresh, we should get two release notifications and two more create | 4575 // Refresh, we should get two release notifications and two more create |
4576 // notifications. | 4576 // notifications. |
4577 FrameTestHelpers::ReloadFrame(web_view_helper.WebView()->MainFrame()); | 4577 FrameTestHelpers::ReloadFrame(web_view_helper.WebView()->MainFrameImpl()); |
4578 ASSERT_EQ(4u, create_notifications.size()); | 4578 ASSERT_EQ(4u, create_notifications.size()); |
4579 ASSERT_EQ(2u, release_notifications.size()); | 4579 ASSERT_EQ(2u, release_notifications.size()); |
4580 | 4580 |
4581 // The two release notifications we got should be exactly the same as the | 4581 // The two release notifications we got should be exactly the same as the |
4582 // first two create notifications. | 4582 // first two create notifications. |
4583 for (size_t i = 0; i < release_notifications.size(); ++i) { | 4583 for (size_t i = 0; i < release_notifications.size(); ++i) { |
4584 EXPECT_TRUE(release_notifications[i]->Equals( | 4584 EXPECT_TRUE(release_notifications[i]->Equals( |
4585 create_notifications[create_notifications.size() - 3 - i].get())); | 4585 create_notifications[create_notifications.size() - 3 - i].get())); |
4586 } | 4586 } |
4587 | 4587 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4814 }; | 4814 }; |
4815 | 4815 |
4816 TEST_P(ParameterizedWebFrameTest, ExecuteScriptDuringDidCreateScriptContext) { | 4816 TEST_P(ParameterizedWebFrameTest, ExecuteScriptDuringDidCreateScriptContext) { |
4817 RegisterMockedHttpURLLoad("hello_world.html"); | 4817 RegisterMockedHttpURLLoad("hello_world.html"); |
4818 | 4818 |
4819 TestExecuteScriptDuringDidCreateScriptContext web_frame_client; | 4819 TestExecuteScriptDuringDidCreateScriptContext web_frame_client; |
4820 FrameTestHelpers::WebViewHelper web_view_helper; | 4820 FrameTestHelpers::WebViewHelper web_view_helper; |
4821 web_view_helper.InitializeAndLoad(base_url_ + "hello_world.html", true, | 4821 web_view_helper.InitializeAndLoad(base_url_ + "hello_world.html", true, |
4822 &web_frame_client); | 4822 &web_frame_client); |
4823 | 4823 |
4824 FrameTestHelpers::ReloadFrame(web_view_helper.WebView()->MainFrame()); | 4824 FrameTestHelpers::ReloadFrame(web_view_helper.WebView()->MainFrameImpl()); |
4825 } | 4825 } |
4826 | 4826 |
4827 class FindUpdateWebFrameClient : public FrameTestHelpers::TestWebFrameClient { | 4827 class FindUpdateWebFrameClient : public FrameTestHelpers::TestWebFrameClient { |
4828 public: | 4828 public: |
4829 FindUpdateWebFrameClient() | 4829 FindUpdateWebFrameClient() |
4830 : find_results_are_ready_(false), count_(-1), active_index_(-1) {} | 4830 : find_results_are_ready_(false), count_(-1), active_index_(-1) {} |
4831 | 4831 |
4832 void ReportFindInPageMatchCount(int, int count, bool final_update) override { | 4832 void ReportFindInPageMatchCount(int, int count, bool final_update) override { |
4833 count_ = count; | 4833 count_ = count; |
4834 if (final_update) | 4834 if (final_update) |
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5956 web_view_helper_.Initialize(true, nullptr, &fake_selection_web_view_client_, | 5956 web_view_helper_.Initialize(true, nullptr, &fake_selection_web_view_client_, |
5957 nullptr); | 5957 nullptr); |
5958 web_view_helper_.WebView()->GetSettings()->SetDefaultFontSize(12); | 5958 web_view_helper_.WebView()->GetSettings()->SetDefaultFontSize(12); |
5959 web_view_helper_.WebView()->SetDefaultPageScaleLimits(1, 1); | 5959 web_view_helper_.WebView()->SetDefaultPageScaleLimits(1, 1); |
5960 web_view_helper_.Resize(WebSize(640, 480)); | 5960 web_view_helper_.Resize(WebSize(640, 480)); |
5961 } | 5961 } |
5962 | 5962 |
5963 void RunTestWithNoSelection(const char* test_file) { | 5963 void RunTestWithNoSelection(const char* test_file) { |
5964 RegisterMockedHttpURLLoad(test_file); | 5964 RegisterMockedHttpURLLoad(test_file); |
5965 web_view_helper_.WebView()->SetFocus(true); | 5965 web_view_helper_.WebView()->SetFocus(true); |
5966 FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrame(), | 5966 FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrameImpl(), |
5967 base_url_ + test_file); | 5967 base_url_ + test_file); |
5968 web_view_helper_.WebView()->UpdateAllLifecyclePhases(); | 5968 web_view_helper_.WebView()->UpdateAllLifecyclePhases(); |
5969 | 5969 |
5970 const WebSelection* selection = fake_selection_layer_tree_view_.Selection(); | 5970 const WebSelection* selection = fake_selection_layer_tree_view_.Selection(); |
5971 const WebSelectionBound* select_start = | 5971 const WebSelectionBound* select_start = |
5972 fake_selection_layer_tree_view_.Start(); | 5972 fake_selection_layer_tree_view_.Start(); |
5973 const WebSelectionBound* select_end = fake_selection_layer_tree_view_.end(); | 5973 const WebSelectionBound* select_end = fake_selection_layer_tree_view_.end(); |
5974 | 5974 |
5975 EXPECT_FALSE(selection); | 5975 EXPECT_FALSE(selection); |
5976 EXPECT_FALSE(select_start); | 5976 EXPECT_FALSE(select_start); |
5977 EXPECT_FALSE(select_end); | 5977 EXPECT_FALSE(select_end); |
5978 } | 5978 } |
5979 | 5979 |
5980 void RunTest(const char* test_file) { | 5980 void RunTest(const char* test_file) { |
5981 RegisterMockedHttpURLLoad(test_file); | 5981 RegisterMockedHttpURLLoad(test_file); |
5982 web_view_helper_.WebView()->SetFocus(true); | 5982 web_view_helper_.WebView()->SetFocus(true); |
5983 FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrame(), | 5983 FrameTestHelpers::LoadFrame(web_view_helper_.WebView()->MainFrameImpl(), |
5984 base_url_ + test_file); | 5984 base_url_ + test_file); |
5985 web_view_helper_.WebView()->UpdateAllLifecyclePhases(); | 5985 web_view_helper_.WebView()->UpdateAllLifecyclePhases(); |
5986 | 5986 |
5987 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | 5987 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); |
5988 v8::Local<v8::Value> result = | 5988 v8::Local<v8::Value> result = |
5989 web_view_helper_.WebView() | 5989 web_view_helper_.WebView() |
5990 ->MainFrameImpl() | 5990 ->MainFrameImpl() |
5991 ->ExecuteScriptAndReturnValue(WebScriptSource("expectedResult")); | 5991 ->ExecuteScriptAndReturnValue(WebScriptSource("expectedResult")); |
5992 ASSERT_FALSE(result.IsEmpty() || (*result)->IsUndefined()); | 5992 ASSERT_FALSE(result.IsEmpty() || (*result)->IsUndefined()); |
5993 | 5993 |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6477 | 6477 |
6478 private: | 6478 private: |
6479 bool commit_called_; | 6479 bool commit_called_; |
6480 }; | 6480 }; |
6481 | 6481 |
6482 TEST_P(ParameterizedWebFrameTest, ReplaceNavigationAfterHistoryNavigation) { | 6482 TEST_P(ParameterizedWebFrameTest, ReplaceNavigationAfterHistoryNavigation) { |
6483 TestSubstituteDataWebFrameClient web_frame_client; | 6483 TestSubstituteDataWebFrameClient web_frame_client; |
6484 | 6484 |
6485 FrameTestHelpers::WebViewHelper web_view_helper; | 6485 FrameTestHelpers::WebViewHelper web_view_helper; |
6486 web_view_helper.InitializeAndLoad("about:blank", true, &web_frame_client); | 6486 web_view_helper.InitializeAndLoad("about:blank", true, &web_frame_client); |
6487 WebFrame* frame = web_view_helper.WebView()->MainFrame(); | 6487 WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); |
6488 | 6488 |
6489 // Load a url as a history navigation that will return an error. | 6489 // Load a url as a history navigation that will return an error. |
6490 // TestSubstituteDataWebFrameClient will start a SubstituteData load in | 6490 // TestSubstituteDataWebFrameClient will start a SubstituteData load in |
6491 // response to the load failure, which should get fully committed. Due to | 6491 // response to the load failure, which should get fully committed. Due to |
6492 // https://bugs.webkit.org/show_bug.cgi?id=91685, | 6492 // https://bugs.webkit.org/show_bug.cgi?id=91685, |
6493 // FrameLoader::didReceiveData() wasn't getting called in this case, which | 6493 // FrameLoader::didReceiveData() wasn't getting called in this case, which |
6494 // resulted in the SubstituteData document not getting displayed. | 6494 // resulted in the SubstituteData document not getting displayed. |
6495 WebURLError error; | 6495 WebURLError error; |
6496 error.reason = 1337; | 6496 error.reason = 1337; |
6497 error.domain = "WebFrameTest"; | 6497 error.domain = "WebFrameTest"; |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7004 } | 7004 } |
7005 | 7005 |
7006 TEST_P(ParameterizedWebFrameTest, DidAccessInitialDocumentViaJavascriptUrl) { | 7006 TEST_P(ParameterizedWebFrameTest, DidAccessInitialDocumentViaJavascriptUrl) { |
7007 TestAccessInitialDocumentWebFrameClient web_frame_client; | 7007 TestAccessInitialDocumentWebFrameClient web_frame_client; |
7008 FrameTestHelpers::WebViewHelper web_view_helper; | 7008 FrameTestHelpers::WebViewHelper web_view_helper; |
7009 web_view_helper.Initialize(true, &web_frame_client); | 7009 web_view_helper.Initialize(true, &web_frame_client); |
7010 RunPendingTasks(); | 7010 RunPendingTasks(); |
7011 EXPECT_EQ(0, web_frame_client.did_access_initial_document_); | 7011 EXPECT_EQ(0, web_frame_client.did_access_initial_document_); |
7012 | 7012 |
7013 // Access the initial document from a javascript: URL. | 7013 // Access the initial document from a javascript: URL. |
7014 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 7014 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
7015 "javascript:document.body.appendChild(document." | 7015 "javascript:document.body.appendChild(document." |
7016 "createTextNode('Modified'))"); | 7016 "createTextNode('Modified'))"); |
7017 EXPECT_EQ(1, web_frame_client.did_access_initial_document_); | 7017 EXPECT_EQ(1, web_frame_client.did_access_initial_document_); |
7018 | 7018 |
7019 web_view_helper.Reset(); | 7019 web_view_helper.Reset(); |
7020 } | 7020 } |
7021 | 7021 |
7022 TEST_P(ParameterizedWebFrameTest, DidAccessInitialDocumentBodyBeforeModalDialog) | 7022 TEST_P(ParameterizedWebFrameTest, DidAccessInitialDocumentBodyBeforeModalDialog) |
7023 { | 7023 { |
7024 TestAccessInitialDocumentWebFrameClient web_frame_client; | 7024 TestAccessInitialDocumentWebFrameClient web_frame_client; |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7341 frame->DataSource()->GetRequest().GetCachePolicy()); | 7341 frame->DataSource()->GetRequest().GetCachePolicy()); |
7342 } | 7342 } |
7343 | 7343 |
7344 TEST_P(ParameterizedWebFrameTest, BackDuringChildFrameReload) { | 7344 TEST_P(ParameterizedWebFrameTest, BackDuringChildFrameReload) { |
7345 RegisterMockedHttpURLLoad("page_with_blank_iframe.html"); | 7345 RegisterMockedHttpURLLoad("page_with_blank_iframe.html"); |
7346 FrameTestHelpers::WebViewHelper web_view_helper; | 7346 FrameTestHelpers::WebViewHelper web_view_helper; |
7347 web_view_helper.InitializeAndLoad(base_url_ + "page_with_blank_iframe.html", | 7347 web_view_helper.InitializeAndLoad(base_url_ + "page_with_blank_iframe.html", |
7348 true); | 7348 true); |
7349 WebLocalFrameBase* main_frame = web_view_helper.LocalMainFrame(); | 7349 WebLocalFrameBase* main_frame = web_view_helper.LocalMainFrame(); |
7350 const FrameLoader& main_frame_loader = main_frame->GetFrame()->Loader(); | 7350 const FrameLoader& main_frame_loader = main_frame->GetFrame()->Loader(); |
7351 WebFrame* child_frame = main_frame->FirstChild(); | 7351 WebLocalFrame* child_frame = main_frame->FirstChild()->ToWebLocalFrame(); |
7352 ASSERT_TRUE(child_frame); | 7352 ASSERT_TRUE(child_frame); |
7353 | 7353 |
7354 // Start a history navigation, then have a different frame commit a | 7354 // Start a history navigation, then have a different frame commit a |
7355 // navigation. In this case, reload an about:blank frame, which will commit | 7355 // navigation. In this case, reload an about:blank frame, which will commit |
7356 // synchronously. After the history navigation completes, both the | 7356 // synchronously. After the history navigation completes, both the |
7357 // appropriate document url and the current history item should reflect the | 7357 // appropriate document url and the current history item should reflect the |
7358 // history navigation. | 7358 // history navigation. |
7359 RegisterMockedHttpURLLoad("white-1x1.png"); | 7359 RegisterMockedHttpURLLoad("white-1x1.png"); |
7360 WebHistoryItem item; | 7360 WebHistoryItem item; |
7361 item.Initialize(); | 7361 item.Initialize(); |
7362 WebURL history_url(ToKURL(base_url_ + "white-1x1.png")); | 7362 WebURL history_url(ToKURL(base_url_ + "white-1x1.png")); |
7363 item.SetURLString(history_url.GetString()); | 7363 item.SetURLString(history_url.GetString()); |
7364 WebURLRequest request = main_frame->RequestFromHistoryItem( | 7364 WebURLRequest request = main_frame->RequestFromHistoryItem( |
7365 item, WebCachePolicy::kUseProtocolCachePolicy); | 7365 item, WebCachePolicy::kUseProtocolCachePolicy); |
7366 main_frame->Load(request, WebFrameLoadType::kBackForward, item); | 7366 main_frame->Load(request, WebFrameLoadType::kBackForward, item); |
7367 | 7367 |
7368 FrameTestHelpers::ReloadFrame(child_frame); | 7368 FrameTestHelpers::ReloadFrame(child_frame); |
7369 EXPECT_EQ(item.UrlString(), main_frame->GetDocument().Url().GetString()); | 7369 EXPECT_EQ(item.UrlString(), main_frame->GetDocument().Url().GetString()); |
7370 EXPECT_EQ(item.UrlString(), WebString(main_frame_loader.GetDocumentLoader() | 7370 EXPECT_EQ(item.UrlString(), WebString(main_frame_loader.GetDocumentLoader() |
7371 ->GetHistoryItem() | 7371 ->GetHistoryItem() |
7372 ->UrlString())); | 7372 ->UrlString())); |
7373 } | 7373 } |
7374 | 7374 |
7375 TEST_P(ParameterizedWebFrameTest, ReloadPost) { | 7375 TEST_P(ParameterizedWebFrameTest, ReloadPost) { |
7376 RegisterMockedHttpURLLoad("reload_post.html"); | 7376 RegisterMockedHttpURLLoad("reload_post.html"); |
7377 FrameTestHelpers::WebViewHelper web_view_helper; | 7377 FrameTestHelpers::WebViewHelper web_view_helper; |
7378 web_view_helper.InitializeAndLoad(base_url_ + "reload_post.html", true); | 7378 web_view_helper.InitializeAndLoad(base_url_ + "reload_post.html", true); |
7379 WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); | 7379 WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); |
7380 | 7380 |
7381 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 7381 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
7382 "javascript:document.forms[0].submit()"); | 7382 "javascript:document.forms[0].submit()"); |
7383 // Pump requests one more time after the javascript URL has executed to | 7383 // Pump requests one more time after the javascript URL has executed to |
7384 // trigger the actual POST load request. | 7384 // trigger the actual POST load request. |
7385 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( | 7385 FrameTestHelpers::PumpPendingRequestsForFrameToLoad( |
7386 web_view_helper.WebView()->MainFrame()); | 7386 web_view_helper.WebView()->MainFrame()); |
7387 EXPECT_EQ(WebString::FromUTF8("POST"), | 7387 EXPECT_EQ(WebString::FromUTF8("POST"), |
7388 frame->DataSource()->GetRequest().HttpMethod()); | 7388 frame->DataSource()->GetRequest().HttpMethod()); |
7389 | 7389 |
7390 FrameTestHelpers::ReloadFrame(frame); | 7390 FrameTestHelpers::ReloadFrame(frame); |
7391 EXPECT_EQ(WebCachePolicy::kValidatingCacheData, | 7391 EXPECT_EQ(WebCachePolicy::kValidatingCacheData, |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7565 NavigateToSameNoConditionalRequestForSubresource) { | 7565 NavigateToSameNoConditionalRequestForSubresource) { |
7566 RegisterMockedHttpURLLoad("foo_with_image.html"); | 7566 RegisterMockedHttpURLLoad("foo_with_image.html"); |
7567 RegisterMockedHttpURLLoad("white-1x1.png"); | 7567 RegisterMockedHttpURLLoad("white-1x1.png"); |
7568 TestSameDocumentWithImageWebFrameClient client; | 7568 TestSameDocumentWithImageWebFrameClient client; |
7569 FrameTestHelpers::WebViewHelper web_view_helper; | 7569 FrameTestHelpers::WebViewHelper web_view_helper; |
7570 web_view_helper.InitializeAndLoad(base_url_ + "foo_with_image.html", true, | 7570 web_view_helper.InitializeAndLoad(base_url_ + "foo_with_image.html", true, |
7571 &client, nullptr, nullptr, | 7571 &client, nullptr, nullptr, |
7572 &ConfigureLoadsImagesAutomatically); | 7572 &ConfigureLoadsImagesAutomatically); |
7573 | 7573 |
7574 WebCache::Clear(); | 7574 WebCache::Clear(); |
7575 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 7575 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
7576 base_url_ + "foo_with_image.html"); | 7576 base_url_ + "foo_with_image.html"); |
7577 | 7577 |
7578 // 2 images are requested, and each triggers 2 willSendRequest() calls, | 7578 // 2 images are requested, and each triggers 2 willSendRequest() calls, |
7579 // once for preloading and once for the real request. | 7579 // once for preloading and once for the real request. |
7580 EXPECT_EQ(client.NumOfImageRequests(), 4); | 7580 EXPECT_EQ(client.NumOfImageRequests(), 4); |
7581 } | 7581 } |
7582 | 7582 |
7583 TEST_P(ParameterizedWebFrameTest, WebNodeImageContents) { | 7583 TEST_P(ParameterizedWebFrameTest, WebNodeImageContents) { |
7584 FrameTestHelpers::WebViewHelper web_view_helper; | 7584 FrameTestHelpers::WebViewHelper web_view_helper; |
7585 web_view_helper.InitializeAndLoad("about:blank", true); | 7585 web_view_helper.InitializeAndLoad("about:blank", true); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7730 | 7730 |
7731 TestHistoryWebFrameClient client; | 7731 TestHistoryWebFrameClient client; |
7732 FrameTestHelpers::WebViewHelper web_view_helper; | 7732 FrameTestHelpers::WebViewHelper web_view_helper; |
7733 web_view_helper.InitializeAndLoad("about:blank", true, &client); | 7733 web_view_helper.InitializeAndLoad("about:blank", true, &client); |
7734 | 7734 |
7735 WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); | 7735 WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); |
7736 | 7736 |
7737 frame->ExecuteScript(WebScriptSource(WebString::FromUTF8( | 7737 frame->ExecuteScript(WebScriptSource(WebString::FromUTF8( |
7738 "document.body.appendChild(document.createElement('iframe'))"))); | 7738 "document.body.appendChild(document.createElement('iframe'))"))); |
7739 | 7739 |
7740 WebFrame* iframe = frame->FirstChild(); | 7740 WebLocalFrame* iframe = frame->FirstChild()->ToWebLocalFrame(); |
7741 ASSERT_EQ(&client.ChildClient(), ToWebLocalFrameBase(iframe)->Client()); | 7741 ASSERT_EQ(&client.ChildClient(), ToWebLocalFrameBase(iframe)->Client()); |
7742 | 7742 |
7743 std::string url1 = base_url_ + "history.html"; | 7743 std::string url1 = base_url_ + "history.html"; |
7744 FrameTestHelpers::LoadFrame(iframe, url1); | 7744 FrameTestHelpers::LoadFrame(iframe, url1); |
7745 EXPECT_EQ(url1, iframe->GetDocument().Url().GetString().Utf8()); | 7745 EXPECT_EQ(url1, iframe->GetDocument().Url().GetString().Utf8()); |
7746 EXPECT_TRUE(client.ChildClient().ReplacesCurrentHistoryItem()); | 7746 EXPECT_TRUE(client.ChildClient().ReplacesCurrentHistoryItem()); |
7747 | 7747 |
7748 std::string url2 = base_url_ + "find.html"; | 7748 std::string url2 = base_url_ + "find.html"; |
7749 FrameTestHelpers::LoadFrame(iframe, url2); | 7749 FrameTestHelpers::LoadFrame(iframe, url2); |
7750 EXPECT_EQ(url2, iframe->GetDocument().Url().GetString().Utf8()); | 7750 EXPECT_EQ(url2, iframe->GetDocument().Url().GetString().Utf8()); |
7751 EXPECT_FALSE(client.ChildClient().ReplacesCurrentHistoryItem()); | 7751 EXPECT_FALSE(client.ChildClient().ReplacesCurrentHistoryItem()); |
7752 } | 7752 } |
7753 | 7753 |
7754 // Tests that a navigation in a frame with a non-blank initial URL will create | 7754 // Tests that a navigation in a frame with a non-blank initial URL will create |
7755 // a new history item, unlike the case above. | 7755 // a new history item, unlike the case above. |
7756 TEST_P(ParameterizedWebFrameTest, FirstNonBlankSubframeNavigation) { | 7756 TEST_P(ParameterizedWebFrameTest, FirstNonBlankSubframeNavigation) { |
7757 RegisterMockedHttpURLLoad("history.html"); | 7757 RegisterMockedHttpURLLoad("history.html"); |
7758 RegisterMockedHttpURLLoad("find.html"); | 7758 RegisterMockedHttpURLLoad("find.html"); |
7759 | 7759 |
7760 TestHistoryWebFrameClient client; | 7760 TestHistoryWebFrameClient client; |
7761 FrameTestHelpers::WebViewHelper web_view_helper; | 7761 FrameTestHelpers::WebViewHelper web_view_helper; |
7762 web_view_helper.InitializeAndLoad("about:blank", true, &client); | 7762 web_view_helper.InitializeAndLoad("about:blank", true, &client); |
7763 | 7763 |
7764 WebFrame* frame = web_view_helper.WebView()->MainFrame(); | 7764 WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); |
7765 | 7765 |
7766 std::string url1 = base_url_ + "history.html"; | 7766 std::string url1 = base_url_ + "history.html"; |
7767 FrameTestHelpers::LoadFrame( | 7767 FrameTestHelpers::LoadFrame( |
7768 frame, | 7768 frame, |
7769 "javascript:var f = document.createElement('iframe'); " | 7769 "javascript:var f = document.createElement('iframe'); " |
7770 "f.src = '" + | 7770 "f.src = '" + |
7771 url1 + | 7771 url1 + |
7772 "';" | 7772 "';" |
7773 "document.body.appendChild(f)"); | 7773 "document.body.appendChild(f)"); |
7774 | 7774 |
7775 WebFrame* iframe = frame->FirstChild(); | 7775 WebLocalFrame* iframe = frame->FirstChild()->ToWebLocalFrame(); |
7776 EXPECT_EQ(url1, iframe->GetDocument().Url().GetString().Utf8()); | 7776 EXPECT_EQ(url1, iframe->GetDocument().Url().GetString().Utf8()); |
7777 | 7777 |
7778 std::string url2 = base_url_ + "find.html"; | 7778 std::string url2 = base_url_ + "find.html"; |
7779 FrameTestHelpers::LoadFrame(iframe, url2); | 7779 FrameTestHelpers::LoadFrame(iframe, url2); |
7780 EXPECT_EQ(url2, iframe->GetDocument().Url().GetString().Utf8()); | 7780 EXPECT_EQ(url2, iframe->GetDocument().Url().GetString().Utf8()); |
7781 EXPECT_FALSE(client.ChildClient().ReplacesCurrentHistoryItem()); | 7781 EXPECT_FALSE(client.ChildClient().ReplacesCurrentHistoryItem()); |
7782 } | 7782 } |
7783 | 7783 |
7784 // Test verifies that layout will change a layer's scrollable attibutes | 7784 // Test verifies that layout will change a layer's scrollable attibutes |
7785 TEST_F(WebFrameTest, overflowHiddenRewrite) { | 7785 TEST_F(WebFrameTest, overflowHiddenRewrite) { |
7786 RegisterMockedHttpURLLoad("non-scrollable.html"); | 7786 RegisterMockedHttpURLLoad("non-scrollable.html"); |
7787 std::unique_ptr<FakeCompositingWebViewClient> | 7787 std::unique_ptr<FakeCompositingWebViewClient> |
7788 fake_compositing_web_view_client = | 7788 fake_compositing_web_view_client = |
7789 WTF::MakeUnique<FakeCompositingWebViewClient>(); | 7789 WTF::MakeUnique<FakeCompositingWebViewClient>(); |
7790 FrameTestHelpers::WebViewHelper web_view_helper; | 7790 FrameTestHelpers::WebViewHelper web_view_helper; |
7791 web_view_helper.Initialize(true, nullptr, | 7791 web_view_helper.Initialize(true, nullptr, |
7792 fake_compositing_web_view_client.get(), nullptr, | 7792 fake_compositing_web_view_client.get(), nullptr, |
7793 &ConfigureCompositingWebView); | 7793 &ConfigureCompositingWebView); |
7794 | 7794 |
7795 web_view_helper.Resize(WebSize(100, 100)); | 7795 web_view_helper.Resize(WebSize(100, 100)); |
7796 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrame(), | 7796 FrameTestHelpers::LoadFrame(web_view_helper.WebView()->MainFrameImpl(), |
7797 base_url_ + "non-scrollable.html"); | 7797 base_url_ + "non-scrollable.html"); |
7798 | 7798 |
7799 PaintLayerCompositor* compositor = web_view_helper.WebView()->Compositor(); | 7799 PaintLayerCompositor* compositor = web_view_helper.WebView()->Compositor(); |
7800 ASSERT_TRUE(compositor->ScrollLayer()); | 7800 ASSERT_TRUE(compositor->ScrollLayer()); |
7801 | 7801 |
7802 // Verify that the WebLayer is not scrollable initially. | 7802 // Verify that the WebLayer is not scrollable initially. |
7803 GraphicsLayer* scroll_layer = compositor->ScrollLayer(); | 7803 GraphicsLayer* scroll_layer = compositor->ScrollLayer(); |
7804 WebLayer* web_scroll_layer = scroll_layer->PlatformLayer(); | 7804 WebLayer* web_scroll_layer = scroll_layer->PlatformLayer(); |
7805 ASSERT_FALSE(web_scroll_layer->UserScrollableHorizontal()); | 7805 ASSERT_FALSE(web_scroll_layer->UserScrollableHorizontal()); |
7806 ASSERT_FALSE(web_scroll_layer->UserScrollableVertical()); | 7806 ASSERT_FALSE(web_scroll_layer->UserScrollableVertical()); |
7807 | 7807 |
7808 // Call javascript to make the layer scrollable, and verify it. | 7808 // Call javascript to make the layer scrollable, and verify it. |
7809 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); | 7809 WebLocalFrameBase* frame = web_view_helper.WebView()->MainFrameImpl(); |
7810 frame->ExecuteScript(WebScriptSource("allowScroll();")); | 7810 frame->ExecuteScript(WebScriptSource("allowScroll();")); |
7811 web_view_helper.WebView()->UpdateAllLifecyclePhases(); | 7811 web_view_helper.WebView()->UpdateAllLifecyclePhases(); |
7812 ASSERT_TRUE(web_scroll_layer->UserScrollableHorizontal()); | 7812 ASSERT_TRUE(web_scroll_layer->UserScrollableHorizontal()); |
7813 ASSERT_TRUE(web_scroll_layer->UserScrollableVertical()); | 7813 ASSERT_TRUE(web_scroll_layer->UserScrollableVertical()); |
7814 } | 7814 } |
7815 | 7815 |
7816 // Test that currentHistoryItem reflects the current page, not the provisional | 7816 // Test that currentHistoryItem reflects the current page, not the provisional |
7817 // load. | 7817 // load. |
7818 TEST_P(ParameterizedWebFrameTest, CurrentHistoryItem) { | 7818 TEST_P(ParameterizedWebFrameTest, CurrentHistoryItem) { |
7819 RegisterMockedHttpURLLoad("fixed_layout.html"); | 7819 RegisterMockedHttpURLLoad("fixed_layout.html"); |
7820 std::string url = base_url_ + "fixed_layout.html"; | 7820 std::string url = base_url_ + "fixed_layout.html"; |
7821 | 7821 |
7822 FrameTestHelpers::WebViewHelper web_view_helper; | 7822 FrameTestHelpers::WebViewHelper web_view_helper; |
7823 web_view_helper.Initialize(); | 7823 web_view_helper.Initialize(); |
7824 WebFrame* frame = web_view_helper.WebView()->MainFrame(); | 7824 WebLocalFrame* frame = web_view_helper.WebView()->MainFrameImpl(); |
7825 const FrameLoader& main_frame_loader = | 7825 const FrameLoader& main_frame_loader = |
7826 web_view_helper.WebView()->MainFrameImpl()->GetFrame()->Loader(); | 7826 web_view_helper.WebView()->MainFrameImpl()->GetFrame()->Loader(); |
7827 WebURLRequest request(ToKURL(url)); | 7827 WebURLRequest request(ToKURL(url)); |
7828 frame->LoadRequest(request); | 7828 frame->LoadRequest(request); |
7829 | 7829 |
7830 // Before commit, there is no history item. | 7830 // Before commit, there is no history item. |
7831 EXPECT_FALSE(main_frame_loader.GetDocumentLoader()->GetHistoryItem()); | 7831 EXPECT_FALSE(main_frame_loader.GetDocumentLoader()->GetHistoryItem()); |
7832 | 7832 |
7833 FrameTestHelpers::PumpPendingRequestsForFrameToLoad(frame); | 7833 FrameTestHelpers::PumpPendingRequestsForFrameToLoad(frame); |
7834 | 7834 |
(...skipping 3035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10870 client.AddExpectedRequest(ToKURL("http://internal.test/image_slow.pl"), | 10870 client.AddExpectedRequest(ToKURL("http://internal.test/image_slow.pl"), |
10871 WebURLRequest::kPriorityLow); | 10871 WebURLRequest::kPriorityLow); |
10872 client.AddExpectedRequest( | 10872 client.AddExpectedRequest( |
10873 ToKURL("http://internal.test/image_slow_out_of_viewport.pl"), | 10873 ToKURL("http://internal.test/image_slow_out_of_viewport.pl"), |
10874 WebURLRequest::kPriorityLow); | 10874 WebURLRequest::kPriorityLow); |
10875 | 10875 |
10876 FrameTestHelpers::WebViewHelper helper; | 10876 FrameTestHelpers::WebViewHelper helper; |
10877 helper.Initialize(true, &client); | 10877 helper.Initialize(true, &client); |
10878 helper.Resize(WebSize(640, 480)); | 10878 helper.Resize(WebSize(640, 480)); |
10879 FrameTestHelpers::LoadFrame( | 10879 FrameTestHelpers::LoadFrame( |
10880 helper.WebView()->MainFrame(), | 10880 helper.WebView()->MainFrameImpl(), |
10881 base_url_ + "promote_img_in_viewport_priority.html"); | 10881 base_url_ + "promote_img_in_viewport_priority.html"); |
10882 | 10882 |
10883 // Ensure the image in the viewport got promoted after the request was sent. | 10883 // Ensure the image in the viewport got promoted after the request was sent. |
10884 Resource* image = ToWebLocalFrameBase(helper.WebView()->MainFrame()) | 10884 Resource* image = ToWebLocalFrameBase(helper.WebView()->MainFrame()) |
10885 ->GetFrame() | 10885 ->GetFrame() |
10886 ->GetDocument() | 10886 ->GetDocument() |
10887 ->Fetcher() | 10887 ->Fetcher() |
10888 ->AllResources() | 10888 ->AllResources() |
10889 .at(ToKURL("http://internal.test/image_slow.pl")); | 10889 .at(ToKURL("http://internal.test/image_slow.pl")); |
10890 DCHECK(image); | 10890 DCHECK(image); |
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12258 if (obj->IsText()) { | 12258 if (obj->IsText()) { |
12259 LayoutText* layout_text = ToLayoutText(obj); | 12259 LayoutText* layout_text = ToLayoutText(obj); |
12260 text = layout_text->GetText(); | 12260 text = layout_text->GetText(); |
12261 break; | 12261 break; |
12262 } | 12262 } |
12263 } | 12263 } |
12264 EXPECT_EQ("foo alt", text.Utf8()); | 12264 EXPECT_EQ("foo alt", text.Utf8()); |
12265 } | 12265 } |
12266 | 12266 |
12267 } // namespace blink | 12267 } // namespace blink |
OLD | NEW |