Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: third_party/WebKit/Source/core/events/PointerEventFactoryTest.cpp

Issue 2655873003: Remove PlatformEvent it is no longer used. (Closed)
Patch Set: Remove PlatformEvent it is no longer used. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/events/PointerEventFactory.h" 5 #include "core/events/PointerEventFactory.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/page/Page.h" 8 #include "core/page/Page.h"
9 #include "public/platform/WebPointerProperties.h" 9 #include "public/platform/WebPointerProperties.h"
10 #include <climits> 10 #include <climits>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 int rawId, 44 int rawId,
45 int uniqueId, 45 int uniqueId,
46 bool isPrimary, 46 bool isPrimary,
47 WebTouchPoint::State = WebTouchPoint::StatePressed, 47 WebTouchPoint::State = WebTouchPoint::StatePressed,
48 size_t coalescedEventCount = 0); 48 size_t coalescedEventCount = 0);
49 PointerEvent* createAndCheckMouseEvent( 49 PointerEvent* createAndCheckMouseEvent(
50 WebPointerProperties::PointerType, 50 WebPointerProperties::PointerType,
51 int rawId, 51 int rawId,
52 int uniqueId, 52 int uniqueId,
53 bool isPrimary, 53 bool isPrimary,
54 PlatformEvent::Modifiers = PlatformEvent::NoModifiers, 54 WebInputEvent::Modifiers = WebInputEvent::NoModifiers,
55 size_t coalescedEventCount = 0); 55 size_t coalescedEventCount = 0);
56 void createAndCheckPointerTransitionEvent(PointerEvent*, const AtomicString&); 56 void createAndCheckPointerTransitionEvent(PointerEvent*, const AtomicString&);
57 57
58 PointerEventFactory m_pointerEventFactory; 58 PointerEventFactory m_pointerEventFactory;
59 unsigned m_expectedMouseId; 59 unsigned m_expectedMouseId;
60 unsigned m_mappedIdStart; 60 unsigned m_mappedIdStart;
61 61
62 class WebTouchPointBuilder : public WebTouchPoint { 62 class WebTouchPointBuilder : public WebTouchPoint {
63 public: 63 public:
64 WebTouchPointBuilder(WebPointerProperties::PointerType, 64 WebTouchPointBuilder(WebPointerProperties::PointerType,
65 int, 65 int,
66 WebTouchPoint::State); 66 WebTouchPoint::State);
67 }; 67 };
68 68
69 class WebMouseEventBuilder : public WebMouseEvent { 69 class WebMouseEventBuilder : public WebMouseEvent {
70 public: 70 public:
71 WebMouseEventBuilder(WebPointerProperties::PointerType, 71 WebMouseEventBuilder(WebPointerProperties::PointerType,
72 int, 72 int,
73 PlatformEvent::Modifiers); 73 WebInputEvent::Modifiers);
74 }; 74 };
75 }; 75 };
76 76
77 void PointerEventFactoryTest::SetUp() { 77 void PointerEventFactoryTest::SetUp() {
78 m_expectedMouseId = 1; 78 m_expectedMouseId = 1;
79 m_mappedIdStart = 2; 79 m_mappedIdStart = 2;
80 } 80 }
81 81
82 PointerEventFactoryTest::WebTouchPointBuilder::WebTouchPointBuilder( 82 PointerEventFactoryTest::WebTouchPointBuilder::WebTouchPointBuilder(
83 WebPointerProperties::PointerType pointerTypeParam, 83 WebPointerProperties::PointerType pointerTypeParam,
84 int idParam, 84 int idParam,
85 WebTouchPoint::State stateParam) { 85 WebTouchPoint::State stateParam) {
86 id = idParam; 86 id = idParam;
87 pointerType = pointerTypeParam; 87 pointerType = pointerTypeParam;
88 force = 1.0; 88 force = 1.0;
89 state = stateParam; 89 state = stateParam;
90 } 90 }
91 91
92 PointerEventFactoryTest::WebMouseEventBuilder::WebMouseEventBuilder( 92 PointerEventFactoryTest::WebMouseEventBuilder::WebMouseEventBuilder(
93 WebPointerProperties::PointerType pointerTypeParam, 93 WebPointerProperties::PointerType pointerTypeParam,
94 int idParam, 94 int idParam,
95 PlatformEvent::Modifiers modifiersParam) { 95 WebInputEvent::Modifiers modifiersParam) {
96 pointerType = pointerTypeParam; 96 pointerType = pointerTypeParam;
97 id = idParam; 97 id = idParam;
98 m_modifiers = modifiersParam; 98 m_modifiers = modifiersParam;
99 } 99 }
100 100
101 PointerEvent* PointerEventFactoryTest::createAndCheckTouchCancel( 101 PointerEvent* PointerEventFactoryTest::createAndCheckTouchCancel(
102 WebPointerProperties::PointerType pointerType, 102 WebPointerProperties::PointerType pointerType,
103 int rawId, 103 int rawId,
104 int uniqueId, 104 int uniqueId,
105 bool isPrimary) { 105 bool isPrimary) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 EXPECT_EQ(expectedPointerType, pointerEvent->pointerType()); 151 EXPECT_EQ(expectedPointerType, pointerEvent->pointerType());
152 } 152 }
153 return pointerEvent; 153 return pointerEvent;
154 } 154 }
155 155
156 PointerEvent* PointerEventFactoryTest::createAndCheckMouseEvent( 156 PointerEvent* PointerEventFactoryTest::createAndCheckMouseEvent(
157 WebPointerProperties::PointerType pointerType, 157 WebPointerProperties::PointerType pointerType,
158 int rawId, 158 int rawId,
159 int uniqueId, 159 int uniqueId,
160 bool isPrimary, 160 bool isPrimary,
161 PlatformEvent::Modifiers modifiers, 161 WebInputEvent::Modifiers modifiers,
162 size_t coalescedEventCount) { 162 size_t coalescedEventCount) {
163 Vector<WebMouseEvent> coalescedEvents; 163 Vector<WebMouseEvent> coalescedEvents;
164 for (size_t i = 0; i < coalescedEventCount; i++) { 164 for (size_t i = 0; i < coalescedEventCount; i++) {
165 coalescedEvents.push_back(PointerEventFactoryTest::WebMouseEventBuilder( 165 coalescedEvents.push_back(PointerEventFactoryTest::WebMouseEventBuilder(
166 pointerType, rawId, modifiers)); 166 pointerType, rawId, modifiers));
167 } 167 }
168 PointerEvent* pointerEvent = m_pointerEventFactory.create( 168 PointerEvent* pointerEvent = m_pointerEventFactory.create(
169 coalescedEventCount ? EventTypeNames::mousemove 169 coalescedEventCount ? EventTypeNames::mousemove
170 : EventTypeNames::mousedown, 170 : EventTypeNames::mousedown,
171 PointerEventFactoryTest::WebMouseEventBuilder(pointerType, rawId, 171 PointerEventFactoryTest::WebMouseEventBuilder(pointerType, rawId,
(...skipping 14 matching lines...) Expand all
186 } 186 }
187 187
188 TEST_F(PointerEventFactoryTest, MousePointer) { 188 TEST_F(PointerEventFactoryTest, MousePointer) {
189 EXPECT_TRUE(m_pointerEventFactory.isActive(m_expectedMouseId)); 189 EXPECT_TRUE(m_pointerEventFactory.isActive(m_expectedMouseId));
190 EXPECT_FALSE(m_pointerEventFactory.isActiveButtonsState(m_expectedMouseId)); 190 EXPECT_FALSE(m_pointerEventFactory.isActiveButtonsState(m_expectedMouseId));
191 191
192 PointerEvent* pointerEvent1 = createAndCheckMouseEvent( 192 PointerEvent* pointerEvent1 = createAndCheckMouseEvent(
193 WebPointerProperties::PointerType::Mouse, 0, m_expectedMouseId, true); 193 WebPointerProperties::PointerType::Mouse, 0, m_expectedMouseId, true);
194 PointerEvent* pointerEvent2 = createAndCheckMouseEvent( 194 PointerEvent* pointerEvent2 = createAndCheckMouseEvent(
195 WebPointerProperties::PointerType::Mouse, 0, m_expectedMouseId, true, 195 WebPointerProperties::PointerType::Mouse, 0, m_expectedMouseId, true,
196 PlatformEvent::LeftButtonDown); 196 WebInputEvent::LeftButtonDown);
197 197
198 createAndCheckPointerTransitionEvent(pointerEvent1, 198 createAndCheckPointerTransitionEvent(pointerEvent1,
199 EventTypeNames::pointerout); 199 EventTypeNames::pointerout);
200 200
201 EXPECT_TRUE(m_pointerEventFactory.isActive(m_expectedMouseId)); 201 EXPECT_TRUE(m_pointerEventFactory.isActive(m_expectedMouseId));
202 EXPECT_TRUE(m_pointerEventFactory.isActiveButtonsState(m_expectedMouseId)); 202 EXPECT_TRUE(m_pointerEventFactory.isActiveButtonsState(m_expectedMouseId));
203 203
204 m_pointerEventFactory.remove(pointerEvent1->pointerId()); 204 m_pointerEventFactory.remove(pointerEvent1->pointerId());
205 205
206 EXPECT_TRUE(m_pointerEventFactory.isActive(m_expectedMouseId)); 206 EXPECT_TRUE(m_pointerEventFactory.isActive(m_expectedMouseId));
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 for (int i = 0; i < 100; ++i) { 437 for (int i = 0; i < 100; ++i) {
438 createAndCheckTouchEvent(WebPointerProperties::PointerType::Mouse, i, 438 createAndCheckTouchEvent(WebPointerProperties::PointerType::Mouse, i,
439 m_expectedMouseId, true); 439 m_expectedMouseId, true);
440 } 440 }
441 createAndCheckTouchCancel(WebPointerProperties::PointerType::Mouse, 0, 441 createAndCheckTouchCancel(WebPointerProperties::PointerType::Mouse, 0,
442 m_expectedMouseId, true); 442 m_expectedMouseId, true);
443 } 443 }
444 444
445 TEST_F(PointerEventFactoryTest, CoalescedEvents) { 445 TEST_F(PointerEventFactoryTest, CoalescedEvents) {
446 createAndCheckMouseEvent(WebPointerProperties::PointerType::Mouse, 0, 446 createAndCheckMouseEvent(WebPointerProperties::PointerType::Mouse, 0,
447 m_expectedMouseId, true, PlatformEvent::NoModifiers, 447 m_expectedMouseId, true, WebInputEvent::NoModifiers,
448 4); 448 4);
449 createAndCheckTouchEvent(WebPointerProperties::PointerType::Touch, 0, 449 createAndCheckTouchEvent(WebPointerProperties::PointerType::Touch, 0,
450 m_mappedIdStart, true, WebTouchPoint::StateMoved, 3); 450 m_mappedIdStart, true, WebTouchPoint::StateMoved, 3);
451 } 451 }
452 452
453 } // namespace blink 453 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698