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

Unified Diff: chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc

Issue 404213003: [WIP] Allow scroll events to permanently change the default gesture handler in RootView (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: friend test Created 6 years, 5 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: chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
index c7226a6a01346003e2c951da3e9449ddb0e3340e..da2efb70ed2fe9e8b337f03e1da0bb5b3bb6dcf5 100644
--- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
+++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc
@@ -321,7 +321,9 @@ IN_PROC_BROWSER_TEST_F(TabDragCaptureLostTest, ReleaseCaptureOnDrag) {
EXPECT_FALSE(tab_strip->IsDragSessionActive());
}
-IN_PROC_BROWSER_TEST_F(TabDragControllerTest, GestureEndShouldEndDragTest) {
+// Tests that a tab dragging session begins and ends at the correct times
+// when dispatching gestures.
+IN_PROC_BROWSER_TEST_F(TabDragControllerTest, DragWithGesture) {
AddTabAndResetBrowser(browser());
TabStrip* tab_strip = GetTabStripForBrowser(browser());
@@ -329,23 +331,51 @@ IN_PROC_BROWSER_TEST_F(TabDragControllerTest, GestureEndShouldEndDragTest) {
Tab* tab1 = tab_strip->tab_at(1);
gfx::Point tab_1_center(tab1->width() / 2, tab1->height() / 2);
- ui::GestureEvent gesture_begin(
+ EXPECT_FALSE(TabDragController::IsActive());
+ EXPECT_FALSE(tab_strip->IsDragSessionActive());
+
+ // A ui::ET_GESTURE_TAP_DOWN dispatched on the tab should set the
+ // drag controller as active and initiate the drag session.
+ ui::GestureEvent gesture_tap_down(
tab_1_center.x(),
tab_1_center.x(),
0,
base::TimeDelta(),
ui::GestureEventDetails(ui::ET_GESTURE_BEGIN, 0.0f, 0.0f));
- tab_strip->MaybeStartDrag(tab1, gesture_begin,
- tab_strip->GetSelectionModel());
+ tab1->OnGestureEvent(&gesture_tap_down);
+ EXPECT_TRUE(TabDragController::IsActive());
+ EXPECT_TRUE(tab_strip->IsDragSessionActive());
+
+ // We should remain in the drag session if a ui::ET_GESTURE_SCROLL_BEGIN
+ // and a ui::ET_GESTURE_SCROLL_UPDATE are dispatched to the tab strip.
+ ui::GestureEvent gesture_scroll_begin(
+ tab_1_center.x(),
+ tab_1_center.x(),
+ 0,
+ base::TimeDelta(),
+ ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN, 0.0f, 0.0f));
+ ui::GestureEvent gesture_scroll_update(
+ tab_1_center.x(),
+ tab_1_center.x(),
+ 0,
+ base::TimeDelta(),
+ ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_UPDATE, 0.0f, 0.0f));
+ tab_strip->OnGestureEvent(&gesture_scroll_begin);
+ EXPECT_TRUE(TabDragController::IsActive());
+ EXPECT_TRUE(tab_strip->IsDragSessionActive());
+ tab_strip->OnGestureEvent(&gesture_scroll_update);
EXPECT_TRUE(TabDragController::IsActive());
+ EXPECT_TRUE(tab_strip->IsDragSessionActive());
- ui::GestureEvent gesture_end(
+ // A ui::ET_GESTURE_SCROLL_END dispatched to the tab strip should end the
+ // drag session.
+ ui::GestureEvent gesture_scroll_end(
tab_1_center.x(),
tab_1_center.x(),
0,
base::TimeDelta(),
- ui::GestureEventDetails(ui::ET_GESTURE_END, 0.0f, 0.0f));
- tab_strip->OnGestureEvent(&gesture_end);
+ ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_END, 0.0f, 0.0f));
+ tab_strip->OnGestureEvent(&gesture_scroll_end);
EXPECT_FALSE(TabDragController::IsActive());
EXPECT_FALSE(tab_strip->IsDragSessionActive());
}

Powered by Google App Engine
This is Rietveld 408576698