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