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

Unified Diff: chrome/browser/renderer_host/chrome_render_widget_host_view_mac_history_swiper_browsertest.mm

Issue 300863002: mac: History swiping doesn't work right with iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase against top of tree. Created 6 years, 7 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/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);
+}

Powered by Google App Engine
This is Rietveld 408576698