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 15 matching lines...) Expand all Loading... |
26 | 26 |
27 Page& page() const { return m_dummyPageHolder->page(); } | 27 Page& page() const { return m_dummyPageHolder->page(); } |
28 Document& document() const { return m_dummyPageHolder->document(); } | 28 Document& document() const { return m_dummyPageHolder->document(); } |
29 | 29 |
30 void setHtmlInnerHTML(const char* htmlContent); | 30 void setHtmlInnerHTML(const char* htmlContent); |
31 | 31 |
32 private: | 32 private: |
33 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; | 33 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; |
34 }; | 34 }; |
35 | 35 |
36 class TapEventBuilder : public PlatformGestureEvent { | 36 class TapEventBuilder : public WebGestureEvent { |
37 public: | 37 public: |
38 TapEventBuilder(IntPoint position, int tapCount) | 38 TapEventBuilder(IntPoint position, int tapCount) : WebGestureEvent() { |
39 : PlatformGestureEvent(PlatformEvent::GestureTap, | 39 type = WebInputEvent::GestureTap; |
40 position, | 40 x = globalX = position.x(); |
41 position, | 41 y = globalY = position.y(); |
42 IntSize(5, 5), | 42 timeStampSeconds = TimeTicks::Now().InSeconds(); |
43 TimeTicks::Now(), | 43 sourceDevice = WebGestureDeviceTouchscreen; |
44 static_cast<PlatformEvent::Modifiers>(0), | 44 data.tap.tapCount = tapCount; |
45 PlatformGestureSourceTouchscreen) { | 45 data.tap.width = 5; |
46 m_data.m_tap.m_tapCount = tapCount; | 46 data.tap.height = 5; |
47 } | 47 } |
48 }; | 48 }; |
49 | 49 |
50 void EventHandlerTest::SetUp() { | 50 void EventHandlerTest::SetUp() { |
51 m_dummyPageHolder = DummyPageHolder::create(IntSize(300, 400)); | 51 m_dummyPageHolder = DummyPageHolder::create(IntSize(300, 400)); |
52 } | 52 } |
53 | 53 |
54 void EventHandlerTest::setHtmlInnerHTML(const char* htmlContent) { | 54 void EventHandlerTest::setHtmlInnerHTML(const char* htmlContent) { |
55 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent)); | 55 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent)); |
56 document().view()->updateAllLifecyclePhases(); | 56 document().view()->updateAllLifecyclePhases(); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 PlatformMouseEvent mouseDownEvent( | 249 PlatformMouseEvent mouseDownEvent( |
250 IntPoint(0, 0), IntPoint(100, 200), WebPointerProperties::Button::Right, | 250 IntPoint(0, 0), IntPoint(100, 200), WebPointerProperties::Button::Right, |
251 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::RightButtonDown, | 251 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::RightButtonDown, |
252 TimeTicks::Now()); | 252 TimeTicks::Now()); |
253 EXPECT_EQ( | 253 EXPECT_EQ( |
254 WebInputEventResult::HandledApplication, | 254 WebInputEventResult::HandledApplication, |
255 document().frame()->eventHandler().sendContextMenuEvent(mouseDownEvent)); | 255 document().frame()->eventHandler().sendContextMenuEvent(mouseDownEvent)); |
256 } | 256 } |
257 | 257 |
258 } // namespace blink | 258 } // namespace blink |
OLD | NEW |