| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/input/EventHandler.h" | 5 #include "core/input/EventHandler.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/Range.h" | 8 #include "core/dom/Range.h" |
| 9 #include "core/editing/Editor.h" | 9 #include "core/editing/Editor.h" |
| 10 #include "core/editing/FrameSelection.h" | 10 #include "core/editing/FrameSelection.h" |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 | 375 |
| 376 MousePressEventBuilder tripleClickMousePressEvent( | 376 MousePressEventBuilder tripleClickMousePressEvent( |
| 377 IntPoint(200, 200), 3, WebPointerProperties::Button::Left); | 377 IntPoint(200, 200), 3, WebPointerProperties::Button::Left); |
| 378 document().frame()->eventHandler().handleMousePressEvent( | 378 document().frame()->eventHandler().handleMousePressEvent( |
| 379 tripleClickMousePressEvent); | 379 tripleClickMousePressEvent); |
| 380 | 380 |
| 381 ASSERT_TRUE(selection().isRange()); | 381 ASSERT_TRUE(selection().isRange()); |
| 382 ASSERT_FALSE(selection().isHandleVisible()); | 382 ASSERT_FALSE(selection().isHandleVisible()); |
| 383 } | 383 } |
| 384 | 384 |
| 385 TEST_F(EventHandlerTest, dragEndInNewDrag) { |
| 386 setHtmlInnerHTML( |
| 387 "<style>.box { width: 100px; height: 100px; display: block; }</style>" |
| 388 "<a class='box' href=''>Drag me</a>"); |
| 389 |
| 390 PlatformMouseEvent mouseDownEvent( |
| 391 IntPoint(50, 50), IntPoint(50, 50), WebPointerProperties::Button::Left, |
| 392 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::LeftButtonDown, |
| 393 TimeTicks::Now()); |
| 394 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); |
| 395 |
| 396 PlatformMouseEvent mouseMoveEvent( |
| 397 IntPoint(51, 50), IntPoint(51, 50), WebPointerProperties::Button::Left, |
| 398 PlatformEvent::MouseMoved, 1, PlatformEvent::Modifiers::LeftButtonDown, |
| 399 TimeTicks::Now()); |
| 400 document().frame()->eventHandler().handleMouseMoveEvent( |
| 401 mouseMoveEvent, Vector<PlatformMouseEvent>()); |
| 402 |
| 403 // This reproduces what might be the conditions of http://crbug.com/677916 |
| 404 // |
| 405 // TODO(crbug.com/682047): The call sequence below should not occur outside |
| 406 // this contrived test. Given the current code, it is unclear how the |
| 407 // dragSourceEndedAt() call could occur before a drag operation is started. |
| 408 |
| 409 PlatformMouseEvent mouseUpEvent( |
| 410 IntPoint(100, 50), IntPoint(200, 250), WebPointerProperties::Button::Left, |
| 411 PlatformEvent::MouseReleased, 1, static_cast<PlatformEvent::Modifiers>(0), |
| 412 TimeTicks::Now()); |
| 413 document().frame()->eventHandler().dragSourceEndedAt(mouseUpEvent, |
| 414 DragOperationNone); |
| 415 |
| 416 // This test passes if it doesn't crash. |
| 417 } |
| 418 |
| 385 } // namespace blink | 419 } // namespace blink |
| OLD | NEW |