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 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2299 EXPECT_EQ(initialPageScaleFactor, webViewHelper.webViewImpl()->pageS
caleFactor()); | 2299 EXPECT_EQ(initialPageScaleFactor, webViewHelper.webViewImpl()->pageS
caleFactor()); |
2300 EXPECT_EQ(expectedScrollOffset, webViewHelper.webViewImpl()->mainFra
me()->scrollOffset()); | 2300 EXPECT_EQ(expectedScrollOffset, webViewHelper.webViewImpl()->mainFra
me()->scrollOffset()); |
2301 } | 2301 } |
2302 } | 2302 } |
2303 }; | 2303 }; |
2304 | 2304 |
2305 INSTANTIATE_TEST_CASE_P(All, WebFrameResizeTest, ::testing::Values( | 2305 INSTANTIATE_TEST_CASE_P(All, WebFrameResizeTest, ::testing::Values( |
2306 ParameterizedWebFrameTestConfig::Default, | 2306 ParameterizedWebFrameTestConfig::Default, |
2307 ParameterizedWebFrameTestConfig::RootLayerScrolls)); | 2307 ParameterizedWebFrameTestConfig::RootLayerScrolls)); |
2308 | 2308 |
| 2309 // Fails on Android: https://crbug.com/528186 |
| 2310 #if OS(ANDROID) |
| 2311 TEST_P(WebFrameResizeTest, DISABLED_ResizeYieldsCorrectScrollAndScaleForWidthEqu
alsDeviceWidth) |
| 2312 #else |
2309 TEST_P(WebFrameResizeTest, ResizeYieldsCorrectScrollAndScaleForWidthEqualsDevice
Width) | 2313 TEST_P(WebFrameResizeTest, ResizeYieldsCorrectScrollAndScaleForWidthEqualsDevice
Width) |
| 2314 #endif |
2310 { | 2315 { |
2311 // With width=device-width, pageScaleFactor is preserved across resizes as | 2316 // With width=device-width, pageScaleFactor is preserved across resizes as |
2312 // long as the content adjusts according to the device-width. | 2317 // long as the content adjusts according to the device-width. |
2313 const char* url = "resize_scroll_mobile.html"; | 2318 const char* url = "resize_scroll_mobile.html"; |
2314 const float initialPageScaleFactor = 1; | 2319 const float initialPageScaleFactor = 1; |
2315 const WebSize scrollOffset(0, 50); | 2320 const WebSize scrollOffset(0, 50); |
2316 const WebSize viewportSize(120, 160); | 2321 const WebSize viewportSize(120, 160); |
2317 const bool shouldScaleRelativeToViewportWidth = true; | 2322 const bool shouldScaleRelativeToViewportWidth = true; |
2318 | 2323 |
2319 testResizeYieldsCorrectScrollAndScale( | 2324 testResizeYieldsCorrectScrollAndScale( |
2320 url, initialPageScaleFactor, scrollOffset, viewportSize, shouldScaleRela
tiveToViewportWidth); | 2325 url, initialPageScaleFactor, scrollOffset, viewportSize, shouldScaleRela
tiveToViewportWidth); |
2321 } | 2326 } |
2322 | 2327 |
| 2328 // Fails on Android: https://crbug.com/528186 |
| 2329 #if OS(ANDROID) |
| 2330 TEST_P(WebFrameResizeTest, DISABLED_ResizeYieldsCorrectScrollAndScaleForMinimumS
cale) |
| 2331 #else |
2323 TEST_P(WebFrameResizeTest, ResizeYieldsCorrectScrollAndScaleForMinimumScale) | 2332 TEST_P(WebFrameResizeTest, ResizeYieldsCorrectScrollAndScaleForMinimumScale) |
| 2333 #endif |
2324 { | 2334 { |
2325 // This tests a scenario where minimum-scale is set to 1.0, but some element | 2335 // This tests a scenario where minimum-scale is set to 1.0, but some element |
2326 // on the page is slightly larger than the portrait width, so our "natural" | 2336 // on the page is slightly larger than the portrait width, so our "natural" |
2327 // minimum-scale would be lower. In that case, we should stick to 1.0 scale | 2337 // minimum-scale would be lower. In that case, we should stick to 1.0 scale |
2328 // on rotation and not do anything strange. | 2338 // on rotation and not do anything strange. |
2329 const char* url = "resize_scroll_minimum_scale.html"; | 2339 const char* url = "resize_scroll_minimum_scale.html"; |
2330 const float initialPageScaleFactor = 1; | 2340 const float initialPageScaleFactor = 1; |
2331 const WebSize scrollOffset(0, 0); | 2341 const WebSize scrollOffset(0, 0); |
2332 const WebSize viewportSize(240, 320); | 2342 const WebSize viewportSize(240, 320); |
2333 const bool shouldScaleRelativeToViewportWidth = false; | 2343 const bool shouldScaleRelativeToViewportWidth = false; |
2334 | 2344 |
2335 testResizeYieldsCorrectScrollAndScale( | 2345 testResizeYieldsCorrectScrollAndScale( |
2336 url, initialPageScaleFactor, scrollOffset, viewportSize, shouldScaleRela
tiveToViewportWidth); | 2346 url, initialPageScaleFactor, scrollOffset, viewportSize, shouldScaleRela
tiveToViewportWidth); |
2337 } | 2347 } |
2338 | 2348 |
| 2349 // Fails on Android: https://crbug.com/528186 |
| 2350 #if OS(ANDROID) |
| 2351 TEST_P(WebFrameResizeTest, DISABLED_ResizeYieldsCorrectScrollAndScaleForFixedWid
th) |
| 2352 #else |
2339 TEST_P(WebFrameResizeTest, ResizeYieldsCorrectScrollAndScaleForFixedWidth) | 2353 TEST_P(WebFrameResizeTest, ResizeYieldsCorrectScrollAndScaleForFixedWidth) |
| 2354 #endif |
2340 { | 2355 { |
2341 // With a fixed width, pageScaleFactor scales by the relative change in view
port width. | 2356 // With a fixed width, pageScaleFactor scales by the relative change in view
port width. |
2342 const char* url = "resize_scroll_fixed_width.html"; | 2357 const char* url = "resize_scroll_fixed_width.html"; |
2343 const float initialPageScaleFactor = 2; | 2358 const float initialPageScaleFactor = 2; |
2344 const WebSize scrollOffset(0, 200); | 2359 const WebSize scrollOffset(0, 200); |
2345 const WebSize viewportSize(240, 320); | 2360 const WebSize viewportSize(240, 320); |
2346 const bool shouldScaleRelativeToViewportWidth = true; | 2361 const bool shouldScaleRelativeToViewportWidth = true; |
2347 | 2362 |
2348 testResizeYieldsCorrectScrollAndScale( | 2363 testResizeYieldsCorrectScrollAndScale( |
2349 url, initialPageScaleFactor, scrollOffset, viewportSize, shouldScaleRela
tiveToViewportWidth); | 2364 url, initialPageScaleFactor, scrollOffset, viewportSize, shouldScaleRela
tiveToViewportWidth); |
2350 } | 2365 } |
2351 | 2366 |
| 2367 // Fails on Android: https://crbug.com/528186 |
| 2368 #if OS(ANDROID) |
| 2369 TEST_P(WebFrameResizeTest, DISABLED_ResizeYieldsCorrectScrollAndScaleForFixedLay
out) |
| 2370 #else |
2352 TEST_P(WebFrameResizeTest, ResizeYieldsCorrectScrollAndScaleForFixedLayout) | 2371 TEST_P(WebFrameResizeTest, ResizeYieldsCorrectScrollAndScaleForFixedLayout) |
| 2372 #endif |
2353 { | 2373 { |
2354 // With a fixed layout, pageScaleFactor scales by the relative change in vie
wport width. | 2374 // With a fixed layout, pageScaleFactor scales by the relative change in vie
wport width. |
2355 const char* url = "resize_scroll_fixed_layout.html"; | 2375 const char* url = "resize_scroll_fixed_layout.html"; |
2356 const float initialPageScaleFactor = 2; | 2376 const float initialPageScaleFactor = 2; |
2357 const WebSize scrollOffset(200, 400); | 2377 const WebSize scrollOffset(200, 400); |
2358 const WebSize viewportSize(320, 240); | 2378 const WebSize viewportSize(320, 240); |
2359 const bool shouldScaleRelativeToViewportWidth = true; | 2379 const bool shouldScaleRelativeToViewportWidth = true; |
2360 | 2380 |
2361 testResizeYieldsCorrectScrollAndScale( | 2381 testResizeYieldsCorrectScrollAndScale( |
2362 url, initialPageScaleFactor, scrollOffset, viewportSize, shouldScaleRela
tiveToViewportWidth); | 2382 url, initialPageScaleFactor, scrollOffset, viewportSize, shouldScaleRela
tiveToViewportWidth); |
(...skipping 5396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7759 } | 7779 } |
7760 | 7780 |
7761 FixedLayoutTestWebViewClient m_client; | 7781 FixedLayoutTestWebViewClient m_client; |
7762 FrameTestHelpers::WebViewHelper m_webViewHelper; | 7782 FrameTestHelpers::WebViewHelper m_webViewHelper; |
7763 }; | 7783 }; |
7764 | 7784 |
7765 INSTANTIATE_TEST_CASE_P(All, ViewportOnResizeTest, ::testing::Values( | 7785 INSTANTIATE_TEST_CASE_P(All, ViewportOnResizeTest, ::testing::Values( |
7766 ParameterizedWebFrameTestConfig::Default, | 7786 ParameterizedWebFrameTestConfig::Default, |
7767 ParameterizedWebFrameTestConfig::RootLayerScrolls)); | 7787 ParameterizedWebFrameTestConfig::RootLayerScrolls)); |
7768 | 7788 |
| 7789 // Fails on Android: https://crbug.com/528186 |
| 7790 #if OS(ANDROID) |
| 7791 TEST_P(ViewportOnResizeTest, DISABLED_ViewportInvalidatedOnResizeWithEmulation) |
| 7792 #else |
7769 TEST_P(ViewportOnResizeTest, ViewportInvalidatedOnResizeWithEmulation) | 7793 TEST_P(ViewportOnResizeTest, ViewportInvalidatedOnResizeWithEmulation) |
| 7794 #endif |
7770 { | 7795 { |
7771 WebDeviceEmulationParams params; | 7796 WebDeviceEmulationParams params; |
7772 params.screenPosition = WebDeviceEmulationParams::Mobile; | 7797 params.screenPosition = WebDeviceEmulationParams::Mobile; |
7773 m_webViewHelper.webView()->enableDeviceEmulation(params); | 7798 m_webViewHelper.webView()->enableDeviceEmulation(params); |
7774 | 7799 |
7775 testResize(WebSize(700, 500), "300x300"); | 7800 testResize(WebSize(700, 500), "300x300"); |
7776 testResize(WebSize(710, 500), "400x300"); | 7801 testResize(WebSize(710, 500), "400x300"); |
7777 testResize(WebSize(690, 500), "200x300"); | 7802 testResize(WebSize(690, 500), "200x300"); |
7778 testResize(WebSize(700, 510), "300x400"); | 7803 testResize(WebSize(700, 510), "300x400"); |
7779 testResize(WebSize(700, 490), "300x200"); | 7804 testResize(WebSize(700, 490), "300x200"); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7861 // Finally, make sure an embedder triggered load in the local frame swapped | 7886 // Finally, make sure an embedder triggered load in the local frame swapped |
7862 // back in works. | 7887 // back in works. |
7863 registerMockedHttpURLLoad("send_beacon.html"); | 7888 registerMockedHttpURLLoad("send_beacon.html"); |
7864 registerMockedHttpURLLoad("reload_post.html"); // url param to sendBeacon() | 7889 registerMockedHttpURLLoad("reload_post.html"); // url param to sendBeacon() |
7865 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "send_beacon.html"); | 7890 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "send_beacon.html"); |
7866 | 7891 |
7867 view->close(); | 7892 view->close(); |
7868 } | 7893 } |
7869 | 7894 |
7870 // See https://crbug.com/525285. | 7895 // See https://crbug.com/525285. |
| 7896 // Fails on Android: https://crbug.com/528186 |
| 7897 #if OS(ANDROID) |
| 7898 TEST_P(ParameterizedWebFrameTest, DISABLED_RemoteToLocalSwapOnMainFrameInitializ
esCoreFrame) |
| 7899 #else |
7871 TEST_P(ParameterizedWebFrameTest, RemoteToLocalSwapOnMainFrameInitializesCoreFra
me) | 7900 TEST_P(ParameterizedWebFrameTest, RemoteToLocalSwapOnMainFrameInitializesCoreFra
me) |
| 7901 #endif |
7872 { | 7902 { |
7873 FrameTestHelpers::TestWebViewClient viewClient; | 7903 FrameTestHelpers::TestWebViewClient viewClient; |
7874 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | 7904 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
7875 WebView* view = WebView::create(&viewClient); | 7905 WebView* view = WebView::create(&viewClient); |
7876 view->setMainFrame(remoteClient.frame()); | 7906 view->setMainFrame(remoteClient.frame()); |
7877 WebRemoteFrame* remoteRoot = view->mainFrame()->toWebRemoteFrame(); | 7907 WebRemoteFrame* remoteRoot = view->mainFrame()->toWebRemoteFrame(); |
7878 remoteRoot->setReplicatedOrigin(SecurityOrigin::createUnique()); | 7908 remoteRoot->setReplicatedOrigin(SecurityOrigin::createUnique()); |
7879 | 7909 |
7880 FrameTestHelpers::TestWebFrameClient localFrameClient; | 7910 FrameTestHelpers::TestWebFrameClient localFrameClient; |
7881 remoteRoot->createLocalChild(WebTreeScopeType::Document, "", WebSandboxFlags
::None, &localFrameClient, nullptr); | 7911 remoteRoot->createLocalChild(WebTreeScopeType::Document, "", WebSandboxFlags
::None, &localFrameClient, nullptr); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8170 | 8200 |
8171 TEST_F(WebFrameTest, MaxFramesDetach) | 8201 TEST_F(WebFrameTest, MaxFramesDetach) |
8172 { | 8202 { |
8173 registerMockedHttpURLLoad("max-frames-detach.html"); | 8203 registerMockedHttpURLLoad("max-frames-detach.html"); |
8174 FrameTestHelpers::WebViewHelper webViewHelper; | 8204 FrameTestHelpers::WebViewHelper webViewHelper; |
8175 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); | 8205 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); |
8176 webViewImpl->mainFrameImpl()->collectGarbage(); | 8206 webViewImpl->mainFrameImpl()->collectGarbage(); |
8177 } | 8207 } |
8178 | 8208 |
8179 } // namespace blink | 8209 } // namespace blink |
OLD | NEW |