OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/common/input/touch_event_stream_validator.h" | 5 #include "content/common/input/touch_event_stream_validator.h" |
6 | 6 |
7 #include "content/common/input/synthetic_web_input_event_builders.h" | 7 #include "content/common/input/synthetic_web_input_event_builders.h" |
8 #include "content/common/input/web_touch_event_traits.h" | 8 #include "content/common/input/web_touch_event_traits.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 EXPECT_TRUE(validator.Validate(start, &error_msg)); | 152 EXPECT_TRUE(validator.Validate(start, &error_msg)); |
153 EXPECT_TRUE(error_msg.empty()); | 153 EXPECT_TRUE(error_msg.empty()); |
154 | 154 |
155 WebTouchEvent event; | 155 WebTouchEvent event; |
156 event.touchesLength = 1; | 156 event.touchesLength = 1; |
157 event.type = kTouchTypes[i]; | 157 event.type = kTouchTypes[i]; |
158 for (size_t j = WebTouchPoint::StateUndefined; | 158 for (size_t j = WebTouchPoint::StateUndefined; |
159 j <= WebTouchPoint::StateCancelled; | 159 j <= WebTouchPoint::StateCancelled; |
160 ++j) { | 160 ++j) { |
161 event.touches[0].state = static_cast<WebTouchPoint::State>(j); | 161 event.touches[0].state = static_cast<WebTouchPoint::State>(j); |
162 if (event.touches[0].state == kValidTouchPointStatesForType[i]) { | 162 if (event.touches[0].state == kValidTouchPointStatesForType[i] |
| 163 // TODO(jdduke): Remove this StateStationary workaround check for |
| 164 // TouchMove after implementing TouchMove events filtering based on |
| 165 // corrected touches state in TouchEventQueue, crbug.com/452032. |
| 166 || (event.type == WebInputEvent::TouchMove |
| 167 && event.touches[0].state == WebTouchPoint::StateStationary)) { |
163 EXPECT_TRUE(validator.Validate(event, &error_msg)); | 168 EXPECT_TRUE(validator.Validate(event, &error_msg)); |
164 EXPECT_TRUE(error_msg.empty()); | 169 EXPECT_TRUE(error_msg.empty()); |
165 } else { | 170 } else { |
166 EXPECT_FALSE(validator.Validate(event, &error_msg)); | 171 EXPECT_FALSE(validator.Validate(event, &error_msg)); |
167 EXPECT_FALSE(error_msg.empty()); | 172 EXPECT_FALSE(error_msg.empty()); |
168 } | 173 } |
169 } | 174 } |
170 } | 175 } |
171 } | 176 } |
172 | 177 |
173 } // namespace content | 178 } // namespace content |
OLD | NEW |