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(), kTouchActionAuto); | 68 nullptr, nullptr, "touchstart", &Window(), |
| 69 kTouchActionAuto); |
69 } | 70 } |
70 | 71 |
71 private: | 72 private: |
72 Persistent<ConsoleCapturingChromeClient> chrome_client_; | 73 Persistent<ConsoleCapturingChromeClient> chrome_client_; |
73 std::unique_ptr<DummyPageHolder> page_holder_; | 74 std::unique_ptr<DummyPageHolder> page_holder_; |
74 }; | 75 }; |
75 | 76 |
76 TEST_F(TouchEventTest, PreventDefaultUncancelable) { | 77 TEST_F(TouchEventTest, PreventDefaultUncancelable) { |
77 TouchEvent* event = EventWithDispatchType(WebInputEvent::kEventNonBlocking); | 78 TouchEvent* event = EventWithDispatchType(WebInputEvent::kEventNonBlocking); |
78 event->SetHandlingPassive(Event::PassiveMode::kNotPassiveDefault); | 79 event->SetHandlingPassive(Event::PassiveMode::kNotPassiveDefault); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 EXPECT_THAT(MessageSources(), ElementsAre(kInterventionMessageSource)); | 133 EXPECT_THAT(MessageSources(), ElementsAre(kInterventionMessageSource)); |
133 } | 134 } |
134 | 135 |
135 class TouchEventTestNoFrame : public testing::Test {}; | 136 class TouchEventTestNoFrame : public testing::Test {}; |
136 | 137 |
137 TEST_F(TouchEventTestNoFrame, PreventDefaultDoesntRequireFrame) { | 138 TEST_F(TouchEventTestNoFrame, PreventDefaultDoesntRequireFrame) { |
138 TouchEvent::Create()->preventDefault(); | 139 TouchEvent::Create()->preventDefault(); |
139 } | 140 } |
140 | 141 |
141 } // namespace blink | 142 } // namespace blink |
OLD | NEW |