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 "base/auto_reset.h" | 5 #include "base/auto_reset.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/browser/renderer_host/input/synthetic_gesture.h" | 10 #include "content/browser/renderer_host/input/synthetic_gesture.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // Verify the test infrastructure works - we can touch-scroll the page and get a | 172 // Verify the test infrastructure works - we can touch-scroll the page and get a |
173 // touchcancel as expected. | 173 // touchcancel as expected. |
174 IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, DISABLED_DefaultAuto) { | 174 IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, DISABLED_DefaultAuto) { |
175 LoadURL(); | 175 LoadURL(); |
176 | 176 |
177 bool scrolled = DoTouchScroll(gfx::Point(50, 50), gfx::Vector2d(0, 45)); | 177 bool scrolled = DoTouchScroll(gfx::Point(50, 50), gfx::Vector2d(0, 45)); |
178 EXPECT_TRUE(scrolled); | 178 EXPECT_TRUE(scrolled); |
179 | 179 |
180 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart")); | 180 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart")); |
181 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchmove")); | 181 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchmove")); |
182 if (TouchEventQueue::TOUCH_SCROLLING_MODE_DEFAULT == | 182 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend")); |
183 TouchEventQueue::TOUCH_SCROLLING_MODE_TOUCHCANCEL) { | 183 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel")); |
184 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchend")); | |
185 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchcancel")); | |
186 } else { | |
187 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend")); | |
188 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel")); | |
189 } | |
190 } | 184 } |
191 | 185 |
192 // Verify that touching a touch-action: none region disables scrolling and | 186 // Verify that touching a touch-action: none region disables scrolling and |
193 // enables all touch events to be sent. | 187 // enables all touch events to be sent. |
194 // Disabled on MacOS because it doesn't support touch input. | 188 // Disabled on MacOS because it doesn't support touch input. |
195 // It's just flaky everywhere. | 189 // It's just flaky everywhere. |
196 IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, DISABLED_TouchActionNone) { | 190 IN_PROC_BROWSER_TEST_F(TouchActionBrowserTest, DISABLED_TouchActionNone) { |
197 LoadURL(); | 191 LoadURL(); |
198 | 192 |
199 bool scrolled = DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 45)); | 193 bool scrolled = DoTouchScroll(gfx::Point(50, 150), gfx::Vector2d(0, 45)); |
200 EXPECT_FALSE(scrolled); | 194 EXPECT_FALSE(scrolled); |
201 | 195 |
202 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart")); | 196 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchstart")); |
203 EXPECT_GT(ExecuteScriptAndExtractInt("eventCounts.touchmove"), 1); | 197 EXPECT_GT(ExecuteScriptAndExtractInt("eventCounts.touchmove"), 1); |
204 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend")); | 198 EXPECT_EQ(1, ExecuteScriptAndExtractInt("eventCounts.touchend")); |
205 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel")); | 199 EXPECT_EQ(0, ExecuteScriptAndExtractInt("eventCounts.touchcancel")); |
206 } | 200 } |
207 | 201 |
208 } // namespace content | 202 } // namespace content |
OLD | NEW |