OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/events/TouchEvent.h" | 5 #include "core/events/TouchEvent.h" |
6 | 6 |
7 #include "core/frame/FrameConsole.h" | 7 #include "core/frame/FrameConsole.h" |
8 #include "core/frame/UseCounter.h" | 8 #include "core/frame/UseCounter.h" |
9 #include "core/loader/EmptyClients.h" | 9 #include "core/loader/EmptyClients.h" |
10 #include "core/testing/DummyPageHolder.h" | 10 #include "core/testing/DummyPageHolder.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 return chrome_client_->MessageSources(); | 57 return chrome_client_->MessageSources(); |
58 } | 58 } |
59 | 59 |
60 LocalDOMWindow& Window() { return *page_holder_->GetFrame().DomWindow(); } | 60 LocalDOMWindow& Window() { return *page_holder_->GetFrame().DomWindow(); } |
61 | 61 |
62 Document& GetDocument() { return page_holder_->GetDocument(); } | 62 Document& GetDocument() { return page_holder_->GetDocument(); } |
63 | 63 |
64 TouchEvent* EventWithDispatchType(WebInputEvent::DispatchType dispatch_type) { | 64 TouchEvent* EventWithDispatchType(WebInputEvent::DispatchType dispatch_type) { |
65 WebTouchEvent web_touch_event(WebInputEvent::kTouchStart, 0, 0); | 65 WebTouchEvent web_touch_event(WebInputEvent::kTouchStart, 0, 0); |
66 web_touch_event.dispatch_type = dispatch_type; | 66 web_touch_event.dispatch_type = dispatch_type; |
67 return TouchEvent::Create(web_touch_event, nullptr, nullptr, nullptr, | 67 return TouchEvent::Create(WebCoalescedInputEvent(web_touch_event), nullptr, |
68 "touchstart", &Window(), | 68 nullptr, nullptr, "touchstart", &Window(), |
69 TouchAction::kTouchActionAuto); | 69 TouchAction::kTouchActionAuto); |
70 } | 70 } |
71 | 71 |
72 private: | 72 private: |
73 Persistent<ConsoleCapturingChromeClient> chrome_client_; | 73 Persistent<ConsoleCapturingChromeClient> chrome_client_; |
74 std::unique_ptr<DummyPageHolder> page_holder_; | 74 std::unique_ptr<DummyPageHolder> page_holder_; |
75 }; | 75 }; |
76 | 76 |
77 TEST_F(TouchEventTest, PreventDefaultUncancelable) { | 77 TEST_F(TouchEventTest, PreventDefaultUncancelable) { |
78 TouchEvent* event = EventWithDispatchType(WebInputEvent::kEventNonBlocking); | 78 TouchEvent* event = EventWithDispatchType(WebInputEvent::kEventNonBlocking); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 EXPECT_THAT(MessageSources(), ElementsAre(kInterventionMessageSource)); | 133 EXPECT_THAT(MessageSources(), ElementsAre(kInterventionMessageSource)); |
134 } | 134 } |
135 | 135 |
136 class TouchEventTestNoFrame : public testing::Test {}; | 136 class TouchEventTestNoFrame : public testing::Test {}; |
137 | 137 |
138 TEST_F(TouchEventTestNoFrame, PreventDefaultDoesntRequireFrame) { | 138 TEST_F(TouchEventTestNoFrame, PreventDefaultDoesntRequireFrame) { |
139 TouchEvent::Create()->preventDefault(); | 139 TouchEvent::Create()->preventDefault(); |
140 } | 140 } |
141 | 141 |
142 } // namespace blink | 142 } // namespace blink |
OLD | NEW |