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" |
11 #include "core/frame/FrameView.h" | 11 #include "core/frame/FrameView.h" |
12 #include "core/frame/LocalFrame.h" | 12 #include "core/frame/LocalFrame.h" |
13 #include "core/html/HTMLDocument.h" | 13 #include "core/html/HTMLDocument.h" |
14 #include "core/page/AutoscrollController.h" | 14 #include "core/page/AutoscrollController.h" |
15 #include "core/page/Page.h" | 15 #include "core/page/Page.h" |
16 #include "core/testing/DummyPageHolder.h" | 16 #include "core/testing/DummyPageHolder.h" |
17 #include "platform/PlatformMouseEvent.h" | 17 #include "platform/PlatformMouseEvent.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 19 #include <memory> |
19 | 20 |
20 namespace blink { | 21 namespace blink { |
21 | 22 |
22 class EventHandlerTest : public ::testing::Test { | 23 class EventHandlerTest : public ::testing::Test { |
23 protected: | 24 protected: |
24 void SetUp() override; | 25 void SetUp() override; |
25 | 26 |
26 Page& page() const { return m_dummyPageHolder->page(); } | 27 Page& page() const { return m_dummyPageHolder->page(); } |
27 Document& document() const { return m_dummyPageHolder->document(); } | 28 Document& document() const { return m_dummyPageHolder->document(); } |
28 | 29 |
29 void setHtmlInnerHTML(const char* htmlContent); | 30 void setHtmlInnerHTML(const char* htmlContent); |
30 | 31 |
31 private: | 32 private: |
32 OwnPtr<DummyPageHolder> m_dummyPageHolder; | 33 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; |
33 }; | 34 }; |
34 | 35 |
35 class TapEventBuilder : public PlatformGestureEvent { | 36 class TapEventBuilder : public PlatformGestureEvent { |
36 public: | 37 public: |
37 TapEventBuilder(IntPoint position, int tapCount) | 38 TapEventBuilder(IntPoint position, int tapCount) |
38 : PlatformGestureEvent(PlatformEvent::GestureTap, | 39 : PlatformGestureEvent(PlatformEvent::GestureTap, |
39 position, | 40 position, |
40 position, | 41 position, |
41 IntSize(5, 5), | 42 IntSize(5, 5), |
42 WTF::monotonicallyIncreasingTime(), | 43 WTF::monotonicallyIncreasingTime(), |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 PlatformEvent::MouseMoved, | 235 PlatformEvent::MouseMoved, |
235 1, | 236 1, |
236 PlatformEvent::Modifiers::LeftButtonDown, | 237 PlatformEvent::Modifiers::LeftButtonDown, |
237 WTF::monotonicallyIncreasingTime()); | 238 WTF::monotonicallyIncreasingTime()); |
238 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); | 239 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); |
239 | 240 |
240 EXPECT_EQ(IntPoint(45, 44), document().frame()->eventHandler().dragDataTrans
ferLocationForTesting()); | 241 EXPECT_EQ(IntPoint(45, 44), document().frame()->eventHandler().dragDataTrans
ferLocationForTesting()); |
241 } | 242 } |
242 | 243 |
243 } // namespace blink | 244 } // namespace blink |
OLD | NEW |