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

Unified Diff: content/browser/renderer_host/input/touch_emulator_unittest.cc

Issue 821223002: Pass gesture detector config type when enabling touch emulator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@touch-emulator-enabled
Patch Set: Fixed cursor reset, rebased Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/touch_emulator_unittest.cc
diff --git a/content/browser/renderer_host/input/touch_emulator_unittest.cc b/content/browser/renderer_host/input/touch_emulator_unittest.cc
index 3c6aa9689086f40b9a1a954bd171b8c23cc840b6..9d223592a06fdd3ef88d7c6adc518785527135b2 100644
--- a/content/browser/renderer_host/input/touch_emulator_unittest.cc
+++ b/content/browser/renderer_host/input/touch_emulator_unittest.cc
@@ -53,7 +53,7 @@ class TouchEmulatorTest : public testing::Test,
#endif
emulator_.reset(new TouchEmulator(this));
- emulator_->Enable();
+ emulator_->Enable(ui::GestureProviderConfigType::GENERIC_MOBILE);
}
void TearDown() override {
@@ -373,7 +373,39 @@ TEST_F(TouchEmulatorTest, DisableAndReenable) {
MouseMove(300, 300);
EXPECT_EQ("", ExpectedEvents());
- emulator()->Enable();
+ emulator()->Enable(ui::GestureProviderConfigType::GENERIC_MOBILE);
+ MouseDown(300, 300);
+ EXPECT_EQ("TouchStart GestureTapDown", ExpectedEvents());
+ MouseDrag(300, 400);
+ EXPECT_EQ(
+ "TouchMove GestureTapCancel GestureScrollBegin GestureScrollUpdate",
+ ExpectedEvents());
+
+ // Disable while scroll is in progress.
+ emulator()->Disable();
+ EXPECT_EQ("TouchCancel GestureScrollEnd", ExpectedEvents());
+}
+
+TEST_F(TouchEmulatorTest, DisableAndReenableDifferentConfig) {
+ MouseDown(100, 200);
+ EXPECT_EQ("TouchStart GestureTapDown", ExpectedEvents());
+ MouseDrag(200, 200);
+ EXPECT_EQ(
+ "TouchMove GestureTapCancel GestureScrollBegin GestureScrollUpdate",
+ ExpectedEvents());
+ PressShift();
+ MouseDrag(300, 200);
+ EXPECT_EQ("TouchMove GesturePinchBegin", ExpectedEvents());
+
+ // Disable while pinch is in progress.
+ emulator()->Disable();
+ EXPECT_EQ("TouchCancel GesturePinchEnd GestureScrollEnd", ExpectedEvents());
+ MouseUp(300, 200);
+ ReleaseShift();
+ MouseMove(300, 300);
+ EXPECT_EQ("", ExpectedEvents());
+
+ emulator()->Enable(ui::GestureProviderConfigType::GENERIC_DESKTOP);
MouseDown(300, 300);
EXPECT_EQ("TouchStart GestureTapDown", ExpectedEvents());
MouseDrag(300, 400);
@@ -433,7 +465,7 @@ TEST_F(TouchEmulatorTest, MouseWheel) {
emulator()->Disable();
EXPECT_EQ("TouchCancel GestureTapCancel", ExpectedEvents());
EXPECT_TRUE(SendMouseWheelEvent());
- emulator()->Enable();
+ emulator()->Enable(ui::GestureProviderConfigType::GENERIC_MOBILE);
EXPECT_TRUE(SendMouseWheelEvent());
}
@@ -459,7 +491,7 @@ TEST_F(TouchEmulatorTest, MultipleTouchStreams) {
EXPECT_EQ("", ExpectedEvents());
// Re-enabling in the middle of a touch sequence should not affect this.
emulator()->Disable();
- emulator()->Enable();
+ emulator()->Enable(ui::GestureProviderConfigType::GENERIC_MOBILE);
MouseDrag(300, 300);
EXPECT_EQ("", ExpectedEvents());
MouseUp(300, 300);
@@ -474,7 +506,7 @@ TEST_F(TouchEmulatorTest, MultipleTouchStreams) {
EXPECT_TRUE(TouchEnd(20, 20, false));
EXPECT_TRUE(TouchStart(30, 30, false));
AckOldestTouchEvent(); // TouchStart.
- emulator()->Enable();
+ emulator()->Enable(ui::GestureProviderConfigType::GENERIC_MOBILE);
AckOldestTouchEvent(); // TouchMove.
AckOldestTouchEvent(); // TouchEnd.
MouseDown(300, 200);
« no previous file with comments | « content/browser/renderer_host/input/touch_emulator.cc ('k') | content/browser/renderer_host/render_widget_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698