Index: chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm |
diff --git a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm |
index 227174ba31f04d8354351562c0ec230c4255542c..a7d38a609be0926539f74fad31236dd45cca69cb 100644 |
--- a/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm |
+++ b/chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm |
@@ -78,6 +78,8 @@ class ChromeRenderWidgetHostViewMacHistorySwiperTest |
base_path, base::FilePath(FILE_PATH_LITERAL("text.html"))); |
url2_ = ui_test_utils::GetTestUrl( |
base_path, base::FilePath(FILE_PATH_LITERAL("blank.html"))); |
+ url_iframe_ = ui_test_utils::GetTestUrl( |
+ base_path, base::FilePath(FILE_PATH_LITERAL("iframe.html"))); |
} |
virtual void SetUpOnMainThread() OVERRIDE { |
@@ -338,6 +340,7 @@ class ChromeRenderWidgetHostViewMacHistorySwiperTest |
GURL url1_; |
GURL url2_; |
+ GURL url_iframe_; |
base::scoped_nsobject<NSMutableArray> event_queue_; |
// The current location of the user's fingers on the track pad. |
CGPoint touch_; |
@@ -683,3 +686,45 @@ IN_PROC_BROWSER_TEST_F(ChromeRenderWidgetHostViewMacHistorySwiperTest, |
RunQueuedEvents(); |
ExpectUrlAndOffset(url1_, 0); |
} |
+ |
+// Initial movements are vertical, and scroll the iframe. Subsequent movements |
+// are horizontal, and should not trigger history swiping. |
+IN_PROC_BROWSER_TEST_F(ChromeRenderWidgetHostViewMacHistorySwiperTest, |
+ TestIframeHistorySwiping) { |
+ if (!IsHistorySwipingSupported()) |
+ return; |
+ |
+ ui_test_utils::NavigateToURL(browser(), url_iframe_); |
+ ASSERT_EQ(url_iframe_, GetWebContents()->GetURL()); |
+ QueueBeginningEvents(0, -1); |
+ for (int i = 0; i < 10; ++i) |
+ QueueScrollAndTouchMoved(0, -1); |
+ for (int i = 0; i < 149; ++i) |
+ QueueScrollAndTouchMoved(1, 0); |
+ |
+ QueueEndEvents(); |
+ RunQueuedEvents(); |
+ content::WaitForLoadStop(GetWebContents()); |
+ EXPECT_EQ(url_iframe_, GetWebContents()->GetURL()); |
+} |
+ |
+// The gesture ends before the touchesEndedWithEvent: method gets called. |
+IN_PROC_BROWSER_TEST_F(ChromeRenderWidgetHostViewMacHistorySwiperTest, |
+ TestGestureEndTiming) { |
+ if (!IsHistorySwipingSupported()) |
+ return; |
+ |
+ QueueBeginningEvents(1, 0); |
+ for (int i = 0; i < 150; ++i) |
+ QueueScrollAndTouchMoved(1, 0); |
+ |
+ QueueTouch( |
+ DEPLOYMENT_TOUCHES_MOVED, NSEventTypeEndGesture, NSMouseEventSubtype, NO); |
+ QueueGestureEnd(); |
+ QueueTouch( |
+ DEPLOYMENT_TOUCHES_ENDED, NSEventTypeEndGesture, NSMouseEventSubtype, NO); |
+ QueueTrackpadScroll(0, 0, NSEventPhaseEnded, YES); |
+ |
+ RunQueuedEvents(); |
+ ExpectUrlAndOffset(url1_, 0); |
+} |