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/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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 EXPECT_EQ(clonePointerEvent->type(), type); | 100 EXPECT_EQ(clonePointerEvent->type(), type); |
101 } | 101 } |
102 | 102 |
103 PointerEvent* PointerEventFactoryTest::createAndCheckTouchEvent( | 103 PointerEvent* PointerEventFactoryTest::createAndCheckTouchEvent( |
104 WebPointerProperties::PointerType pointerType, | 104 WebPointerProperties::PointerType pointerType, |
105 int rawId, | 105 int rawId, |
106 int uniqueId, | 106 int uniqueId, |
107 bool isPrimary, | 107 bool isPrimary, |
108 PlatformTouchPoint::TouchState state) { | 108 PlatformTouchPoint::TouchState state) { |
109 PointerEvent* pointerEvent = m_pointerEventFactory.create( | 109 PointerEvent* pointerEvent = m_pointerEventFactory.create( |
110 EventTypeNames::pointerdown, | |
111 PointerEventFactoryTest::PlatformTouchPointBuilder(pointerType, rawId, | 110 PointerEventFactoryTest::PlatformTouchPointBuilder(pointerType, rawId, |
112 state), | 111 state), |
113 PlatformEvent::NoModifiers, FloatSize(), FloatPoint(), nullptr); | 112 Vector<PlatformTouchPoint>(), PlatformEvent::NoModifiers, nullptr, |
| 113 nullptr); |
114 EXPECT_EQ(uniqueId, pointerEvent->pointerId()); | 114 EXPECT_EQ(uniqueId, pointerEvent->pointerId()); |
115 EXPECT_EQ(isPrimary, pointerEvent->isPrimary()); | 115 EXPECT_EQ(isPrimary, pointerEvent->isPrimary()); |
116 return pointerEvent; | 116 return pointerEvent; |
117 } | 117 } |
118 | 118 |
119 PointerEvent* PointerEventFactoryTest::createAndCheckMouseEvent( | 119 PointerEvent* PointerEventFactoryTest::createAndCheckMouseEvent( |
120 WebPointerProperties::PointerType pointerType, | 120 WebPointerProperties::PointerType pointerType, |
121 int rawId, | 121 int rawId, |
122 int uniqueId, | 122 int uniqueId, |
123 bool isPrimary, | 123 bool isPrimary, |
124 PlatformEvent::Modifiers modifiers) { | 124 PlatformEvent::Modifiers modifiers) { |
125 PointerEvent* pointerEvent = m_pointerEventFactory.create( | 125 PointerEvent* pointerEvent = m_pointerEventFactory.create( |
126 EventTypeNames::mousedown, | 126 EventTypeNames::mousedown, |
127 PlatformMouseEventBuilder(pointerType, rawId, modifiers), nullptr); | 127 PlatformMouseEventBuilder(pointerType, rawId, modifiers), |
| 128 Vector<PlatformMouseEvent>(), nullptr); |
128 EXPECT_EQ(uniqueId, pointerEvent->pointerId()); | 129 EXPECT_EQ(uniqueId, pointerEvent->pointerId()); |
129 EXPECT_EQ(isPrimary, pointerEvent->isPrimary()); | 130 EXPECT_EQ(isPrimary, pointerEvent->isPrimary()); |
130 return pointerEvent; | 131 return pointerEvent; |
131 } | 132 } |
132 | 133 |
133 TEST_F(PointerEventFactoryTest, MousePointer) { | 134 TEST_F(PointerEventFactoryTest, MousePointer) { |
134 EXPECT_TRUE(m_pointerEventFactory.isActive(m_expectedMouseId)); | 135 EXPECT_TRUE(m_pointerEventFactory.isActive(m_expectedMouseId)); |
135 EXPECT_FALSE(m_pointerEventFactory.isActiveButtonsState(m_expectedMouseId)); | 136 EXPECT_FALSE(m_pointerEventFactory.isActiveButtonsState(m_expectedMouseId)); |
136 | 137 |
137 PointerEvent* pointerEvent1 = createAndCheckMouseEvent( | 138 PointerEvent* pointerEvent1 = createAndCheckMouseEvent( |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 | 383 |
383 for (int i = 0; i < 100; ++i) { | 384 for (int i = 0; i < 100; ++i) { |
384 createAndCheckTouchEvent(WebPointerProperties::PointerType::Mouse, i, | 385 createAndCheckTouchEvent(WebPointerProperties::PointerType::Mouse, i, |
385 m_expectedMouseId, true); | 386 m_expectedMouseId, true); |
386 } | 387 } |
387 createAndCheckTouchCancel(WebPointerProperties::PointerType::Mouse, 0, | 388 createAndCheckTouchCancel(WebPointerProperties::PointerType::Mouse, 0, |
388 m_expectedMouseId, true); | 389 m_expectedMouseId, true); |
389 } | 390 } |
390 | 391 |
391 } // namespace blink | 392 } // namespace blink |
OLD | NEW |