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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 #include "core/input/EventHandler.h" | 72 #include "core/input/EventHandler.h" |
73 #include "core/layout/HitTestResult.h" | 73 #include "core/layout/HitTestResult.h" |
74 #include "core/layout/LayoutFullScreen.h" | 74 #include "core/layout/LayoutFullScreen.h" |
75 #include "core/layout/api/LayoutViewItem.h" | 75 #include "core/layout/api/LayoutViewItem.h" |
76 #include "core/layout/compositing/PaintLayerCompositor.h" | 76 #include "core/layout/compositing/PaintLayerCompositor.h" |
77 #include "core/loader/DocumentLoader.h" | 77 #include "core/loader/DocumentLoader.h" |
78 #include "core/loader/DocumentThreadableLoader.h" | 78 #include "core/loader/DocumentThreadableLoader.h" |
79 #include "core/loader/DocumentThreadableLoaderClient.h" | 79 #include "core/loader/DocumentThreadableLoaderClient.h" |
80 #include "core/loader/FrameLoadRequest.h" | 80 #include "core/loader/FrameLoadRequest.h" |
81 #include "core/loader/ThreadableLoader.h" | 81 #include "core/loader/ThreadableLoader.h" |
| 82 #include "core/page/ChromeClient.h" |
82 #include "core/page/Page.h" | 83 #include "core/page/Page.h" |
83 #include "core/page/ScopedPageSuspender.h" | 84 #include "core/page/ScopedPageSuspender.h" |
84 #include "core/paint/PaintLayer.h" | 85 #include "core/paint/PaintLayer.h" |
85 #include "core/testing/NullExecutionContext.h" | 86 #include "core/testing/NullExecutionContext.h" |
86 #include "modules/mediastream/MediaStream.h" | 87 #include "modules/mediastream/MediaStream.h" |
87 #include "modules/mediastream/MediaStreamRegistry.h" | 88 #include "modules/mediastream/MediaStreamRegistry.h" |
88 #include "platform/Cursor.h" | 89 #include "platform/Cursor.h" |
89 #include "platform/DragImage.h" | 90 #include "platform/DragImage.h" |
90 #include "platform/KeyboardCodes.h" | 91 #include "platform/KeyboardCodes.h" |
91 #include "platform/PlatformResourceLoader.h" | 92 #include "platform/PlatformResourceLoader.h" |
92 #include "platform/RuntimeEnabledFeatures.h" | 93 #include "platform/RuntimeEnabledFeatures.h" |
93 #include "platform/UserGestureIndicator.h" | 94 #include "platform/UserGestureIndicator.h" |
94 #include "platform/geometry/FloatRect.h" | 95 #include "platform/geometry/FloatRect.h" |
| 96 #include "platform/graphics/GraphicsLayer.h" |
95 #include "platform/loader/fetch/FetchParameters.h" | 97 #include "platform/loader/fetch/FetchParameters.h" |
96 #include "platform/loader/fetch/MemoryCache.h" | 98 #include "platform/loader/fetch/MemoryCache.h" |
97 #include "platform/loader/fetch/ResourceError.h" | 99 #include "platform/loader/fetch/ResourceError.h" |
98 #include "platform/loader/fetch/ResourceFetcher.h" | 100 #include "platform/loader/fetch/ResourceFetcher.h" |
99 #include "platform/scroll/Scrollbar.h" | 101 #include "platform/scroll/Scrollbar.h" |
100 #include "platform/scroll/ScrollbarTestSuite.h" | 102 #include "platform/scroll/ScrollbarTestSuite.h" |
101 #include "platform/scroll/ScrollbarTheme.h" | 103 #include "platform/scroll/ScrollbarTheme.h" |
102 #include "platform/scroll/ScrollbarThemeMock.h" | 104 #include "platform/scroll/ScrollbarThemeMock.h" |
103 #include "platform/scroll/ScrollbarThemeOverlayMock.h" | 105 #include "platform/scroll/ScrollbarThemeOverlayMock.h" |
104 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" | 106 #include "platform/testing/RuntimeEnabledFeaturesTestHelpers.h" |
105 #include "platform/testing/URLTestHelpers.h" | 107 #include "platform/testing/URLTestHelpers.h" |
106 #include "platform/testing/UnitTestHelpers.h" | 108 #include "platform/testing/UnitTestHelpers.h" |
107 #include "platform/weborigin/KURLHash.h" | 109 #include "platform/weborigin/KURLHash.h" |
108 #include "platform/weborigin/SchemeRegistry.h" | 110 #include "platform/weborigin/SchemeRegistry.h" |
109 #include "platform/weborigin/SecurityOrigin.h" | 111 #include "platform/weborigin/SecurityOrigin.h" |
110 #include "platform/wtf/Forward.h" | 112 #include "platform/wtf/Forward.h" |
111 #include "platform/wtf/PtrUtil.h" | 113 #include "platform/wtf/PtrUtil.h" |
112 #include "platform/wtf/dtoa/utils.h" | 114 #include "platform/wtf/dtoa/utils.h" |
113 #include "public/platform/Platform.h" | 115 #include "public/platform/Platform.h" |
114 #include "public/platform/WebCache.h" | 116 #include "public/platform/WebCache.h" |
115 #include "public/platform/WebCachePolicy.h" | 117 #include "public/platform/WebCachePolicy.h" |
116 #include "public/platform/WebClipboard.h" | 118 #include "public/platform/WebClipboard.h" |
| 119 #include "public/platform/WebCoalescedInputEvent.h" |
117 #include "public/platform/WebFloatRect.h" | 120 #include "public/platform/WebFloatRect.h" |
118 #include "public/platform/WebKeyboardEvent.h" | 121 #include "public/platform/WebKeyboardEvent.h" |
119 #include "public/platform/WebMockClipboard.h" | 122 #include "public/platform/WebMockClipboard.h" |
120 #include "public/platform/WebSecurityOrigin.h" | 123 #include "public/platform/WebSecurityOrigin.h" |
121 #include "public/platform/WebThread.h" | 124 #include "public/platform/WebThread.h" |
122 #include "public/platform/WebURL.h" | 125 #include "public/platform/WebURL.h" |
123 #include "public/platform/WebURLLoaderClient.h" | 126 #include "public/platform/WebURLLoaderClient.h" |
124 #include "public/platform/WebURLLoaderMockFactory.h" | 127 #include "public/platform/WebURLLoaderMockFactory.h" |
125 #include "public/platform/WebURLResponse.h" | 128 #include "public/platform/WebURLResponse.h" |
126 #include "public/web/WebConsoleMessage.h" | 129 #include "public/web/WebConsoleMessage.h" |
(...skipping 3107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3234 EXPECT_TRUE( | 3237 EXPECT_TRUE( |
3235 view->GetLayoutViewItem().Compositor()->LayerForVerticalScrollbar()); | 3238 view->GetLayoutViewItem().Compositor()->LayerForVerticalScrollbar()); |
3236 | 3239 |
3237 web_view_helper.Resize(WebSize(view_width * 10, view_height * 10)); | 3240 web_view_helper.Resize(WebSize(view_width * 10, view_height * 10)); |
3238 EXPECT_FALSE( | 3241 EXPECT_FALSE( |
3239 view->GetLayoutViewItem().Compositor()->LayerForHorizontalScrollbar()); | 3242 view->GetLayoutViewItem().Compositor()->LayerForHorizontalScrollbar()); |
3240 EXPECT_FALSE( | 3243 EXPECT_FALSE( |
3241 view->GetLayoutViewItem().Compositor()->LayerForVerticalScrollbar()); | 3244 view->GetLayoutViewItem().Compositor()->LayerForVerticalScrollbar()); |
3242 } | 3245 } |
3243 | 3246 |
3244 void SetScaleAndScrollAndLayout(WebViewImpl* web_view, | 3247 void SetScaleAndScrollAndLayout(WebViewBase* web_view, |
3245 WebPoint scroll, | 3248 WebPoint scroll, |
3246 float scale) { | 3249 float scale) { |
3247 web_view->SetPageScaleFactor(scale); | 3250 web_view->SetPageScaleFactor(scale); |
3248 web_view->MainFrame()->SetScrollOffset(WebSize(scroll.x, scroll.y)); | 3251 web_view->MainFrame()->SetScrollOffset(WebSize(scroll.x, scroll.y)); |
3249 web_view->UpdateAllLifecyclePhases(); | 3252 web_view->UpdateAllLifecyclePhases(); |
3250 } | 3253 } |
3251 | 3254 |
3252 void SimulatePageScale(WebViewImpl* web_view_impl, float& scale) { | 3255 void SimulatePageScale(WebViewBase* web_view_impl, float& scale) { |
3253 ScrollOffset scroll_delta = | 3256 ScrollOffset scroll_delta = |
3254 ToScrollOffset( | 3257 ToScrollOffset( |
3255 web_view_impl->FakePageScaleAnimationTargetPositionForTesting()) - | 3258 web_view_impl->FakePageScaleAnimationTargetPositionForTesting()) - |
3256 web_view_impl->MainFrameImpl()->GetFrameView()->GetScrollOffset(); | 3259 web_view_impl->MainFrameImpl()->GetFrameView()->GetScrollOffset(); |
3257 float scale_delta = | 3260 float scale_delta = |
3258 web_view_impl->FakePageScaleAnimationPageScaleForTesting() / | 3261 web_view_impl->FakePageScaleAnimationPageScaleForTesting() / |
3259 web_view_impl->PageScaleFactor(); | 3262 web_view_impl->PageScaleFactor(); |
3260 web_view_impl->ApplyViewportDeltas(WebFloatSize(), FloatSize(scroll_delta), | 3263 web_view_impl->ApplyViewportDeltas(WebFloatSize(), FloatSize(scroll_delta), |
3261 WebFloatSize(), scale_delta, 0); | 3264 WebFloatSize(), scale_delta, 0); |
3262 scale = web_view_impl->PageScaleFactor(); | 3265 scale = web_view_impl->PageScaleFactor(); |
3263 } | 3266 } |
3264 | 3267 |
3265 void SimulateMultiTargetZoom(WebViewImpl* web_view_impl, | 3268 void SimulateMultiTargetZoom(WebViewBase* web_view_impl, |
3266 const WebRect& rect, | 3269 const WebRect& rect, |
3267 float& scale) { | 3270 float& scale) { |
3268 if (web_view_impl->ZoomToMultipleTargetsRect(rect)) | 3271 if (web_view_impl->ZoomToMultipleTargetsRect(rect)) |
3269 SimulatePageScale(web_view_impl, scale); | 3272 SimulatePageScale(web_view_impl, scale); |
3270 } | 3273 } |
3271 | 3274 |
3272 void SimulateDoubleTap(WebViewImpl* web_view_impl, | 3275 void SimulateDoubleTap(WebViewBase* web_view_impl, |
3273 WebPoint& point, | 3276 WebPoint& point, |
3274 float& scale) { | 3277 float& scale) { |
3275 web_view_impl->AnimateDoubleTapZoom(point); | 3278 web_view_impl->AnimateDoubleTapZoom(point); |
3276 EXPECT_TRUE(web_view_impl->FakeDoubleTapAnimationPendingForTesting()); | 3279 EXPECT_TRUE(web_view_impl->FakeDoubleTapAnimationPendingForTesting()); |
3277 SimulatePageScale(web_view_impl, scale); | 3280 SimulatePageScale(web_view_impl, scale); |
3278 } | 3281 } |
3279 | 3282 |
3280 TEST_P(ParameterizedWebFrameTest, DivAutoZoomParamsTest) { | 3283 TEST_P(ParameterizedWebFrameTest, DivAutoZoomParamsTest) { |
3281 RegisterMockedHttpURLLoad("get_scale_for_auto_zoom_into_div_test.html"); | 3284 RegisterMockedHttpURLLoad("get_scale_for_auto_zoom_into_div_test.html"); |
3282 | 3285 |
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4376 void Reset() { call_count_ = 0; } | 4379 void Reset() { call_count_ = 0; } |
4377 | 4380 |
4378 private: | 4381 private: |
4379 int call_count_; | 4382 int call_count_; |
4380 }; | 4383 }; |
4381 | 4384 |
4382 TEST_P(ParameterizedWebFrameTest, TabKeyCursorMoveTriggersOneSelectionChange) { | 4385 TEST_P(ParameterizedWebFrameTest, TabKeyCursorMoveTriggersOneSelectionChange) { |
4383 ChangedSelectionCounter counter; | 4386 ChangedSelectionCounter counter; |
4384 FrameTestHelpers::WebViewHelper web_view_helper; | 4387 FrameTestHelpers::WebViewHelper web_view_helper; |
4385 RegisterMockedHttpURLLoad("editable_elements.html"); | 4388 RegisterMockedHttpURLLoad("editable_elements.html"); |
4386 WebViewImpl* web_view = web_view_helper.InitializeAndLoad( | 4389 WebViewBase* web_view = web_view_helper.InitializeAndLoad( |
4387 base_url_ + "editable_elements.html", true, &counter); | 4390 base_url_ + "editable_elements.html", true, &counter); |
4388 | 4391 |
4389 WebKeyboardEvent tab_down(WebInputEvent::kKeyDown, | 4392 WebKeyboardEvent tab_down(WebInputEvent::kKeyDown, |
4390 WebInputEvent::kNoModifiers, | 4393 WebInputEvent::kNoModifiers, |
4391 WebInputEvent::kTimeStampForTesting); | 4394 WebInputEvent::kTimeStampForTesting); |
4392 WebKeyboardEvent tab_up(WebInputEvent::kKeyUp, WebInputEvent::kNoModifiers, | 4395 WebKeyboardEvent tab_up(WebInputEvent::kKeyUp, WebInputEvent::kNoModifiers, |
4393 WebInputEvent::kTimeStampForTesting); | 4396 WebInputEvent::kTimeStampForTesting); |
4394 tab_down.dom_key = Platform::Current()->DomKeyEnumFromString("\t"); | 4397 tab_down.dom_key = Platform::Current()->DomKeyEnumFromString("\t"); |
4395 tab_up.dom_key = Platform::Current()->DomKeyEnumFromString("\t"); | 4398 tab_up.dom_key = Platform::Current()->DomKeyEnumFromString("\t"); |
4396 tab_down.windows_key_code = VKEY_TAB; | 4399 tab_down.windows_key_code = VKEY_TAB; |
(...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6254 TEST_F(WebFrameTest, DisambiguationPopupVisualViewport) { | 6257 TEST_F(WebFrameTest, DisambiguationPopupVisualViewport) { |
6255 const std::string html_file = "disambiguation_popup_200_by_800.html"; | 6258 const std::string html_file = "disambiguation_popup_200_by_800.html"; |
6256 RegisterMockedHttpURLLoad(html_file); | 6259 RegisterMockedHttpURLLoad(html_file); |
6257 | 6260 |
6258 DisambiguationPopupTestWebViewClient client; | 6261 DisambiguationPopupTestWebViewClient client; |
6259 | 6262 |
6260 FrameTestHelpers::WebViewHelper web_view_helper; | 6263 FrameTestHelpers::WebViewHelper web_view_helper; |
6261 web_view_helper.InitializeAndLoad(base_url_ + html_file, true, nullptr, | 6264 web_view_helper.InitializeAndLoad(base_url_ + html_file, true, nullptr, |
6262 &client, nullptr, ConfigureAndroid); | 6265 &client, nullptr, ConfigureAndroid); |
6263 | 6266 |
6264 WebViewImpl* web_view_impl = web_view_helper.WebView(); | 6267 WebViewBase* web_view_impl = web_view_helper.WebView(); |
6265 ASSERT_TRUE(web_view_impl); | 6268 ASSERT_TRUE(web_view_impl); |
6266 LocalFrame* frame = web_view_impl->MainFrameImpl()->GetFrame(); | 6269 LocalFrame* frame = web_view_impl->MainFrameImpl()->GetFrame(); |
6267 ASSERT_TRUE(frame); | 6270 ASSERT_TRUE(frame); |
6268 | 6271 |
6269 web_view_helper.Resize(WebSize(100, 200)); | 6272 web_view_helper.Resize(WebSize(100, 200)); |
6270 | 6273 |
6271 // Scroll main frame to the bottom of the document | 6274 // Scroll main frame to the bottom of the document |
6272 web_view_impl->MainFrame()->SetScrollOffset(WebSize(0, 400)); | 6275 web_view_impl->MainFrame()->SetScrollOffset(WebSize(0, 400)); |
6273 EXPECT_SIZE_EQ(ScrollOffset(0, 400), frame->View()->GetScrollOffset()); | 6276 EXPECT_SIZE_EQ(ScrollOffset(0, 400), frame->View()->GetScrollOffset()); |
6274 | 6277 |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7594 WebHistoryCommitType LastCommitType() const { return last_commit_type_; } | 7597 WebHistoryCommitType LastCommitType() const { return last_commit_type_; } |
7595 | 7598 |
7596 private: | 7599 private: |
7597 WebHistoryCommitType last_commit_type_; | 7600 WebHistoryCommitType last_commit_type_; |
7598 }; | 7601 }; |
7599 | 7602 |
7600 TEST_P(ParameterizedWebFrameTest, SameDocumentHistoryNavigationCommitType) { | 7603 TEST_P(ParameterizedWebFrameTest, SameDocumentHistoryNavigationCommitType) { |
7601 RegisterMockedHttpURLLoad("push_state.html"); | 7604 RegisterMockedHttpURLLoad("push_state.html"); |
7602 TestDidNavigateCommitTypeWebFrameClient client; | 7605 TestDidNavigateCommitTypeWebFrameClient client; |
7603 FrameTestHelpers::WebViewHelper web_view_helper; | 7606 FrameTestHelpers::WebViewHelper web_view_helper; |
7604 WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( | 7607 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( |
7605 base_url_ + "push_state.html", true, &client); | 7608 base_url_ + "push_state.html", true, &client); |
7606 Persistent<HistoryItem> item = | 7609 Persistent<HistoryItem> item = |
7607 ToLocalFrame(web_view_impl->GetPage()->MainFrame()) | 7610 ToLocalFrame(web_view_impl->GetPage()->MainFrame()) |
7608 ->Loader() | 7611 ->Loader() |
7609 .GetDocumentLoader() | 7612 .GetDocumentLoader() |
7610 ->GetHistoryItem(); | 7613 ->GetHistoryItem(); |
7611 RunPendingTasks(); | 7614 RunPendingTasks(); |
7612 | 7615 |
7613 ToLocalFrame(web_view_impl->GetPage()->MainFrame()) | 7616 ToLocalFrame(web_view_impl->GetPage()->MainFrame()) |
7614 ->Loader() | 7617 ->Loader() |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7784 EXPECT_EQ(1, client.CallCount()); | 7787 EXPECT_EQ(1, client.CallCount()); |
7785 } | 7788 } |
7786 | 7789 |
7787 TEST_P(ParameterizedWebFrameTest, fixedPositionInFixedViewport) { | 7790 TEST_P(ParameterizedWebFrameTest, fixedPositionInFixedViewport) { |
7788 RegisterMockedHttpURLLoad("fixed-position-in-fixed-viewport.html"); | 7791 RegisterMockedHttpURLLoad("fixed-position-in-fixed-viewport.html"); |
7789 FrameTestHelpers::WebViewHelper web_view_helper; | 7792 FrameTestHelpers::WebViewHelper web_view_helper; |
7790 web_view_helper.InitializeAndLoad( | 7793 web_view_helper.InitializeAndLoad( |
7791 base_url_ + "fixed-position-in-fixed-viewport.html", true, nullptr, | 7794 base_url_ + "fixed-position-in-fixed-viewport.html", true, nullptr, |
7792 nullptr, nullptr, EnableViewportSettings); | 7795 nullptr, nullptr, EnableViewportSettings); |
7793 | 7796 |
7794 WebViewImpl* web_view = web_view_helper.WebView(); | 7797 WebViewBase* web_view = web_view_helper.WebView(); |
7795 web_view_helper.Resize(WebSize(100, 100)); | 7798 web_view_helper.Resize(WebSize(100, 100)); |
7796 | 7799 |
7797 Document* document = web_view->MainFrameImpl()->GetFrame()->GetDocument(); | 7800 Document* document = web_view->MainFrameImpl()->GetFrame()->GetDocument(); |
7798 Element* bottom_fixed = document->getElementById("bottom-fixed"); | 7801 Element* bottom_fixed = document->getElementById("bottom-fixed"); |
7799 Element* top_bottom_fixed = document->getElementById("top-bottom-fixed"); | 7802 Element* top_bottom_fixed = document->getElementById("top-bottom-fixed"); |
7800 Element* right_fixed = document->getElementById("right-fixed"); | 7803 Element* right_fixed = document->getElementById("right-fixed"); |
7801 Element* left_right_fixed = document->getElementById("left-right-fixed"); | 7804 Element* left_right_fixed = document->getElementById("left-right-fixed"); |
7802 | 7805 |
7803 // The layout viewport will hit the min-scale limit of 0.25, so it'll be | 7806 // The layout viewport will hit the min-scale limit of 0.25, so it'll be |
7804 // 400x800. | 7807 // 400x800. |
(...skipping 22 matching lines...) Expand all Loading... |
7827 } | 7830 } |
7828 | 7831 |
7829 TEST_F(WebFrameTest, FrameViewScrollAccountsForBrowserControls) { | 7832 TEST_F(WebFrameTest, FrameViewScrollAccountsForBrowserControls) { |
7830 FakeCompositingWebViewClient client; | 7833 FakeCompositingWebViewClient client; |
7831 RegisterMockedHttpURLLoad("long_scroll.html"); | 7834 RegisterMockedHttpURLLoad("long_scroll.html"); |
7832 FrameTestHelpers::WebViewHelper web_view_helper; | 7835 FrameTestHelpers::WebViewHelper web_view_helper; |
7833 web_view_helper.InitializeAndLoad(base_url_ + "long_scroll.html", true, | 7836 web_view_helper.InitializeAndLoad(base_url_ + "long_scroll.html", true, |
7834 nullptr, &client, nullptr, | 7837 nullptr, &client, nullptr, |
7835 ConfigureAndroid); | 7838 ConfigureAndroid); |
7836 | 7839 |
7837 WebViewImpl* web_view = web_view_helper.WebView(); | 7840 WebViewBase* web_view = web_view_helper.WebView(); |
7838 FrameView* frame_view = | 7841 FrameView* frame_view = |
7839 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); | 7842 web_view_helper.WebView()->MainFrameImpl()->GetFrameView(); |
7840 | 7843 |
7841 float browser_controls_height = 40; | 7844 float browser_controls_height = 40; |
7842 web_view->ResizeWithBrowserControls(WebSize(100, 100), | 7845 web_view->ResizeWithBrowserControls(WebSize(100, 100), |
7843 browser_controls_height, false); | 7846 browser_controls_height, false); |
7844 web_view->SetPageScaleFactor(2.0f); | 7847 web_view->SetPageScaleFactor(2.0f); |
7845 web_view->UpdateAllLifecyclePhases(); | 7848 web_view->UpdateAllLifecyclePhases(); |
7846 | 7849 |
7847 web_view->MainFrame()->SetScrollOffset(WebSize(0, 2000)); | 7850 web_view->MainFrame()->SetScrollOffset(WebSize(0, 2000)); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7925 } | 7928 } |
7926 | 7929 |
7927 TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize) { | 7930 TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize) { |
7928 FakeCompositingWebViewClient client; | 7931 FakeCompositingWebViewClient client; |
7929 RegisterMockedHttpURLLoad("fullscreen_div.html"); | 7932 RegisterMockedHttpURLLoad("fullscreen_div.html"); |
7930 FrameTestHelpers::WebViewHelper web_view_helper; | 7933 FrameTestHelpers::WebViewHelper web_view_helper; |
7931 int viewport_width = 640; | 7934 int viewport_width = 640; |
7932 int viewport_height = 480; | 7935 int viewport_height = 480; |
7933 client.screen_info_.rect.width = viewport_width; | 7936 client.screen_info_.rect.width = viewport_width; |
7934 client.screen_info_.rect.height = viewport_height; | 7937 client.screen_info_.rect.height = viewport_height; |
7935 WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( | 7938 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( |
7936 base_url_ + "fullscreen_div.html", true, nullptr, &client, nullptr, | 7939 base_url_ + "fullscreen_div.html", true, nullptr, &client, nullptr, |
7937 ConfigureAndroid); | 7940 ConfigureAndroid); |
7938 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 7941 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
7939 web_view_impl->UpdateAllLifecyclePhases(); | 7942 web_view_impl->UpdateAllLifecyclePhases(); |
7940 | 7943 |
7941 Document* document = | 7944 Document* document = |
7942 web_view_impl->MainFrameImpl()->GetFrame()->GetDocument(); | 7945 web_view_impl->MainFrameImpl()->GetFrame()->GetDocument(); |
7943 UserGestureIndicator gesture(DocumentUserGestureToken::Create(document)); | 7946 UserGestureIndicator gesture(DocumentUserGestureToken::Create(document)); |
7944 Element* div_fullscreen = document->getElementById("div1"); | 7947 Element* div_fullscreen = document->getElementById("div1"); |
7945 Fullscreen::RequestFullscreen(*div_fullscreen); | 7948 Fullscreen::RequestFullscreen(*div_fullscreen); |
(...skipping 22 matching lines...) Expand all Loading... |
7968 EXPECT_EQ(viewport_height, fullscreen_layout_object->LogicalWidth().ToInt()); | 7971 EXPECT_EQ(viewport_height, fullscreen_layout_object->LogicalWidth().ToInt()); |
7969 EXPECT_EQ(viewport_width, fullscreen_layout_object->LogicalHeight().ToInt()); | 7972 EXPECT_EQ(viewport_width, fullscreen_layout_object->LogicalHeight().ToInt()); |
7970 } | 7973 } |
7971 | 7974 |
7972 TEST_F(WebFrameTest, FullscreenLayerNonScrollable) { | 7975 TEST_F(WebFrameTest, FullscreenLayerNonScrollable) { |
7973 FakeCompositingWebViewClient client; | 7976 FakeCompositingWebViewClient client; |
7974 RegisterMockedHttpURLLoad("fullscreen_div.html"); | 7977 RegisterMockedHttpURLLoad("fullscreen_div.html"); |
7975 FrameTestHelpers::WebViewHelper web_view_helper; | 7978 FrameTestHelpers::WebViewHelper web_view_helper; |
7976 int viewport_width = 640; | 7979 int viewport_width = 640; |
7977 int viewport_height = 480; | 7980 int viewport_height = 480; |
7978 WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( | 7981 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( |
7979 base_url_ + "fullscreen_div.html", true, nullptr, &client, nullptr, | 7982 base_url_ + "fullscreen_div.html", true, nullptr, &client, nullptr, |
7980 ConfigureAndroid); | 7983 ConfigureAndroid); |
7981 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 7984 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
7982 web_view_impl->UpdateAllLifecyclePhases(); | 7985 web_view_impl->UpdateAllLifecyclePhases(); |
7983 | 7986 |
7984 Document* document = | 7987 Document* document = |
7985 web_view_impl->MainFrameImpl()->GetFrame()->GetDocument(); | 7988 web_view_impl->MainFrameImpl()->GetFrame()->GetDocument(); |
7986 UserGestureIndicator gesture(DocumentUserGestureToken::Create(document)); | 7989 UserGestureIndicator gesture(DocumentUserGestureToken::Create(document)); |
7987 Element* div_fullscreen = document->getElementById("div1"); | 7990 Element* div_fullscreen = document->getElementById("div1"); |
7988 Fullscreen::RequestFullscreen(*div_fullscreen); | 7991 Fullscreen::RequestFullscreen(*div_fullscreen); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8024 ASSERT_TRUE(visual_viewport_scroll_layer->UserScrollableHorizontal()); | 8027 ASSERT_TRUE(visual_viewport_scroll_layer->UserScrollableHorizontal()); |
8025 ASSERT_TRUE(visual_viewport_scroll_layer->UserScrollableVertical()); | 8028 ASSERT_TRUE(visual_viewport_scroll_layer->UserScrollableVertical()); |
8026 } | 8029 } |
8027 | 8030 |
8028 TEST_P(ParameterizedWebFrameTest, FullscreenMainFrame) { | 8031 TEST_P(ParameterizedWebFrameTest, FullscreenMainFrame) { |
8029 FakeCompositingWebViewClient client; | 8032 FakeCompositingWebViewClient client; |
8030 RegisterMockedHttpURLLoad("fullscreen_div.html"); | 8033 RegisterMockedHttpURLLoad("fullscreen_div.html"); |
8031 FrameTestHelpers::WebViewHelper web_view_helper; | 8034 FrameTestHelpers::WebViewHelper web_view_helper; |
8032 int viewport_width = 640; | 8035 int viewport_width = 640; |
8033 int viewport_height = 480; | 8036 int viewport_height = 480; |
8034 WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( | 8037 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( |
8035 base_url_ + "fullscreen_div.html", true, nullptr, &client, nullptr, | 8038 base_url_ + "fullscreen_div.html", true, nullptr, &client, nullptr, |
8036 ConfigureAndroid); | 8039 ConfigureAndroid); |
8037 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 8040 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
8038 web_view_impl->UpdateAllLifecyclePhases(); | 8041 web_view_impl->UpdateAllLifecyclePhases(); |
8039 | 8042 |
8040 WebLayer* web_scroll_layer = web_view_impl->MainFrameImpl() | 8043 WebLayer* web_scroll_layer = web_view_impl->MainFrameImpl() |
8041 ->GetFrame() | 8044 ->GetFrame() |
8042 ->View() | 8045 ->View() |
8043 ->LayoutViewportScrollableArea() | 8046 ->LayoutViewportScrollableArea() |
8044 ->LayerForScrolling() | 8047 ->LayerForScrolling() |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8082 ASSERT_TRUE(web_scroll_layer->Scrollable()); | 8085 ASSERT_TRUE(web_scroll_layer->Scrollable()); |
8083 ASSERT_TRUE(web_scroll_layer->UserScrollableHorizontal()); | 8086 ASSERT_TRUE(web_scroll_layer->UserScrollableHorizontal()); |
8084 ASSERT_TRUE(web_scroll_layer->UserScrollableVertical()); | 8087 ASSERT_TRUE(web_scroll_layer->UserScrollableVertical()); |
8085 } | 8088 } |
8086 | 8089 |
8087 TEST_P(ParameterizedWebFrameTest, FullscreenSubframe) { | 8090 TEST_P(ParameterizedWebFrameTest, FullscreenSubframe) { |
8088 FakeCompositingWebViewClient client; | 8091 FakeCompositingWebViewClient client; |
8089 RegisterMockedHttpURLLoad("fullscreen_iframe.html"); | 8092 RegisterMockedHttpURLLoad("fullscreen_iframe.html"); |
8090 RegisterMockedHttpURLLoad("fullscreen_div.html"); | 8093 RegisterMockedHttpURLLoad("fullscreen_div.html"); |
8091 FrameTestHelpers::WebViewHelper web_view_helper; | 8094 FrameTestHelpers::WebViewHelper web_view_helper; |
8092 WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( | 8095 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( |
8093 base_url_ + "fullscreen_iframe.html", true, nullptr, &client, nullptr, | 8096 base_url_ + "fullscreen_iframe.html", true, nullptr, &client, nullptr, |
8094 ConfigureAndroid); | 8097 ConfigureAndroid); |
8095 int viewport_width = 640; | 8098 int viewport_width = 640; |
8096 int viewport_height = 480; | 8099 int viewport_height = 480; |
8097 client.screen_info_.rect.width = viewport_width; | 8100 client.screen_info_.rect.width = viewport_width; |
8098 client.screen_info_.rect.height = viewport_height; | 8101 client.screen_info_.rect.height = viewport_height; |
8099 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 8102 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
8100 web_view_impl->UpdateAllLifecyclePhases(); | 8103 web_view_impl->UpdateAllLifecyclePhases(); |
8101 | 8104 |
8102 Document* document = | 8105 Document* document = |
(...skipping 20 matching lines...) Expand all Loading... |
8123 EXPECT_EQ(viewport_height, fullscreen_layout_object->LogicalWidth().ToInt()); | 8126 EXPECT_EQ(viewport_height, fullscreen_layout_object->LogicalWidth().ToInt()); |
8124 EXPECT_EQ(viewport_width, fullscreen_layout_object->LogicalHeight().ToInt()); | 8127 EXPECT_EQ(viewport_width, fullscreen_layout_object->LogicalHeight().ToInt()); |
8125 } | 8128 } |
8126 | 8129 |
8127 // Tests entering nested fullscreen and then exiting via the same code path | 8130 // Tests entering nested fullscreen and then exiting via the same code path |
8128 // that's used when the browser process exits fullscreen. | 8131 // that's used when the browser process exits fullscreen. |
8129 TEST_P(ParameterizedWebFrameTest, FullscreenNestedExit) { | 8132 TEST_P(ParameterizedWebFrameTest, FullscreenNestedExit) { |
8130 RegisterMockedHttpURLLoad("fullscreen_iframe.html"); | 8133 RegisterMockedHttpURLLoad("fullscreen_iframe.html"); |
8131 RegisterMockedHttpURLLoad("fullscreen_div.html"); | 8134 RegisterMockedHttpURLLoad("fullscreen_div.html"); |
8132 FrameTestHelpers::WebViewHelper web_view_helper; | 8135 FrameTestHelpers::WebViewHelper web_view_helper; |
8133 WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( | 8136 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( |
8134 base_url_ + "fullscreen_iframe.html", true); | 8137 base_url_ + "fullscreen_iframe.html", true); |
8135 | 8138 |
8136 web_view_impl->UpdateAllLifecyclePhases(); | 8139 web_view_impl->UpdateAllLifecyclePhases(); |
8137 | 8140 |
8138 Document* top_doc = web_view_impl->MainFrameImpl()->GetFrame()->GetDocument(); | 8141 Document* top_doc = web_view_impl->MainFrameImpl()->GetFrame()->GetDocument(); |
8139 Element* top_body = top_doc->body(); | 8142 Element* top_body = top_doc->body(); |
8140 | 8143 |
8141 HTMLIFrameElement* iframe = | 8144 HTMLIFrameElement* iframe = |
8142 toHTMLIFrameElement(top_doc->QuerySelector("iframe")); | 8145 toHTMLIFrameElement(top_doc->QuerySelector("iframe")); |
8143 Document* iframe_doc = iframe->contentDocument(); | 8146 Document* iframe_doc = iframe->contentDocument(); |
(...skipping 27 matching lines...) Expand all Loading... |
8171 EXPECT_EQ(nullptr, Fullscreen::CurrentFullScreenElementFrom(*top_doc)); | 8174 EXPECT_EQ(nullptr, Fullscreen::CurrentFullScreenElementFrom(*top_doc)); |
8172 EXPECT_EQ(nullptr, Fullscreen::FullscreenElementFrom(*top_doc)); | 8175 EXPECT_EQ(nullptr, Fullscreen::FullscreenElementFrom(*top_doc)); |
8173 EXPECT_EQ(nullptr, Fullscreen::CurrentFullScreenElementFrom(*iframe_doc)); | 8176 EXPECT_EQ(nullptr, Fullscreen::CurrentFullScreenElementFrom(*iframe_doc)); |
8174 EXPECT_EQ(nullptr, Fullscreen::FullscreenElementFrom(*iframe_doc)); | 8177 EXPECT_EQ(nullptr, Fullscreen::FullscreenElementFrom(*iframe_doc)); |
8175 } | 8178 } |
8176 | 8179 |
8177 TEST_P(ParameterizedWebFrameTest, FullscreenWithTinyViewport) { | 8180 TEST_P(ParameterizedWebFrameTest, FullscreenWithTinyViewport) { |
8178 FakeCompositingWebViewClient client; | 8181 FakeCompositingWebViewClient client; |
8179 RegisterMockedHttpURLLoad("viewport-tiny.html"); | 8182 RegisterMockedHttpURLLoad("viewport-tiny.html"); |
8180 FrameTestHelpers::WebViewHelper web_view_helper; | 8183 FrameTestHelpers::WebViewHelper web_view_helper; |
8181 WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( | 8184 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( |
8182 base_url_ + "viewport-tiny.html", true, nullptr, &client, nullptr, | 8185 base_url_ + "viewport-tiny.html", true, nullptr, &client, nullptr, |
8183 ConfigureAndroid); | 8186 ConfigureAndroid); |
8184 int viewport_width = 384; | 8187 int viewport_width = 384; |
8185 int viewport_height = 640; | 8188 int viewport_height = 640; |
8186 client.screen_info_.rect.width = viewport_width; | 8189 client.screen_info_.rect.width = viewport_width; |
8187 client.screen_info_.rect.height = viewport_height; | 8190 client.screen_info_.rect.height = viewport_height; |
8188 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 8191 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
8189 web_view_impl->UpdateAllLifecyclePhases(); | 8192 web_view_impl->UpdateAllLifecyclePhases(); |
8190 | 8193 |
8191 LayoutViewItem layout_view_item = web_view_helper.WebView() | 8194 LayoutViewItem layout_view_item = web_view_helper.WebView() |
(...skipping 24 matching lines...) Expand all Loading... |
8216 EXPECT_EQ(533, layout_view_item.LogicalHeight().Floor()); | 8219 EXPECT_EQ(533, layout_view_item.LogicalHeight().Floor()); |
8217 EXPECT_FLOAT_EQ(1.2, web_view_impl->PageScaleFactor()); | 8220 EXPECT_FLOAT_EQ(1.2, web_view_impl->PageScaleFactor()); |
8218 EXPECT_FLOAT_EQ(1.2, web_view_impl->MinimumPageScaleFactor()); | 8221 EXPECT_FLOAT_EQ(1.2, web_view_impl->MinimumPageScaleFactor()); |
8219 EXPECT_FLOAT_EQ(5.0, web_view_impl->MaximumPageScaleFactor()); | 8222 EXPECT_FLOAT_EQ(5.0, web_view_impl->MaximumPageScaleFactor()); |
8220 } | 8223 } |
8221 | 8224 |
8222 TEST_P(ParameterizedWebFrameTest, FullscreenResizeWithTinyViewport) { | 8225 TEST_P(ParameterizedWebFrameTest, FullscreenResizeWithTinyViewport) { |
8223 FakeCompositingWebViewClient client; | 8226 FakeCompositingWebViewClient client; |
8224 RegisterMockedHttpURLLoad("viewport-tiny.html"); | 8227 RegisterMockedHttpURLLoad("viewport-tiny.html"); |
8225 FrameTestHelpers::WebViewHelper web_view_helper; | 8228 FrameTestHelpers::WebViewHelper web_view_helper; |
8226 WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( | 8229 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( |
8227 base_url_ + "viewport-tiny.html", true, nullptr, &client, nullptr, | 8230 base_url_ + "viewport-tiny.html", true, nullptr, &client, nullptr, |
8228 ConfigureAndroid); | 8231 ConfigureAndroid); |
8229 int viewport_width = 384; | 8232 int viewport_width = 384; |
8230 int viewport_height = 640; | 8233 int viewport_height = 640; |
8231 client.screen_info_.rect.width = viewport_width; | 8234 client.screen_info_.rect.width = viewport_width; |
8232 client.screen_info_.rect.height = viewport_height; | 8235 client.screen_info_.rect.height = viewport_height; |
8233 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 8236 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
8234 web_view_impl->UpdateAllLifecyclePhases(); | 8237 web_view_impl->UpdateAllLifecyclePhases(); |
8235 | 8238 |
8236 LayoutViewItem layout_view_item = web_view_helper.WebView() | 8239 LayoutViewItem layout_view_item = web_view_helper.WebView() |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8275 // resize and switching fullscreen state operations on WebView, with the | 8278 // resize and switching fullscreen state operations on WebView, with the |
8276 // interference from Android status bars like a real device does. | 8279 // interference from Android status bars like a real device does. |
8277 // This verifies we handle the transition and restore states correctly. | 8280 // This verifies we handle the transition and restore states correctly. |
8278 WebSize screen_size_minus_status_bars_minus_url_bar(598, 303); | 8281 WebSize screen_size_minus_status_bars_minus_url_bar(598, 303); |
8279 WebSize screen_size_minus_status_bars(598, 359); | 8282 WebSize screen_size_minus_status_bars(598, 359); |
8280 WebSize screen_size(640, 384); | 8283 WebSize screen_size(640, 384); |
8281 | 8284 |
8282 FakeCompositingWebViewClient client; | 8285 FakeCompositingWebViewClient client; |
8283 RegisterMockedHttpURLLoad("fullscreen_restore_scale_factor.html"); | 8286 RegisterMockedHttpURLLoad("fullscreen_restore_scale_factor.html"); |
8284 FrameTestHelpers::WebViewHelper web_view_helper; | 8287 FrameTestHelpers::WebViewHelper web_view_helper; |
8285 WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( | 8288 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( |
8286 base_url_ + "fullscreen_restore_scale_factor.html", true, nullptr, | 8289 base_url_ + "fullscreen_restore_scale_factor.html", true, nullptr, |
8287 &client, nullptr, &ConfigureAndroid); | 8290 &client, nullptr, &ConfigureAndroid); |
8288 client.screen_info_.rect.width = | 8291 client.screen_info_.rect.width = |
8289 screen_size_minus_status_bars_minus_url_bar.width; | 8292 screen_size_minus_status_bars_minus_url_bar.width; |
8290 client.screen_info_.rect.height = | 8293 client.screen_info_.rect.height = |
8291 screen_size_minus_status_bars_minus_url_bar.height; | 8294 screen_size_minus_status_bars_minus_url_bar.height; |
8292 web_view_helper.Resize(screen_size_minus_status_bars_minus_url_bar); | 8295 web_view_helper.Resize(screen_size_minus_status_bars_minus_url_bar); |
8293 LayoutViewItem layout_view_item = web_view_helper.WebView() | 8296 LayoutViewItem layout_view_item = web_view_helper.WebView() |
8294 ->MainFrameImpl() | 8297 ->MainFrameImpl() |
8295 ->GetFrameView() | 8298 ->GetFrameView() |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8343 } | 8346 } |
8344 | 8347 |
8345 // Tests that leaving fullscreen by navigating to a new page resets the | 8348 // Tests that leaving fullscreen by navigating to a new page resets the |
8346 // fullscreen page scale constraints. | 8349 // fullscreen page scale constraints. |
8347 TEST_P(ParameterizedWebFrameTest, ClearFullscreenConstraintsOnNavigation) { | 8350 TEST_P(ParameterizedWebFrameTest, ClearFullscreenConstraintsOnNavigation) { |
8348 RegisterMockedHttpURLLoad("viewport-tiny.html"); | 8351 RegisterMockedHttpURLLoad("viewport-tiny.html"); |
8349 FrameTestHelpers::WebViewHelper web_view_helper; | 8352 FrameTestHelpers::WebViewHelper web_view_helper; |
8350 int viewport_width = 100; | 8353 int viewport_width = 100; |
8351 int viewport_height = 200; | 8354 int viewport_height = 200; |
8352 | 8355 |
8353 WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( | 8356 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( |
8354 base_url_ + "viewport-tiny.html", true, nullptr, nullptr, nullptr, | 8357 base_url_ + "viewport-tiny.html", true, nullptr, nullptr, nullptr, |
8355 ConfigureAndroid); | 8358 ConfigureAndroid); |
8356 | 8359 |
8357 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); | 8360 web_view_helper.Resize(WebSize(viewport_width, viewport_height)); |
8358 web_view_impl->UpdateAllLifecyclePhases(); | 8361 web_view_impl->UpdateAllLifecyclePhases(); |
8359 | 8362 |
8360 // viewport-tiny.html specifies a 320px layout width. | 8363 // viewport-tiny.html specifies a 320px layout width. |
8361 LayoutViewItem layout_view_item = | 8364 LayoutViewItem layout_view_item = |
8362 web_view_impl->MainFrameImpl()->GetFrameView()->GetLayoutViewItem(); | 8365 web_view_impl->MainFrameImpl()->GetFrameView()->GetLayoutViewItem(); |
8363 EXPECT_EQ(320, layout_view_item.LogicalWidth().Floor()); | 8366 EXPECT_EQ(320, layout_view_item.LogicalWidth().Floor()); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8419 TestFullscreenWebLayerTreeView test_fullscreen_layer_tree_view; | 8422 TestFullscreenWebLayerTreeView test_fullscreen_layer_tree_view; |
8420 }; | 8423 }; |
8421 | 8424 |
8422 } // anonymous namespace | 8425 } // anonymous namespace |
8423 | 8426 |
8424 TEST_P(ParameterizedWebFrameTest, OverlayFullscreenVideo) { | 8427 TEST_P(ParameterizedWebFrameTest, OverlayFullscreenVideo) { |
8425 RuntimeEnabledFeatures::setForceOverlayFullscreenVideoEnabled(true); | 8428 RuntimeEnabledFeatures::setForceOverlayFullscreenVideoEnabled(true); |
8426 RegisterMockedHttpURLLoad("fullscreen_video.html"); | 8429 RegisterMockedHttpURLLoad("fullscreen_video.html"); |
8427 TestFullscreenWebViewClient web_view_client; | 8430 TestFullscreenWebViewClient web_view_client; |
8428 FrameTestHelpers::WebViewHelper web_view_helper; | 8431 FrameTestHelpers::WebViewHelper web_view_helper; |
8429 WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( | 8432 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( |
8430 base_url_ + "fullscreen_video.html", true, nullptr, &web_view_client); | 8433 base_url_ + "fullscreen_video.html", true, nullptr, &web_view_client); |
8431 | 8434 |
8432 const TestFullscreenWebLayerTreeView& layer_tree_view = | 8435 const TestFullscreenWebLayerTreeView& layer_tree_view = |
8433 web_view_client.test_fullscreen_layer_tree_view; | 8436 web_view_client.test_fullscreen_layer_tree_view; |
8434 | 8437 |
8435 Document* document = | 8438 Document* document = |
8436 web_view_impl->MainFrameImpl()->GetFrame()->GetDocument(); | 8439 web_view_impl->MainFrameImpl()->GetFrame()->GetDocument(); |
8437 UserGestureIndicator gesture(DocumentUserGestureToken::Create(document)); | 8440 UserGestureIndicator gesture(DocumentUserGestureToken::Create(document)); |
8438 HTMLVideoElement* video = | 8441 HTMLVideoElement* video = |
8439 toHTMLVideoElement(document->getElementById("video")); | 8442 toHTMLVideoElement(document->getElementById("video")); |
(...skipping 12 matching lines...) Expand all Loading... |
8452 EXPECT_FALSE(video->IsFullscreen()); | 8455 EXPECT_FALSE(video->IsFullscreen()); |
8453 EXPECT_FALSE(layer_tree_view.has_transparent_background); | 8456 EXPECT_FALSE(layer_tree_view.has_transparent_background); |
8454 } | 8457 } |
8455 | 8458 |
8456 TEST_P(ParameterizedWebFrameTest, LayoutBlockPercentHeightDescendants) { | 8459 TEST_P(ParameterizedWebFrameTest, LayoutBlockPercentHeightDescendants) { |
8457 RegisterMockedHttpURLLoad("percent-height-descendants.html"); | 8460 RegisterMockedHttpURLLoad("percent-height-descendants.html"); |
8458 FrameTestHelpers::WebViewHelper web_view_helper; | 8461 FrameTestHelpers::WebViewHelper web_view_helper; |
8459 web_view_helper.InitializeAndLoad(base_url_ + | 8462 web_view_helper.InitializeAndLoad(base_url_ + |
8460 "percent-height-descendants.html"); | 8463 "percent-height-descendants.html"); |
8461 | 8464 |
8462 WebViewImpl* web_view = web_view_helper.WebView(); | 8465 WebViewBase* web_view = web_view_helper.WebView(); |
8463 web_view_helper.Resize(WebSize(800, 800)); | 8466 web_view_helper.Resize(WebSize(800, 800)); |
8464 web_view->UpdateAllLifecyclePhases(); | 8467 web_view->UpdateAllLifecyclePhases(); |
8465 | 8468 |
8466 Document* document = web_view->MainFrameImpl()->GetFrame()->GetDocument(); | 8469 Document* document = web_view->MainFrameImpl()->GetFrame()->GetDocument(); |
8467 LayoutBlock* container = | 8470 LayoutBlock* container = |
8468 ToLayoutBlock(document->getElementById("container")->GetLayoutObject()); | 8471 ToLayoutBlock(document->getElementById("container")->GetLayoutObject()); |
8469 LayoutBox* percent_height_in_anonymous = | 8472 LayoutBox* percent_height_in_anonymous = |
8470 ToLayoutBox(document->getElementById("percent-height-in-anonymous") | 8473 ToLayoutBox(document->getElementById("percent-height-in-anonymous") |
8471 ->GetLayoutObject()); | 8474 ->GetLayoutObject()); |
8472 LayoutBox* percent_height_direct_child = | 8475 LayoutBox* percent_height_direct_child = |
(...skipping 14 matching lines...) Expand all Loading... |
8487 percent_height_direct_child)); | 8490 percent_height_direct_child)); |
8488 | 8491 |
8489 LayoutBlock* anonymous_block = percent_height_in_anonymous->ContainingBlock(); | 8492 LayoutBlock* anonymous_block = percent_height_in_anonymous->ContainingBlock(); |
8490 EXPECT_TRUE(anonymous_block->IsAnonymous()); | 8493 EXPECT_TRUE(anonymous_block->IsAnonymous()); |
8491 EXPECT_FALSE(anonymous_block->HasPercentHeightDescendants()); | 8494 EXPECT_FALSE(anonymous_block->HasPercentHeightDescendants()); |
8492 } | 8495 } |
8493 | 8496 |
8494 TEST_P(ParameterizedWebFrameTest, HasVisibleContentOnVisibleFrames) { | 8497 TEST_P(ParameterizedWebFrameTest, HasVisibleContentOnVisibleFrames) { |
8495 RegisterMockedHttpURLLoad("visible_frames.html"); | 8498 RegisterMockedHttpURLLoad("visible_frames.html"); |
8496 FrameTestHelpers::WebViewHelper web_view_helper; | 8499 FrameTestHelpers::WebViewHelper web_view_helper; |
8497 WebViewImpl* web_view_impl = | 8500 WebViewBase* web_view_impl = |
8498 web_view_helper.InitializeAndLoad(base_url_ + "visible_frames.html"); | 8501 web_view_helper.InitializeAndLoad(base_url_ + "visible_frames.html"); |
8499 for (WebFrame* frame = web_view_impl->MainFrameImpl()->TraverseNext(); frame; | 8502 for (WebFrame* frame = web_view_impl->MainFrameImpl()->TraverseNext(); frame; |
8500 frame = frame->TraverseNext()) { | 8503 frame = frame->TraverseNext()) { |
8501 EXPECT_TRUE(frame->HasVisibleContent()); | 8504 EXPECT_TRUE(frame->HasVisibleContent()); |
8502 } | 8505 } |
8503 } | 8506 } |
8504 | 8507 |
8505 TEST_P(ParameterizedWebFrameTest, HasVisibleContentOnHiddenFrames) { | 8508 TEST_P(ParameterizedWebFrameTest, HasVisibleContentOnHiddenFrames) { |
8506 RegisterMockedHttpURLLoad("hidden_frames.html"); | 8509 RegisterMockedHttpURLLoad("hidden_frames.html"); |
8507 FrameTestHelpers::WebViewHelper web_view_helper; | 8510 FrameTestHelpers::WebViewHelper web_view_helper; |
8508 WebViewImpl* web_view_impl = | 8511 WebViewBase* web_view_impl = |
8509 web_view_helper.InitializeAndLoad(base_url_ + "hidden_frames.html"); | 8512 web_view_helper.InitializeAndLoad(base_url_ + "hidden_frames.html"); |
8510 for (WebFrame* frame = web_view_impl->MainFrameImpl()->TraverseNext(); frame; | 8513 for (WebFrame* frame = web_view_impl->MainFrameImpl()->TraverseNext(); frame; |
8511 frame = frame->TraverseNext()) { | 8514 frame = frame->TraverseNext()) { |
8512 EXPECT_FALSE(frame->HasVisibleContent()); | 8515 EXPECT_FALSE(frame->HasVisibleContent()); |
8513 } | 8516 } |
8514 } | 8517 } |
8515 | 8518 |
8516 class ManifestChangeWebFrameClient | 8519 class ManifestChangeWebFrameClient |
8517 : public FrameTestHelpers::TestWebFrameClient { | 8520 : public FrameTestHelpers::TestWebFrameClient { |
8518 public: | 8521 public: |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8776 RegisterMockedHttpURLLoad("subframe-c.html"); | 8779 RegisterMockedHttpURLLoad("subframe-c.html"); |
8777 RegisterMockedHttpURLLoad("subframe-hello.html"); | 8780 RegisterMockedHttpURLLoad("subframe-hello.html"); |
8778 | 8781 |
8779 web_view_helper_.InitializeAndLoad(base_url_ + "frame-a-b-c.html", true); | 8782 web_view_helper_.InitializeAndLoad(base_url_ + "frame-a-b-c.html", true); |
8780 } | 8783 } |
8781 | 8784 |
8782 void Reset() { web_view_helper_.Reset(); } | 8785 void Reset() { web_view_helper_.Reset(); } |
8783 WebFrame* MainFrame() const { | 8786 WebFrame* MainFrame() const { |
8784 return web_view_helper_.WebView()->MainFrame(); | 8787 return web_view_helper_.WebView()->MainFrame(); |
8785 } | 8788 } |
8786 WebViewImpl* WebView() const { return web_view_helper_.WebView(); } | 8789 WebViewBase* WebView() const { return web_view_helper_.WebView(); } |
8787 | 8790 |
8788 private: | 8791 private: |
8789 FrameTestHelpers::WebViewHelper web_view_helper_; | 8792 FrameTestHelpers::WebViewHelper web_view_helper_; |
8790 }; | 8793 }; |
8791 | 8794 |
8792 TEST_F(WebFrameSwapTest, SwapMainFrame) { | 8795 TEST_F(WebFrameSwapTest, SwapMainFrame) { |
8793 WebRemoteFrame* remote_frame = | 8796 WebRemoteFrame* remote_frame = |
8794 WebRemoteFrame::Create(WebTreeScopeType::kDocument, nullptr); | 8797 WebRemoteFrame::Create(WebTreeScopeType::kDocument, nullptr); |
8795 MainFrame()->Swap(remote_frame); | 8798 MainFrame()->Swap(remote_frame); |
8796 | 8799 |
(...skipping 27 matching lines...) Expand all Loading... |
8824 | 8827 |
8825 remote_frame->View()->Resize(size); | 8828 remote_frame->View()->Resize(size); |
8826 | 8829 |
8827 FrameTestHelpers::TestWebFrameClient client; | 8830 FrameTestHelpers::TestWebFrameClient client; |
8828 WebLocalFrame* local_frame = WebLocalFrame::CreateProvisional( | 8831 WebLocalFrame* local_frame = WebLocalFrame::CreateProvisional( |
8829 &client, nullptr, nullptr, remote_frame, WebSandboxFlags::kNone); | 8832 &client, nullptr, nullptr, remote_frame, WebSandboxFlags::kNone); |
8830 remote_frame->Swap(local_frame); | 8833 remote_frame->Swap(local_frame); |
8831 | 8834 |
8832 // Verify that the size that was set with a remote main frame is correct | 8835 // Verify that the size that was set with a remote main frame is correct |
8833 // after swapping to a local frame. | 8836 // after swapping to a local frame. |
8834 Page* page = | 8837 Page* page = static_cast<WebViewBase*>(local_frame->View()) |
8835 ToWebViewImpl(local_frame->View())->GetPage()->MainFrame()->GetPage(); | 8838 ->GetPage() |
| 8839 ->MainFrame() |
| 8840 ->GetPage(); |
8836 EXPECT_EQ(size.width, page->GetVisualViewport().Size().Width()); | 8841 EXPECT_EQ(size.width, page->GetVisualViewport().Size().Width()); |
8837 EXPECT_EQ(size.height, page->GetVisualViewport().Size().Height()); | 8842 EXPECT_EQ(size.height, page->GetVisualViewport().Size().Height()); |
8838 | 8843 |
8839 // Manually reset to break WebViewHelper's dependency on the stack allocated | 8844 // Manually reset to break WebViewHelper's dependency on the stack allocated |
8840 // TestWebFrameClient. | 8845 // TestWebFrameClient. |
8841 Reset(); | 8846 Reset(); |
8842 remote_frame->Close(); | 8847 remote_frame->Close(); |
8843 } | 8848 } |
8844 | 8849 |
8845 namespace { | 8850 namespace { |
(...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10225 ScrollUpdate(&web_view_helper, 0, -150); | 10230 ScrollUpdate(&web_view_helper, 0, -150); |
10226 Mock::VerifyAndClearExpectations(&client); | 10231 Mock::VerifyAndClearExpectations(&client); |
10227 | 10232 |
10228 ScrollEnd(&web_view_helper); | 10233 ScrollEnd(&web_view_helper); |
10229 } | 10234 } |
10230 | 10235 |
10231 TEST_P(WebFrameOverscrollTest, ScaledPageRootLayerOverscrolled) { | 10236 TEST_P(WebFrameOverscrollTest, ScaledPageRootLayerOverscrolled) { |
10232 OverscrollWebViewClient client; | 10237 OverscrollWebViewClient client; |
10233 RegisterMockedHttpURLLoad("overscroll/overscroll.html"); | 10238 RegisterMockedHttpURLLoad("overscroll/overscroll.html"); |
10234 FrameTestHelpers::WebViewHelper web_view_helper; | 10239 FrameTestHelpers::WebViewHelper web_view_helper; |
10235 WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( | 10240 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( |
10236 base_url_ + "overscroll/overscroll.html", true, nullptr, &client, nullptr, | 10241 base_url_ + "overscroll/overscroll.html", true, nullptr, &client, nullptr, |
10237 ConfigureAndroid); | 10242 ConfigureAndroid); |
10238 web_view_helper.Resize(WebSize(200, 200)); | 10243 web_view_helper.Resize(WebSize(200, 200)); |
10239 web_view_impl->SetPageScaleFactor(3.0); | 10244 web_view_impl->SetPageScaleFactor(3.0); |
10240 | 10245 |
10241 // Calculation of accumulatedRootOverscroll and unusedDelta on scaled page. | 10246 // Calculation of accumulatedRootOverscroll and unusedDelta on scaled page. |
10242 // The point is (99, 99) because we clamp in the division by 3 to 33 so when | 10247 // The point is (99, 99) because we clamp in the division by 3 to 33 so when |
10243 // we go back to viewport coordinates it becomes (99, 99). | 10248 // we go back to viewport coordinates it becomes (99, 99). |
10244 ScrollBegin(&web_view_helper); | 10249 ScrollBegin(&web_view_helper); |
10245 EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -30), | 10250 EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -30), |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10326 | 10331 |
10327 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); | 10332 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); |
10328 ScrollEnd(&web_view_helper); | 10333 ScrollEnd(&web_view_helper); |
10329 Mock::VerifyAndClearExpectations(&client); | 10334 Mock::VerifyAndClearExpectations(&client); |
10330 } | 10335 } |
10331 | 10336 |
10332 TEST_F(WebFrameTest, OrientationFrameDetach) { | 10337 TEST_F(WebFrameTest, OrientationFrameDetach) { |
10333 RuntimeEnabledFeatures::setOrientationEventEnabled(true); | 10338 RuntimeEnabledFeatures::setOrientationEventEnabled(true); |
10334 RegisterMockedHttpURLLoad("orientation-frame-detach.html"); | 10339 RegisterMockedHttpURLLoad("orientation-frame-detach.html"); |
10335 FrameTestHelpers::WebViewHelper web_view_helper; | 10340 FrameTestHelpers::WebViewHelper web_view_helper; |
10336 WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( | 10341 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( |
10337 base_url_ + "orientation-frame-detach.html", true); | 10342 base_url_ + "orientation-frame-detach.html", true); |
10338 web_view_impl->MainFrameImpl()->SendOrientationChangeEvent(); | 10343 web_view_impl->MainFrameImpl()->SendOrientationChangeEvent(); |
10339 } | 10344 } |
10340 | 10345 |
10341 TEST_F(WebFrameTest, MaxFramesDetach) { | 10346 TEST_F(WebFrameTest, MaxFramesDetach) { |
10342 RegisterMockedHttpURLLoad("max-frames-detach.html"); | 10347 RegisterMockedHttpURLLoad("max-frames-detach.html"); |
10343 FrameTestHelpers::WebViewHelper web_view_helper; | 10348 FrameTestHelpers::WebViewHelper web_view_helper; |
10344 WebViewImpl* web_view_impl = web_view_helper.InitializeAndLoad( | 10349 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( |
10345 base_url_ + "max-frames-detach.html", true); | 10350 base_url_ + "max-frames-detach.html", true); |
10346 web_view_impl->MainFrameImpl()->CollectGarbage(); | 10351 web_view_impl->MainFrameImpl()->CollectGarbage(); |
10347 } | 10352 } |
10348 | 10353 |
10349 TEST_F(WebFrameTest, ImageDocumentLoadFinishTime) { | 10354 TEST_F(WebFrameTest, ImageDocumentLoadFinishTime) { |
10350 // Loading an image resource directly generates an ImageDocument with | 10355 // Loading an image resource directly generates an ImageDocument with |
10351 // the document loader feeding image data into the resource of a generated | 10356 // the document loader feeding image data into the resource of a generated |
10352 // img tag. We expect the load finish time to be the same for the document | 10357 // img tag. We expect the load finish time to be the same for the document |
10353 // and the image resource. | 10358 // and the image resource. |
10354 | 10359 |
10355 RegisterMockedHttpURLLoadWithMimeType("white-1x1.png", "image/png"); | 10360 RegisterMockedHttpURLLoadWithMimeType("white-1x1.png", "image/png"); |
10356 FrameTestHelpers::WebViewHelper web_view_helper; | 10361 FrameTestHelpers::WebViewHelper web_view_helper; |
10357 web_view_helper.InitializeAndLoad(base_url_ + "white-1x1.png"); | 10362 web_view_helper.InitializeAndLoad(base_url_ + "white-1x1.png"); |
10358 WebViewImpl* web_view = web_view_helper.WebView(); | 10363 WebViewBase* web_view = web_view_helper.WebView(); |
10359 Document* document = web_view->MainFrameImpl()->GetFrame()->GetDocument(); | 10364 Document* document = web_view->MainFrameImpl()->GetFrame()->GetDocument(); |
10360 | 10365 |
10361 EXPECT_TRUE(document); | 10366 EXPECT_TRUE(document); |
10362 EXPECT_TRUE(document->IsImageDocument()); | 10367 EXPECT_TRUE(document->IsImageDocument()); |
10363 | 10368 |
10364 ImageDocument* img_document = ToImageDocument(document); | 10369 ImageDocument* img_document = ToImageDocument(document); |
10365 ImageResource* resource = img_document->CachedImageResourceDeprecated(); | 10370 ImageResource* resource = img_document->CachedImageResourceDeprecated(); |
10366 | 10371 |
10367 EXPECT_TRUE(resource); | 10372 EXPECT_TRUE(resource); |
10368 EXPECT_NE(0, resource->LoadFinishTime()); | 10373 EXPECT_NE(0, resource->LoadFinishTime()); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10576 }; | 10581 }; |
10577 | 10582 |
10578 TEST_F(WebFrameTest, SaveImageAt) { | 10583 TEST_F(WebFrameTest, SaveImageAt) { |
10579 std::string url = base_url_ + "image-with-data-url.html"; | 10584 std::string url = base_url_ + "image-with-data-url.html"; |
10580 RegisterMockedURLLoadFromBase(base_url_, "image-with-data-url.html"); | 10585 RegisterMockedURLLoadFromBase(base_url_, "image-with-data-url.html"); |
10581 URLTestHelpers::RegisterMockedURLLoad( | 10586 URLTestHelpers::RegisterMockedURLLoad( |
10582 ToKURL("http://test"), testing::WebTestDataPath("white-1x1.png")); | 10587 ToKURL("http://test"), testing::WebTestDataPath("white-1x1.png")); |
10583 | 10588 |
10584 FrameTestHelpers::WebViewHelper helper; | 10589 FrameTestHelpers::WebViewHelper helper; |
10585 SaveImageFromDataURLWebFrameClient client; | 10590 SaveImageFromDataURLWebFrameClient client; |
10586 WebViewImpl* web_view = helper.InitializeAndLoad(url, true, &client); | 10591 WebViewBase* web_view = helper.InitializeAndLoad(url, true, &client); |
10587 web_view->Resize(WebSize(400, 400)); | 10592 web_view->Resize(WebSize(400, 400)); |
10588 web_view->UpdateAllLifecyclePhases(); | 10593 web_view->UpdateAllLifecyclePhases(); |
10589 | 10594 |
10590 WebLocalFrame* local_frame = web_view->MainFrameImpl(); | 10595 WebLocalFrame* local_frame = web_view->MainFrameImpl(); |
10591 | 10596 |
10592 client.Reset(); | 10597 client.Reset(); |
10593 local_frame->SaveImageAt(WebPoint(1, 1)); | 10598 local_frame->SaveImageAt(WebPoint(1, 1)); |
10594 EXPECT_EQ( | 10599 EXPECT_EQ( |
10595 WebString::FromUTF8("data:image/gif;base64" | 10600 WebString::FromUTF8("data:image/gif;base64" |
10596 ",R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="), | 10601 ",R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="), |
(...skipping 16 matching lines...) Expand all Loading... |
10613 // Explicitly reset to break dependency on locally scoped client. | 10618 // Explicitly reset to break dependency on locally scoped client. |
10614 helper.Reset(); | 10619 helper.Reset(); |
10615 } | 10620 } |
10616 | 10621 |
10617 TEST_F(WebFrameTest, SaveImageWithImageMap) { | 10622 TEST_F(WebFrameTest, SaveImageWithImageMap) { |
10618 std::string url = base_url_ + "image-map.html"; | 10623 std::string url = base_url_ + "image-map.html"; |
10619 RegisterMockedURLLoadFromBase(base_url_, "image-map.html"); | 10624 RegisterMockedURLLoadFromBase(base_url_, "image-map.html"); |
10620 | 10625 |
10621 FrameTestHelpers::WebViewHelper helper; | 10626 FrameTestHelpers::WebViewHelper helper; |
10622 SaveImageFromDataURLWebFrameClient client; | 10627 SaveImageFromDataURLWebFrameClient client; |
10623 WebViewImpl* web_view = helper.InitializeAndLoad(url, true, &client); | 10628 WebViewBase* web_view = helper.InitializeAndLoad(url, true, &client); |
10624 web_view->Resize(WebSize(400, 400)); | 10629 web_view->Resize(WebSize(400, 400)); |
10625 | 10630 |
10626 WebLocalFrame* local_frame = web_view->MainFrameImpl(); | 10631 WebLocalFrame* local_frame = web_view->MainFrameImpl(); |
10627 | 10632 |
10628 client.Reset(); | 10633 client.Reset(); |
10629 local_frame->SaveImageAt(WebPoint(25, 25)); | 10634 local_frame->SaveImageAt(WebPoint(25, 25)); |
10630 EXPECT_EQ( | 10635 EXPECT_EQ( |
10631 WebString::FromUTF8("data:image/gif;base64" | 10636 WebString::FromUTF8("data:image/gif;base64" |
10632 ",R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="), | 10637 ",R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="), |
10633 client.Result()); | 10638 client.Result()); |
(...skipping 11 matching lines...) Expand all Loading... |
10645 | 10650 |
10646 // Explicitly reset to break dependency on locally scoped client. | 10651 // Explicitly reset to break dependency on locally scoped client. |
10647 helper.Reset(); | 10652 helper.Reset(); |
10648 } | 10653 } |
10649 | 10654 |
10650 TEST_F(WebFrameTest, CopyImageAt) { | 10655 TEST_F(WebFrameTest, CopyImageAt) { |
10651 std::string url = base_url_ + "canvas-copy-image.html"; | 10656 std::string url = base_url_ + "canvas-copy-image.html"; |
10652 RegisterMockedURLLoadFromBase(base_url_, "canvas-copy-image.html"); | 10657 RegisterMockedURLLoadFromBase(base_url_, "canvas-copy-image.html"); |
10653 | 10658 |
10654 FrameTestHelpers::WebViewHelper helper; | 10659 FrameTestHelpers::WebViewHelper helper; |
10655 WebViewImpl* web_view = helper.InitializeAndLoad(url, true, 0); | 10660 WebViewBase* web_view = helper.InitializeAndLoad(url, true, 0); |
10656 web_view->Resize(WebSize(400, 400)); | 10661 web_view->Resize(WebSize(400, 400)); |
10657 | 10662 |
10658 uint64_t sequence = Platform::Current()->Clipboard()->SequenceNumber( | 10663 uint64_t sequence = Platform::Current()->Clipboard()->SequenceNumber( |
10659 WebClipboard::kBufferStandard); | 10664 WebClipboard::kBufferStandard); |
10660 | 10665 |
10661 WebLocalFrame* local_frame = web_view->MainFrameImpl(); | 10666 WebLocalFrame* local_frame = web_view->MainFrameImpl(); |
10662 local_frame->CopyImageAt(WebPoint(50, 50)); | 10667 local_frame->CopyImageAt(WebPoint(50, 50)); |
10663 | 10668 |
10664 EXPECT_NE(sequence, Platform::Current()->Clipboard()->SequenceNumber( | 10669 EXPECT_NE(sequence, Platform::Current()->Clipboard()->SequenceNumber( |
10665 WebClipboard::kBufferStandard)); | 10670 WebClipboard::kBufferStandard)); |
10666 | 10671 |
10667 WebImage image = | 10672 WebImage image = |
10668 static_cast<WebMockClipboard*>(Platform::Current()->Clipboard()) | 10673 static_cast<WebMockClipboard*>(Platform::Current()->Clipboard()) |
10669 ->ReadRawImage(WebClipboard::Buffer()); | 10674 ->ReadRawImage(WebClipboard::Buffer()); |
10670 | 10675 |
10671 EXPECT_EQ(SkColorSetARGB(255, 255, 0, 0), image.GetSkBitmap().getColor(0, 0)); | 10676 EXPECT_EQ(SkColorSetARGB(255, 255, 0, 0), image.GetSkBitmap().getColor(0, 0)); |
10672 }; | 10677 }; |
10673 | 10678 |
10674 TEST_F(WebFrameTest, CopyImageAtWithPinchZoom) { | 10679 TEST_F(WebFrameTest, CopyImageAtWithPinchZoom) { |
10675 std::string url = base_url_ + "canvas-copy-image.html"; | 10680 std::string url = base_url_ + "canvas-copy-image.html"; |
10676 RegisterMockedURLLoadFromBase(base_url_, "canvas-copy-image.html"); | 10681 RegisterMockedURLLoadFromBase(base_url_, "canvas-copy-image.html"); |
10677 | 10682 |
10678 FrameTestHelpers::WebViewHelper helper; | 10683 FrameTestHelpers::WebViewHelper helper; |
10679 WebViewImpl* web_view = helper.InitializeAndLoad(url, true, 0); | 10684 WebViewBase* web_view = helper.InitializeAndLoad(url, true, 0); |
10680 web_view->Resize(WebSize(400, 400)); | 10685 web_view->Resize(WebSize(400, 400)); |
10681 web_view->UpdateAllLifecyclePhases(); | 10686 web_view->UpdateAllLifecyclePhases(); |
10682 web_view->SetPageScaleFactor(2); | 10687 web_view->SetPageScaleFactor(2); |
10683 web_view->SetVisualViewportOffset(WebFloatPoint(200, 200)); | 10688 web_view->SetVisualViewportOffset(WebFloatPoint(200, 200)); |
10684 | 10689 |
10685 uint64_t sequence = Platform::Current()->Clipboard()->SequenceNumber( | 10690 uint64_t sequence = Platform::Current()->Clipboard()->SequenceNumber( |
10686 WebClipboard::kBufferStandard); | 10691 WebClipboard::kBufferStandard); |
10687 | 10692 |
10688 WebLocalFrame* local_frame = web_view->MainFrameImpl(); | 10693 WebLocalFrame* local_frame = web_view->MainFrameImpl(); |
10689 local_frame->CopyImageAt(WebPoint(0, 0)); | 10694 local_frame->CopyImageAt(WebPoint(0, 0)); |
10690 | 10695 |
10691 EXPECT_NE(sequence, Platform::Current()->Clipboard()->SequenceNumber( | 10696 EXPECT_NE(sequence, Platform::Current()->Clipboard()->SequenceNumber( |
10692 WebClipboard::kBufferStandard)); | 10697 WebClipboard::kBufferStandard)); |
10693 | 10698 |
10694 WebImage image = | 10699 WebImage image = |
10695 static_cast<WebMockClipboard*>(Platform::Current()->Clipboard()) | 10700 static_cast<WebMockClipboard*>(Platform::Current()->Clipboard()) |
10696 ->ReadRawImage(WebClipboard::Buffer()); | 10701 ->ReadRawImage(WebClipboard::Buffer()); |
10697 | 10702 |
10698 EXPECT_EQ(SkColorSetARGB(255, 255, 0, 0), image.GetSkBitmap().getColor(0, 0)); | 10703 EXPECT_EQ(SkColorSetARGB(255, 255, 0, 0), image.GetSkBitmap().getColor(0, 0)); |
10699 }; | 10704 }; |
10700 | 10705 |
10701 TEST_F(WebFrameTest, CopyImageWithImageMap) { | 10706 TEST_F(WebFrameTest, CopyImageWithImageMap) { |
10702 SaveImageFromDataURLWebFrameClient client; | 10707 SaveImageFromDataURLWebFrameClient client; |
10703 | 10708 |
10704 std::string url = base_url_ + "image-map.html"; | 10709 std::string url = base_url_ + "image-map.html"; |
10705 RegisterMockedURLLoadFromBase(base_url_, "image-map.html"); | 10710 RegisterMockedURLLoadFromBase(base_url_, "image-map.html"); |
10706 | 10711 |
10707 FrameTestHelpers::WebViewHelper helper; | 10712 FrameTestHelpers::WebViewHelper helper; |
10708 WebViewImpl* web_view = helper.InitializeAndLoad(url, true, &client); | 10713 WebViewBase* web_view = helper.InitializeAndLoad(url, true, &client); |
10709 web_view->Resize(WebSize(400, 400)); | 10714 web_view->Resize(WebSize(400, 400)); |
10710 | 10715 |
10711 client.Reset(); | 10716 client.Reset(); |
10712 WebLocalFrame* local_frame = web_view->MainFrameImpl(); | 10717 WebLocalFrame* local_frame = web_view->MainFrameImpl(); |
10713 local_frame->SaveImageAt(WebPoint(25, 25)); | 10718 local_frame->SaveImageAt(WebPoint(25, 25)); |
10714 EXPECT_EQ( | 10719 EXPECT_EQ( |
10715 WebString::FromUTF8("data:image/gif;base64" | 10720 WebString::FromUTF8("data:image/gif;base64" |
10716 ",R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="), | 10721 ",R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="), |
10717 client.Result()); | 10722 client.Result()); |
10718 | 10723 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10888 // content size -- maintains a minimum height matching the viewport in cases | 10893 // content size -- maintains a minimum height matching the viewport in cases |
10889 // where the content is smaller. | 10894 // where the content is smaller. |
10890 TEST_F(WebFrameTest, RootLayerMinimumHeight) { | 10895 TEST_F(WebFrameTest, RootLayerMinimumHeight) { |
10891 constexpr int kViewportWidth = 320; | 10896 constexpr int kViewportWidth = 320; |
10892 constexpr int kViewportHeight = 640; | 10897 constexpr int kViewportHeight = 640; |
10893 constexpr int kBrowserControlsHeight = 100; | 10898 constexpr int kBrowserControlsHeight = 100; |
10894 | 10899 |
10895 FrameTestHelpers::WebViewHelper web_view_helper; | 10900 FrameTestHelpers::WebViewHelper web_view_helper; |
10896 web_view_helper.Initialize(true, nullptr, nullptr, nullptr, | 10901 web_view_helper.Initialize(true, nullptr, nullptr, nullptr, |
10897 EnableViewportSettings); | 10902 EnableViewportSettings); |
10898 WebViewImpl* web_view = web_view_helper.WebView(); | 10903 WebViewBase* web_view = web_view_helper.WebView(); |
10899 web_view->ResizeWithBrowserControls( | 10904 web_view->ResizeWithBrowserControls( |
10900 WebSize(kViewportWidth, kViewportHeight - kBrowserControlsHeight), | 10905 WebSize(kViewportWidth, kViewportHeight - kBrowserControlsHeight), |
10901 kBrowserControlsHeight, true); | 10906 kBrowserControlsHeight, true); |
10902 | 10907 |
10903 InitializeWithHTML(*web_view->MainFrameImpl()->GetFrame(), | 10908 InitializeWithHTML(*web_view->MainFrameImpl()->GetFrame(), |
10904 "<!DOCTYPE html>" | 10909 "<!DOCTYPE html>" |
10905 "<style>" | 10910 "<style>" |
10906 " html, body {width:100%;height:540px;margin:0px}" | 10911 " html, body {width:100%;height:540px;margin:0px}" |
10907 " #elem {" | 10912 " #elem {" |
10908 " overflow: scroll;" | 10913 " overflow: scroll;" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10954 | 10959 |
10955 document->View()->SetTracksPaintInvalidations(false); | 10960 document->View()->SetTracksPaintInvalidations(false); |
10956 } | 10961 } |
10957 | 10962 |
10958 // Load a page with display:none set and try to scroll it. It shouldn't crash | 10963 // Load a page with display:none set and try to scroll it. It shouldn't crash |
10959 // due to lack of layoutObject. crbug.com/653327. | 10964 // due to lack of layoutObject. crbug.com/653327. |
10960 TEST_F(WebFrameTest, ScrollBeforeLayoutDoesntCrash) { | 10965 TEST_F(WebFrameTest, ScrollBeforeLayoutDoesntCrash) { |
10961 RegisterMockedHttpURLLoad("display-none.html"); | 10966 RegisterMockedHttpURLLoad("display-none.html"); |
10962 FrameTestHelpers::WebViewHelper web_view_helper; | 10967 FrameTestHelpers::WebViewHelper web_view_helper; |
10963 web_view_helper.InitializeAndLoad(base_url_ + "display-none.html"); | 10968 web_view_helper.InitializeAndLoad(base_url_ + "display-none.html"); |
10964 WebViewImpl* web_view = web_view_helper.WebView(); | 10969 WebViewBase* web_view = web_view_helper.WebView(); |
10965 web_view_helper.Resize(WebSize(640, 480)); | 10970 web_view_helper.Resize(WebSize(640, 480)); |
10966 | 10971 |
10967 Document* document = web_view->MainFrameImpl()->GetFrame()->GetDocument(); | 10972 Document* document = web_view->MainFrameImpl()->GetFrame()->GetDocument(); |
10968 document->documentElement()->SetLayoutObject(nullptr); | 10973 document->documentElement()->SetLayoutObject(nullptr); |
10969 | 10974 |
10970 WebGestureEvent begin_event(WebInputEvent::kGestureScrollBegin, | 10975 WebGestureEvent begin_event(WebInputEvent::kGestureScrollBegin, |
10971 WebInputEvent::kNoModifiers, | 10976 WebInputEvent::kNoModifiers, |
10972 WebInputEvent::kTimeStampForTesting); | 10977 WebInputEvent::kTimeStampForTesting); |
10973 begin_event.source_device = kWebGestureDeviceTouchpad; | 10978 begin_event.source_device = kWebGestureDeviceTouchpad; |
10974 WebGestureEvent update_event(WebInputEvent::kGestureScrollUpdate, | 10979 WebGestureEvent update_event(WebInputEvent::kGestureScrollUpdate, |
(...skipping 18 matching lines...) Expand all Loading... |
10993 web_view_helper.WebView()->HandleInputEvent( | 10998 web_view_helper.WebView()->HandleInputEvent( |
10994 WebCoalescedInputEvent(update_event)); | 10999 WebCoalescedInputEvent(update_event)); |
10995 web_view_helper.WebView()->HandleInputEvent( | 11000 web_view_helper.WebView()->HandleInputEvent( |
10996 WebCoalescedInputEvent(end_event)); | 11001 WebCoalescedInputEvent(end_event)); |
10997 } | 11002 } |
10998 | 11003 |
10999 TEST_F(WebFrameTest, HidingScrollbarsOnScrollableAreaDisablesScrollbars) { | 11004 TEST_F(WebFrameTest, HidingScrollbarsOnScrollableAreaDisablesScrollbars) { |
11000 FrameTestHelpers::WebViewHelper web_view_helper; | 11005 FrameTestHelpers::WebViewHelper web_view_helper; |
11001 web_view_helper.Initialize(true); | 11006 web_view_helper.Initialize(true); |
11002 web_view_helper.Resize(WebSize(800, 600)); | 11007 web_view_helper.Resize(WebSize(800, 600)); |
11003 WebViewImpl* web_view = web_view_helper.WebView(); | 11008 WebViewBase* web_view = web_view_helper.WebView(); |
11004 | 11009 |
11005 InitializeWithHTML( | 11010 InitializeWithHTML( |
11006 *web_view->MainFrameImpl()->GetFrame(), | 11011 *web_view->MainFrameImpl()->GetFrame(), |
11007 "<!DOCTYPE html>" | 11012 "<!DOCTYPE html>" |
11008 "<style>" | 11013 "<style>" |
11009 " #scroller { overflow: scroll; width: 1000px; height: 1000px }" | 11014 " #scroller { overflow: scroll; width: 1000px; height: 1000px }" |
11010 " #spacer { width: 2000px; height: 2000px }" | 11015 " #spacer { width: 2000px; height: 2000px }" |
11011 "</style>" | 11016 "</style>" |
11012 "<div id='scroller'>" | 11017 "<div id='scroller'>" |
11013 " <div id='spacer'></div>" | 11018 " <div id='spacer'></div>" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11055 scroller_area->HorizontalScrollbar()->ShouldParticipateInHitTesting()); | 11060 scroller_area->HorizontalScrollbar()->ShouldParticipateInHitTesting()); |
11056 EXPECT_TRUE( | 11061 EXPECT_TRUE( |
11057 scroller_area->VerticalScrollbar()->ShouldParticipateInHitTesting()); | 11062 scroller_area->VerticalScrollbar()->ShouldParticipateInHitTesting()); |
11058 } | 11063 } |
11059 | 11064 |
11060 TEST_F(WebFrameTest, MouseOverDifferntNodeClearsTooltip) { | 11065 TEST_F(WebFrameTest, MouseOverDifferntNodeClearsTooltip) { |
11061 FrameTestHelpers::WebViewHelper web_view_helper; | 11066 FrameTestHelpers::WebViewHelper web_view_helper; |
11062 web_view_helper.Initialize(true, nullptr, nullptr, nullptr, | 11067 web_view_helper.Initialize(true, nullptr, nullptr, nullptr, |
11063 [](WebSettings* settings) {}); | 11068 [](WebSettings* settings) {}); |
11064 web_view_helper.Resize(WebSize(200, 200)); | 11069 web_view_helper.Resize(WebSize(200, 200)); |
11065 WebViewImpl* web_view = web_view_helper.WebView(); | 11070 WebViewBase* web_view = web_view_helper.WebView(); |
11066 | 11071 |
11067 InitializeWithHTML( | 11072 InitializeWithHTML( |
11068 *web_view->MainFrameImpl()->GetFrame(), | 11073 *web_view->MainFrameImpl()->GetFrame(), |
11069 "<head>" | 11074 "<head>" |
11070 " <style type='text/css'>" | 11075 " <style type='text/css'>" |
11071 " div" | 11076 " div" |
11072 " {" | 11077 " {" |
11073 " width: 200px;" | 11078 " width: 200px;" |
11074 " height: 100px;" | 11079 " height: 100px;" |
11075 " background-color: #eeeeff;" | 11080 " background-color: #eeeeff;" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11135 } | 11140 } |
11136 | 11141 |
11137 // Makes sure that mouse hover over an overlay scrollbar doesn't activate | 11142 // Makes sure that mouse hover over an overlay scrollbar doesn't activate |
11138 // elements below(except the Element that owns the scrollbar) unless the | 11143 // elements below(except the Element that owns the scrollbar) unless the |
11139 // scrollbar is faded out. | 11144 // scrollbar is faded out. |
11140 TEST_F(WebFrameTest, MouseOverLinkAndOverlayScrollbar) { | 11145 TEST_F(WebFrameTest, MouseOverLinkAndOverlayScrollbar) { |
11141 FrameTestHelpers::WebViewHelper web_view_helper; | 11146 FrameTestHelpers::WebViewHelper web_view_helper; |
11142 web_view_helper.Initialize(true, nullptr, nullptr, nullptr, | 11147 web_view_helper.Initialize(true, nullptr, nullptr, nullptr, |
11143 [](WebSettings* settings) {}); | 11148 [](WebSettings* settings) {}); |
11144 web_view_helper.Resize(WebSize(20, 20)); | 11149 web_view_helper.Resize(WebSize(20, 20)); |
11145 WebViewImpl* web_view = web_view_helper.WebView(); | 11150 WebViewBase* web_view = web_view_helper.WebView(); |
11146 | 11151 |
11147 InitializeWithHTML(*web_view->MainFrameImpl()->GetFrame(), | 11152 InitializeWithHTML(*web_view->MainFrameImpl()->GetFrame(), |
11148 "<!DOCTYPE html>" | 11153 "<!DOCTYPE html>" |
11149 "<a id='a' href='javascript:void(0);'>" | 11154 "<a id='a' href='javascript:void(0);'>" |
11150 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | 11155 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
11151 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | 11156 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
11152 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" | 11157 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" |
11153 "</a>" | 11158 "</a>" |
11154 "<div style='position: absolute; top: 1000px'>end</div>"); | 11159 "<div style='position: absolute; top: 1000px'>end</div>"); |
11155 | 11160 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11248 | 11253 |
11249 document->GetFrame()->GetEventHandler().HandleMouseReleaseEvent( | 11254 document->GetFrame()->GetEventHandler().HandleMouseReleaseEvent( |
11250 mouse_release_event); | 11255 mouse_release_event); |
11251 } | 11256 } |
11252 | 11257 |
11253 // Makes sure that mouse hover over an custom scrollbar doesn't change the | 11258 // Makes sure that mouse hover over an custom scrollbar doesn't change the |
11254 // activate elements. | 11259 // activate elements. |
11255 TEST_F(WebFrameTest, MouseOverCustomScrollbar) { | 11260 TEST_F(WebFrameTest, MouseOverCustomScrollbar) { |
11256 RegisterMockedHttpURLLoad("custom-scrollbar-hover.html"); | 11261 RegisterMockedHttpURLLoad("custom-scrollbar-hover.html"); |
11257 FrameTestHelpers::WebViewHelper web_view_helper; | 11262 FrameTestHelpers::WebViewHelper web_view_helper; |
11258 WebViewImpl* web_view = web_view_helper.InitializeAndLoad( | 11263 WebViewBase* web_view = web_view_helper.InitializeAndLoad( |
11259 base_url_ + "custom-scrollbar-hover.html"); | 11264 base_url_ + "custom-scrollbar-hover.html"); |
11260 | 11265 |
11261 web_view_helper.Resize(WebSize(200, 200)); | 11266 web_view_helper.Resize(WebSize(200, 200)); |
11262 | 11267 |
11263 web_view->UpdateAllLifecyclePhases(); | 11268 web_view->UpdateAllLifecyclePhases(); |
11264 | 11269 |
11265 Document* document = | 11270 Document* document = |
11266 ToLocalFrame(web_view->GetPage()->MainFrame())->GetDocument(); | 11271 ToLocalFrame(web_view->GetPage()->MainFrame())->GetDocument(); |
11267 | 11272 |
11268 Element* scrollbar_div = document->getElementById("scrollbar"); | 11273 Element* scrollbar_div = document->getElementById("scrollbar"); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11306 EXPECT_EQ(document->HoverElement(), scrollbar_div); | 11311 EXPECT_EQ(document->HoverElement(), scrollbar_div); |
11307 EXPECT_EQ(hit_test_result.GetScrollbar()->HoveredPart(), | 11312 EXPECT_EQ(hit_test_result.GetScrollbar()->HoveredPart(), |
11308 ScrollbarPart::kThumbPart); | 11313 ScrollbarPart::kThumbPart); |
11309 } | 11314 } |
11310 | 11315 |
11311 // Makes sure that mouse hover over an overlay scrollbar doesn't hover iframe | 11316 // Makes sure that mouse hover over an overlay scrollbar doesn't hover iframe |
11312 // below. | 11317 // below. |
11313 TEST_F(WebFrameTest, MouseOverScrollbarAndIFrame) { | 11318 TEST_F(WebFrameTest, MouseOverScrollbarAndIFrame) { |
11314 RegisterMockedHttpURLLoad("scrollbar-and-iframe-hover.html"); | 11319 RegisterMockedHttpURLLoad("scrollbar-and-iframe-hover.html"); |
11315 FrameTestHelpers::WebViewHelper web_view_helper; | 11320 FrameTestHelpers::WebViewHelper web_view_helper; |
11316 WebViewImpl* web_view = web_view_helper.InitializeAndLoad( | 11321 WebViewBase* web_view = web_view_helper.InitializeAndLoad( |
11317 base_url_ + "scrollbar-and-iframe-hover.html"); | 11322 base_url_ + "scrollbar-and-iframe-hover.html"); |
11318 | 11323 |
11319 web_view_helper.Resize(WebSize(200, 200)); | 11324 web_view_helper.Resize(WebSize(200, 200)); |
11320 | 11325 |
11321 web_view->UpdateAllLifecyclePhases(); | 11326 web_view->UpdateAllLifecyclePhases(); |
11322 | 11327 |
11323 Document* document = | 11328 Document* document = |
11324 ToLocalFrame(web_view->GetPage()->MainFrame())->GetDocument(); | 11329 ToLocalFrame(web_view->GetPage()->MainFrame())->GetDocument(); |
11325 Element* iframe = document->getElementById("iframe"); | 11330 Element* iframe = document->getElementById("iframe"); |
11326 DCHECK(iframe); | 11331 DCHECK(iframe); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11382 // IFRAME hover. | 11387 // IFRAME hover. |
11383 EXPECT_EQ(document->HoverElement(), iframe); | 11388 EXPECT_EQ(document->HoverElement(), iframe); |
11384 } | 11389 } |
11385 | 11390 |
11386 // Makes sure that mouse hover over a scrollbar also hover the element owns the | 11391 // Makes sure that mouse hover over a scrollbar also hover the element owns the |
11387 // scrollbar. | 11392 // scrollbar. |
11388 TEST_F(WebFrameTest, MouseOverScrollbarAndParentElement) { | 11393 TEST_F(WebFrameTest, MouseOverScrollbarAndParentElement) { |
11389 RegisterMockedHttpURLLoad("scrollbar-and-element-hover.html"); | 11394 RegisterMockedHttpURLLoad("scrollbar-and-element-hover.html"); |
11390 FrameTestHelpers::WebViewHelper web_view_helper; | 11395 FrameTestHelpers::WebViewHelper web_view_helper; |
11391 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false); | 11396 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(false); |
11392 WebViewImpl* web_view = web_view_helper.InitializeAndLoad( | 11397 WebViewBase* web_view = web_view_helper.InitializeAndLoad( |
11393 base_url_ + "scrollbar-and-element-hover.html"); | 11398 base_url_ + "scrollbar-and-element-hover.html"); |
11394 | 11399 |
11395 web_view_helper.Resize(WebSize(200, 200)); | 11400 web_view_helper.Resize(WebSize(200, 200)); |
11396 | 11401 |
11397 web_view->UpdateAllLifecyclePhases(); | 11402 web_view->UpdateAllLifecyclePhases(); |
11398 | 11403 |
11399 Document* document = | 11404 Document* document = |
11400 ToLocalFrame(web_view->GetPage()->MainFrame())->GetDocument(); | 11405 ToLocalFrame(web_view->GetPage()->MainFrame())->GetDocument(); |
11401 | 11406 |
11402 Element* parent_div = document->getElementById("parent"); | 11407 Element* parent_div = document->getElementById("parent"); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11465 document->GetFrame()->GetEventHandler().HandleMouseMoveEvent( | 11470 document->GetFrame()->GetEventHandler().HandleMouseMoveEvent( |
11466 mouse_move_over_div_and_scrollbar, Vector<WebMouseEvent>()); | 11471 mouse_move_over_div_and_scrollbar, Vector<WebMouseEvent>()); |
11467 | 11472 |
11468 // Not change the DIV :hover. | 11473 // Not change the DIV :hover. |
11469 EXPECT_EQ(document->HoverElement(), parent_div); | 11474 EXPECT_EQ(document->HoverElement(), parent_div); |
11470 } | 11475 } |
11471 | 11476 |
11472 TEST_F(WebFrameTest, MouseReleaseUpdatesScrollbarHoveredPart) { | 11477 TEST_F(WebFrameTest, MouseReleaseUpdatesScrollbarHoveredPart) { |
11473 RegisterMockedHttpURLLoad("custom-scrollbar-hover.html"); | 11478 RegisterMockedHttpURLLoad("custom-scrollbar-hover.html"); |
11474 FrameTestHelpers::WebViewHelper web_view_helper; | 11479 FrameTestHelpers::WebViewHelper web_view_helper; |
11475 WebViewImpl* web_view = web_view_helper.InitializeAndLoad( | 11480 WebViewBase* web_view = web_view_helper.InitializeAndLoad( |
11476 base_url_ + "custom-scrollbar-hover.html"); | 11481 base_url_ + "custom-scrollbar-hover.html"); |
11477 | 11482 |
11478 web_view_helper.Resize(WebSize(200, 200)); | 11483 web_view_helper.Resize(WebSize(200, 200)); |
11479 | 11484 |
11480 web_view->UpdateAllLifecyclePhases(); | 11485 web_view->UpdateAllLifecyclePhases(); |
11481 | 11486 |
11482 Document* document = | 11487 Document* document = |
11483 ToLocalFrame(web_view->GetPage()->MainFrame())->GetDocument(); | 11488 ToLocalFrame(web_view->GetPage()->MainFrame())->GetDocument(); |
11484 | 11489 |
11485 Element* scrollbar_div = document->getElementById("scrollbar"); | 11490 Element* scrollbar_div = document->getElementById("scrollbar"); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11538 mouse_release_event); | 11543 mouse_release_event); |
11539 EXPECT_EQ(scrollbar->PressedPart(), ScrollbarPart::kNoPart); | 11544 EXPECT_EQ(scrollbar->PressedPart(), ScrollbarPart::kNoPart); |
11540 EXPECT_EQ(scrollbar->HoveredPart(), ScrollbarPart::kNoPart); | 11545 EXPECT_EQ(scrollbar->HoveredPart(), ScrollbarPart::kNoPart); |
11541 } | 11546 } |
11542 | 11547 |
11543 TEST_F(WebFrameTest, | 11548 TEST_F(WebFrameTest, |
11544 CustomScrollbarInOverlayScrollbarThemeWillNotCauseDCHECKFails) { | 11549 CustomScrollbarInOverlayScrollbarThemeWillNotCauseDCHECKFails) { |
11545 RegisterMockedHttpURLLoad( | 11550 RegisterMockedHttpURLLoad( |
11546 "custom-scrollbar-dcheck-failed-when-paint-scroll-corner.html"); | 11551 "custom-scrollbar-dcheck-failed-when-paint-scroll-corner.html"); |
11547 FrameTestHelpers::WebViewHelper web_view_helper; | 11552 FrameTestHelpers::WebViewHelper web_view_helper; |
11548 WebViewImpl* web_view = web_view_helper.InitializeAndLoad( | 11553 WebViewBase* web_view = web_view_helper.InitializeAndLoad( |
11549 base_url_ + | 11554 base_url_ + |
11550 "custom-scrollbar-dcheck-failed-when-paint-scroll-corner.html"); | 11555 "custom-scrollbar-dcheck-failed-when-paint-scroll-corner.html"); |
11551 | 11556 |
11552 web_view_helper.Resize(WebSize(200, 200)); | 11557 web_view_helper.Resize(WebSize(200, 200)); |
11553 | 11558 |
11554 // No DCHECK Fails. Issue 676678. | 11559 // No DCHECK Fails. Issue 676678. |
11555 web_view->UpdateAllLifecyclePhases(); | 11560 web_view->UpdateAllLifecyclePhases(); |
11556 } | 11561 } |
11557 | 11562 |
11558 static void DisableCompositing(WebSettings* settings) { | 11563 static void DisableCompositing(WebSettings* settings) { |
11559 settings->SetAcceleratedCompositingEnabled(false); | 11564 settings->SetAcceleratedCompositingEnabled(false); |
11560 settings->SetPreferCompositingToLCDTextEnabled(false); | 11565 settings->SetPreferCompositingToLCDTextEnabled(false); |
11561 } | 11566 } |
11562 | 11567 |
11563 // Make sure overlay scrollbars on non-composited scrollers fade out and set | 11568 // Make sure overlay scrollbars on non-composited scrollers fade out and set |
11564 // the hidden bit as needed. | 11569 // the hidden bit as needed. |
11565 TEST_F(WebFrameTest, TestNonCompositedOverlayScrollbarsFade) { | 11570 TEST_F(WebFrameTest, TestNonCompositedOverlayScrollbarsFade) { |
11566 FrameTestHelpers::WebViewHelper web_view_helper; | 11571 FrameTestHelpers::WebViewHelper web_view_helper; |
11567 WebViewImpl* web_view_impl = web_view_helper.Initialize( | 11572 WebViewBase* web_view_impl = web_view_helper.Initialize( |
11568 true, nullptr, nullptr, nullptr, &DisableCompositing); | 11573 true, nullptr, nullptr, nullptr, &DisableCompositing); |
11569 | 11574 |
11570 constexpr double kMockOverlayFadeOutDelayMs = 5.0; | 11575 constexpr double kMockOverlayFadeOutDelayMs = 5.0; |
11571 | 11576 |
11572 ScrollbarTheme& theme = ScrollbarTheme::GetTheme(); | 11577 ScrollbarTheme& theme = ScrollbarTheme::GetTheme(); |
11573 // This test relies on mock overlay scrollbars. | 11578 // This test relies on mock overlay scrollbars. |
11574 ASSERT_TRUE(theme.IsMockTheme()); | 11579 ASSERT_TRUE(theme.IsMockTheme()); |
11575 ASSERT_TRUE(theme.UsesOverlayScrollbars()); | 11580 ASSERT_TRUE(theme.UsesOverlayScrollbars()); |
11576 ScrollbarThemeOverlayMock& mock_overlay_theme = | 11581 ScrollbarThemeOverlayMock& mock_overlay_theme = |
11577 (ScrollbarThemeOverlayMock&)theme; | 11582 (ScrollbarThemeOverlayMock&)theme; |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11845 } | 11850 } |
11846 | 11851 |
11847 bool DidShowVirtualKeyboard() const { return did_show_virtual_keyboard_; } | 11852 bool DidShowVirtualKeyboard() const { return did_show_virtual_keyboard_; } |
11848 | 11853 |
11849 private: | 11854 private: |
11850 bool did_show_virtual_keyboard_; | 11855 bool did_show_virtual_keyboard_; |
11851 }; | 11856 }; |
11852 | 11857 |
11853 TEST_F(WebFrameTest, ShowVirtualKeyboardOnElementFocus) { | 11858 TEST_F(WebFrameTest, ShowVirtualKeyboardOnElementFocus) { |
11854 FrameTestHelpers::WebViewHelper web_view_helper; | 11859 FrameTestHelpers::WebViewHelper web_view_helper; |
11855 WebViewImpl* web_view = web_view_helper.Initialize(true); | 11860 WebViewBase* web_view = web_view_helper.Initialize(true); |
11856 WebRemoteFrameImpl* remote_frame = static_cast<WebRemoteFrameImpl*>( | 11861 WebRemoteFrameImpl* remote_frame = static_cast<WebRemoteFrameImpl*>( |
11857 WebRemoteFrame::Create(WebTreeScopeType::kDocument, nullptr)); | 11862 WebRemoteFrame::Create(WebTreeScopeType::kDocument, nullptr)); |
11858 web_view->SetMainFrame(remote_frame); | 11863 web_view->SetMainFrame(remote_frame); |
11859 RefPtr<SecurityOrigin> unique_origin = SecurityOrigin::CreateUnique(); | 11864 RefPtr<SecurityOrigin> unique_origin = SecurityOrigin::CreateUnique(); |
11860 remote_frame->GetFrame()->GetSecurityContext()->SetSecurityOrigin( | 11865 remote_frame->GetFrame()->GetSecurityContext()->SetSecurityOrigin( |
11861 unique_origin); | 11866 unique_origin); |
11862 | 11867 |
11863 ShowVirtualKeyboardObserverWidgetClient web_widget_client; | 11868 ShowVirtualKeyboardObserverWidgetClient web_widget_client; |
11864 WebLocalFrameImpl* local_frame = FrameTestHelpers::CreateLocalChild( | 11869 WebLocalFrameImpl* local_frame = FrameTestHelpers::CreateLocalChild( |
11865 remote_frame, "child", nullptr, &web_widget_client); | 11870 remote_frame, "child", nullptr, &web_widget_client); |
(...skipping 27 matching lines...) Expand all Loading... |
11893 WebContextMenuData GetMenuData() { return menu_data_; } | 11898 WebContextMenuData GetMenuData() { return menu_data_; } |
11894 | 11899 |
11895 private: | 11900 private: |
11896 WebContextMenuData menu_data_; | 11901 WebContextMenuData menu_data_; |
11897 DISALLOW_COPY_AND_ASSIGN(ContextMenuWebFrameClient); | 11902 DISALLOW_COPY_AND_ASSIGN(ContextMenuWebFrameClient); |
11898 }; | 11903 }; |
11899 | 11904 |
11900 bool TestSelectAll(const std::string& html) { | 11905 bool TestSelectAll(const std::string& html) { |
11901 ContextMenuWebFrameClient frame; | 11906 ContextMenuWebFrameClient frame; |
11902 FrameTestHelpers::WebViewHelper web_view_helper; | 11907 FrameTestHelpers::WebViewHelper web_view_helper; |
11903 WebViewImpl* web_view = web_view_helper.Initialize(true, &frame); | 11908 WebViewBase* web_view = web_view_helper.Initialize(true, &frame); |
11904 FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), html, | 11909 FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), html, |
11905 ToKURL("about:blank")); | 11910 ToKURL("about:blank")); |
11906 web_view->Resize(WebSize(500, 300)); | 11911 web_view->Resize(WebSize(500, 300)); |
11907 web_view->UpdateAllLifecyclePhases(); | 11912 web_view->UpdateAllLifecyclePhases(); |
11908 RunPendingTasks(); | 11913 RunPendingTasks(); |
11909 web_view->SetInitialFocus(false); | 11914 web_view->SetInitialFocus(false); |
11910 RunPendingTasks(); | 11915 RunPendingTasks(); |
11911 | 11916 |
11912 WebMouseEvent mouse_event(WebInputEvent::kMouseDown, | 11917 WebMouseEvent mouse_event(WebInputEvent::kMouseDown, |
11913 WebInputEvent::kNoModifiers, | 11918 WebInputEvent::kNoModifiers, |
(...skipping 14 matching lines...) Expand all Loading... |
11928 EXPECT_FALSE(TestSelectAll("<input>")); | 11933 EXPECT_FALSE(TestSelectAll("<input>")); |
11929 EXPECT_TRUE(TestSelectAll("<input value='nonempty'>")); | 11934 EXPECT_TRUE(TestSelectAll("<input value='nonempty'>")); |
11930 EXPECT_FALSE(TestSelectAll("<div contenteditable></div>")); | 11935 EXPECT_FALSE(TestSelectAll("<div contenteditable></div>")); |
11931 EXPECT_TRUE(TestSelectAll("<div contenteditable>nonempty</div>")); | 11936 EXPECT_TRUE(TestSelectAll("<div contenteditable>nonempty</div>")); |
11932 EXPECT_TRUE(TestSelectAll("<div contenteditable>\n</div>")); | 11937 EXPECT_TRUE(TestSelectAll("<div contenteditable>\n</div>")); |
11933 } | 11938 } |
11934 | 11939 |
11935 TEST_F(WebFrameTest, ContextMenuDataSelectedText) { | 11940 TEST_F(WebFrameTest, ContextMenuDataSelectedText) { |
11936 ContextMenuWebFrameClient frame; | 11941 ContextMenuWebFrameClient frame; |
11937 FrameTestHelpers::WebViewHelper web_view_helper; | 11942 FrameTestHelpers::WebViewHelper web_view_helper; |
11938 WebViewImpl* web_view = web_view_helper.Initialize(true, &frame); | 11943 WebViewBase* web_view = web_view_helper.Initialize(true, &frame); |
11939 const std::string& html = "<input value=' '>"; | 11944 const std::string& html = "<input value=' '>"; |
11940 FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), html, | 11945 FrameTestHelpers::LoadHTMLString(web_view->MainFrame(), html, |
11941 ToKURL("about:blank")); | 11946 ToKURL("about:blank")); |
11942 web_view->Resize(WebSize(500, 300)); | 11947 web_view->Resize(WebSize(500, 300)); |
11943 web_view->UpdateAllLifecyclePhases(); | 11948 web_view->UpdateAllLifecyclePhases(); |
11944 RunPendingTasks(); | 11949 RunPendingTasks(); |
11945 web_view->SetInitialFocus(false); | 11950 web_view->SetInitialFocus(false); |
11946 RunPendingTasks(); | 11951 RunPendingTasks(); |
11947 | 11952 |
11948 web_view->MainFrameImpl()->ExecuteCommand(WebString::FromUTF8("SelectAll")); | 11953 web_view->MainFrameImpl()->ExecuteCommand(WebString::FromUTF8("SelectAll")); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12037 | 12042 |
12038 // Failing the original child frame navigation and trying to render fallback | 12043 // Failing the original child frame navigation and trying to render fallback |
12039 // content shouldn't crash. It should return NoLoadInProgress. This is so the | 12044 // content shouldn't crash. It should return NoLoadInProgress. This is so the |
12040 // caller won't attempt to replace the correctly empty frame with an error | 12045 // caller won't attempt to replace the correctly empty frame with an error |
12041 // page. | 12046 // page. |
12042 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, | 12047 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, |
12043 child->MaybeRenderFallbackContent(WebURLError())); | 12048 child->MaybeRenderFallbackContent(WebURLError())); |
12044 } | 12049 } |
12045 | 12050 |
12046 } // namespace blink | 12051 } // namespace blink |
OLD | NEW |