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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 EXPECT_EQ(isPrimary, pointerEvent->isPrimary()); | 106 EXPECT_EQ(isPrimary, pointerEvent->isPrimary()); |
107 return pointerEvent; | 107 return pointerEvent; |
108 } | 108 } |
109 | 109 |
110 PointerEvent* PointerEventFactoryTest::createAndCheckMouseEvent( | 110 PointerEvent* PointerEventFactoryTest::createAndCheckMouseEvent( |
111 WebPointerProperties::PointerType pointerType, | 111 WebPointerProperties::PointerType pointerType, |
112 int rawId, int uniqueId, bool isPrimary, | 112 int rawId, int uniqueId, bool isPrimary, |
113 PlatformEvent::Modifiers modifiers) | 113 PlatformEvent::Modifiers modifiers) |
114 { | 114 { |
115 PointerEvent* pointerEvent = m_pointerEventFactory.create( | 115 PointerEvent* pointerEvent = m_pointerEventFactory.create( |
116 EventTypeNames::mousedown, PlatformMouseEventBuilder(pointerType, rawId,
modifiers), nullptr, nullptr); | 116 EventTypeNames::mousedown, PlatformMouseEventBuilder(pointerType, rawId,
modifiers), nullptr); |
117 EXPECT_EQ(uniqueId, pointerEvent->pointerId()); | 117 EXPECT_EQ(uniqueId, pointerEvent->pointerId()); |
118 EXPECT_EQ(isPrimary, pointerEvent->isPrimary()); | 118 EXPECT_EQ(isPrimary, pointerEvent->isPrimary()); |
119 return pointerEvent; | 119 return pointerEvent; |
120 } | 120 } |
121 | 121 |
122 TEST_F(PointerEventFactoryTest, MousePointer) | 122 TEST_F(PointerEventFactoryTest, MousePointer) |
123 { | 123 { |
124 EXPECT_TRUE(m_pointerEventFactory.isActive(m_expectedMouseId)); | 124 EXPECT_TRUE(m_pointerEventFactory.isActive(m_expectedMouseId)); |
125 EXPECT_FALSE(m_pointerEventFactory.isActiveButtonsState(m_expectedMouseId)); | 125 EXPECT_FALSE(m_pointerEventFactory.isActiveButtonsState(m_expectedMouseId)); |
126 | 126 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 createAndCheckMouseEvent(WebPointerProperties::PointerType::Touch, i, m_
mappedIdStart+i, i == 0); | 314 createAndCheckMouseEvent(WebPointerProperties::PointerType::Touch, i, m_
mappedIdStart+i, i == 0); |
315 } | 315 } |
316 | 316 |
317 for (int i = 0; i < 100; ++i) { | 317 for (int i = 0; i < 100; ++i) { |
318 createAndCheckTouchEvent(WebPointerProperties::PointerType::Mouse, i, m_
expectedMouseId, true); | 318 createAndCheckTouchEvent(WebPointerProperties::PointerType::Mouse, i, m_
expectedMouseId, true); |
319 } | 319 } |
320 createAndCheckTouchCancel(WebPointerProperties::PointerType::Mouse, 0, m_exp
ectedMouseId, true); | 320 createAndCheckTouchCancel(WebPointerProperties::PointerType::Mouse, 0, m_exp
ectedMouseId, true); |
321 } | 321 } |
322 | 322 |
323 } // namespace blink | 323 } // namespace blink |
OLD | NEW |