Chromium Code Reviews| 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 4217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4228 EXPECT_EQ(endRect, initialEndRect); | 4228 EXPECT_EQ(endRect, initialEndRect); |
| 4229 | 4229 |
| 4230 moveTo.y -= 80; | 4230 moveTo.y -= 80; |
| 4231 frame->moveCaretSelection(moveTo); | 4231 frame->moveCaretSelection(moveTo); |
| 4232 webViewHelper.webView()->selectionBounds(startRect, endRect); | 4232 webViewHelper.webView()->selectionBounds(startRect, endRect); |
| 4233 EXPECT_EQ(startRect, initialStartRect); | 4233 EXPECT_EQ(startRect, initialStartRect); |
| 4234 EXPECT_EQ(endRect, initialEndRect); | 4234 EXPECT_EQ(endRect, initialEndRect); |
| 4235 } | 4235 } |
| 4236 #endif | 4236 #endif |
| 4237 | 4237 |
| 4238 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
| |
| 4239 { | |
| 4240 WebLocalFrameImpl* frame; | |
| 4241 registerMockedHttpURLLoad("drag_selection.html"); | |
| 4242 | |
| 4243 FrameTestHelpers::WebViewHelper webViewHelper; | |
| 4244 initializeTextSelectionWebView(m_baseURL + "drag_selection.html", &webViewHe lper); | |
| 4245 frame = (WebLocalFrameImpl*)webViewHelper.webView()->mainFrame(); | |
| 4246 | |
| 4247 webViewHelper.webView()->resize(WebSize(300, 400)); | |
| 4248 webViewHelper.webView()->layout(); | |
| 4249 | |
| 4250 // Scroll main frame to the bottom of the document | |
| 4251 WebViewImpl* webViewImpl = webViewHelper.webViewImpl(); | |
| 4252 ASSERT_TRUE(webViewImpl); | |
| 4253 webViewImpl->setMainFrameScrollOffset(WebPoint(0, 400)); | |
| 4254 EXPECT_POINT_EQ(IntPoint(0, 400), webViewImpl->mainFrameImpl()->frameView()- >scrollPosition()); | |
| 4255 | |
| 4256 WebMouseEvent mouseDownEvent; | |
| 4257 mouseDownEvent.type = WebInputEvent::MouseDown; | |
| 4258 mouseDownEvent.x = 0; | |
| 4259 mouseDownEvent.y = 0; | |
| 4260 mouseDownEvent.windowX = 0; | |
| 4261 mouseDownEvent.windowY = 0; | |
| 4262 mouseDownEvent.globalX = 100; | |
| 4263 mouseDownEvent.globalY = 200; | |
| 4264 mouseDownEvent.clickCount = 1; | |
| 4265 mouseDownEvent.button = WebMouseEvent::ButtonLeft; | |
| 4266 | |
| 4267 WebMouseEvent mouseMoveEvent(mouseDownEvent); | |
| 4268 mouseMoveEvent.type = WebInputEvent::MouseMove; | |
| 4269 mouseMoveEvent.x = 100; | |
| 4270 mouseMoveEvent.y = 50; | |
| 4271 mouseMoveEvent.windowX = 100; | |
| 4272 mouseMoveEvent.windowY = 50; | |
| 4273 mouseMoveEvent.globalX = 200; | |
| 4274 mouseMoveEvent.globalY = 250; | |
| 4275 | |
| 4276 WebMouseEvent mouseUpEvent(mouseMoveEvent); | |
| 4277 mouseUpEvent.type = WebInputEvent::MouseUp; | |
| 4278 | |
| 4279 webViewHelper.webView()->handleInputEvent(mouseDownEvent); | |
| 4280 webViewHelper.webView()->handleInputEvent(mouseMoveEvent); | |
| 4281 | |
| 4282 // update the selection from beginFrame | |
| 4283 WebBeginFrameArgs frameTime(0, 1, 0); | |
| 4284 webViewImpl->beginFrame(frameTime); | |
| 4285 | |
| 4286 webViewHelper.webView()->handleInputEvent(mouseUpEvent); | |
| 4287 | |
| 4288 EXPECT_EQ("Line 1\nLine 2", selectionAsString(frame)); | |
| 4289 } | |
| 4290 | |
| 4238 class CompositedSelectionBoundsTestLayerTreeView : public WebLayerTreeView { | 4291 class CompositedSelectionBoundsTestLayerTreeView : public WebLayerTreeView { |
| 4239 public: | 4292 public: |
| 4240 CompositedSelectionBoundsTestLayerTreeView() : m_selectionCleared(false) { } | 4293 CompositedSelectionBoundsTestLayerTreeView() : m_selectionCleared(false) { } |
| 4241 virtual ~CompositedSelectionBoundsTestLayerTreeView() { } | 4294 virtual ~CompositedSelectionBoundsTestLayerTreeView() { } |
| 4242 | 4295 |
| 4243 virtual void setRootLayer(const WebLayer&) override { } | 4296 virtual void setRootLayer(const WebLayer&) override { } |
| 4244 virtual void clearRootLayer() override { } | 4297 virtual void clearRootLayer() override { } |
| 4245 virtual void setViewportSize(const WebSize& deviceViewportSize) override { } | 4298 virtual void setViewportSize(const WebSize& deviceViewportSize) override { } |
| 4246 virtual WebSize deviceViewportSize() const override { return WebSize(); } | 4299 virtual WebSize deviceViewportSize() const override { return WebSize(); } |
| 4247 virtual void setDeviceScaleFactor(float) override { } | 4300 virtual void setDeviceScaleFactor(float) override { } |
| (...skipping 3175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7423 | 7476 |
| 7424 EXPECT_EQ(parent, firstFrame->parent()); | 7477 EXPECT_EQ(parent, firstFrame->parent()); |
| 7425 EXPECT_EQ(parent, secondFrame->parent()); | 7478 EXPECT_EQ(parent, secondFrame->parent()); |
| 7426 EXPECT_EQ(parent, thirdFrame->parent()); | 7479 EXPECT_EQ(parent, thirdFrame->parent()); |
| 7427 EXPECT_EQ(parent, fourthFrame->parent()); | 7480 EXPECT_EQ(parent, fourthFrame->parent()); |
| 7428 | 7481 |
| 7429 view->close(); | 7482 view->close(); |
| 7430 } | 7483 } |
| 7431 | 7484 |
| 7432 } // namespace blink | 7485 } // namespace blink |
| OLD | NEW |