Chromium Code Reviews| Index: Source/web/tests/WebFrameTest.cpp |
| diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp |
| index 6aabe29e466f9ba39b422a8a24f7abdd0228c811..5b5f5b2e3e235fc904937ab79e953056478955d3 100644 |
| --- a/Source/web/tests/WebFrameTest.cpp |
| +++ b/Source/web/tests/WebFrameTest.cpp |
| @@ -4235,6 +4235,59 @@ TEST_F(WebFrameTest, MoveCaretStaysHorizontallyAlignedWhenMoved) |
| } |
| #endif |
| +TEST_F(WebFrameTest, dragSelectionAfterScroll) |
|
tkent
2015/05/25 23:57:25
Can you make EventHandlerTest.cpp or SelectionCont
Miyoung Shin(g)
2015/05/31 14:01:13
I made EventHandlerTest.cpp for the validation of
|
| +{ |
| + WebLocalFrameImpl* frame; |
| + registerMockedHttpURLLoad("drag_selection.html"); |
| + |
| + FrameTestHelpers::WebViewHelper webViewHelper; |
| + initializeTextSelectionWebView(m_baseURL + "drag_selection.html", &webViewHelper); |
| + frame = (WebLocalFrameImpl*)webViewHelper.webView()->mainFrame(); |
| + |
| + webViewHelper.webView()->resize(WebSize(300, 400)); |
| + webViewHelper.webView()->layout(); |
| + |
| + // Scroll main frame to the bottom of the document |
| + WebViewImpl* webViewImpl = webViewHelper.webViewImpl(); |
| + ASSERT_TRUE(webViewImpl); |
| + webViewImpl->setMainFrameScrollOffset(WebPoint(0, 400)); |
| + EXPECT_POINT_EQ(IntPoint(0, 400), webViewImpl->mainFrameImpl()->frameView()->scrollPosition()); |
| + |
| + WebMouseEvent mouseDownEvent; |
| + mouseDownEvent.type = WebInputEvent::MouseDown; |
| + mouseDownEvent.x = 0; |
| + mouseDownEvent.y = 0; |
| + mouseDownEvent.windowX = 0; |
| + mouseDownEvent.windowY = 0; |
| + mouseDownEvent.globalX = 100; |
| + mouseDownEvent.globalY = 200; |
| + mouseDownEvent.clickCount = 1; |
| + mouseDownEvent.button = WebMouseEvent::ButtonLeft; |
| + |
| + WebMouseEvent mouseMoveEvent(mouseDownEvent); |
| + mouseMoveEvent.type = WebInputEvent::MouseMove; |
| + mouseMoveEvent.x = 100; |
| + mouseMoveEvent.y = 50; |
| + mouseMoveEvent.windowX = 100; |
| + mouseMoveEvent.windowY = 50; |
| + mouseMoveEvent.globalX = 200; |
| + mouseMoveEvent.globalY = 250; |
| + |
| + WebMouseEvent mouseUpEvent(mouseMoveEvent); |
| + mouseUpEvent.type = WebInputEvent::MouseUp; |
| + |
| + webViewHelper.webView()->handleInputEvent(mouseDownEvent); |
| + webViewHelper.webView()->handleInputEvent(mouseMoveEvent); |
| + |
| + // update the selection from beginFrame |
| + WebBeginFrameArgs frameTime(0, 1, 0); |
| + webViewImpl->beginFrame(frameTime); |
| + |
| + webViewHelper.webView()->handleInputEvent(mouseUpEvent); |
| + |
| + EXPECT_EQ("Line 1\nLine 2", selectionAsString(frame)); |
| +} |
| + |
| class CompositedSelectionBoundsTestLayerTreeView : public WebLayerTreeView { |
| public: |
| CompositedSelectionBoundsTestLayerTreeView() : m_selectionCleared(false) { } |