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

Unified Diff: content/browser/site_per_process_browsertest.cc

Issue 2830183003: Re-enable ScrollBubblingFromOOPIFTest on CrOS. (Closed)
Patch Set: Synchronize with an InputEventObserver instead of delay. Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/site_per_process_browsertest.cc
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc
index f9e831815a9ad88fbca2e5966c6d3f674f768b88..7c257895458f21841e6fa0f9e7bfc16236429238 100644
--- a/content/browser/site_per_process_browsertest.cc
+++ b/content/browser/site_per_process_browsertest.cc
@@ -935,6 +935,41 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, TitleAfterCrossSiteIframe) {
EXPECT_EQ(expected_title, entry->GetTitle());
}
+// Class to detect incoming GestureScrollEnd acks for bubbling tests.
+class GestureScrollEndObserver
+ : public content::RenderWidgetHost::InputEventObserver {
+ public:
+ GestureScrollEndObserver()
+ : message_loop_runner_(new content::MessageLoopRunner),
+ gesture_scroll_end_ack_received_(false) {}
+ ~GestureScrollEndObserver() override {}
+
+ void OnInputEventAck(const blink::WebInputEvent& event) override {
+ if (event.GetType() == blink::WebInputEvent::kGestureScrollEnd) {
+ gesture_scroll_end_ack_received_ = true;
+ if (message_loop_runner_->loop_running())
+ message_loop_runner_->Quit();
+ }
+ }
+
+ void Wait() {
+ if (!gesture_scroll_end_ack_received_) {
+ message_loop_runner_->Run();
+ }
+ }
+
+ void Reset() {
+ gesture_scroll_end_ack_received_ = false;
+ message_loop_runner_ = new content::MessageLoopRunner;
+ }
+
+ private:
+ scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
+ bool gesture_scroll_end_ack_received_;
+
+ DISALLOW_COPY_AND_ASSIGN(GestureScrollEndObserver);
+};
+
// Class to sniff incoming IPCs for FrameHostMsg_FrameRectChanged messages.
class FrameRectChangedMessageFilter : public content::BrowserMessageFilter {
public:
@@ -1084,7 +1119,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
// Test that scrolling a nested out-of-process iframe bubbles unused scroll
// delta to a parent frame.
-#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+#if defined(OS_ANDROID)
#define MAYBE_ScrollBubblingFromOOPIFTest DISABLED_ScrollBubblingFromOOPIFTest
#else
#define MAYBE_ScrollBubblingFromOOPIFTest ScrollBubblingFromOOPIFTest
@@ -1112,6 +1147,12 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
parent_iframe_node->current_frame_host()->GetProcess()->AddFilter(
filter.get());
+ std::unique_ptr<GestureScrollEndObserver> ack_observer =
+ base::MakeUnique<GestureScrollEndObserver>();
+ parent_iframe_node->current_frame_host()
+ ->GetRenderWidgetHost()
+ ->AddInputEventObserver(ack_observer.get());
+
GURL site_url(embedded_test_server()->GetURL(
"b.com", "/frame_tree/page_with_positioned_frame.html"));
NavigateFrameToURL(parent_iframe_node, site_url);
@@ -1169,6 +1210,7 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
update_rect = filter->last_rect();
EXPECT_LT(update_rect.y(), initial_y);
filter->Reset();
+ ack_observer->Reset();
// Now scroll the nested frame upward, which should bubble to the parent.
// The upscroll exceeds the amount that the frame was initially scrolled
@@ -1193,6 +1235,14 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest,
}
filter->Reset();
+ // Once we've sent a wheel to the nested iframe that we expect to turn into
+ // a bubbling scroll, we need to delay to make sure the GestureScrollBegin
+ // from this new scroll doesn't hit the RenderWidgetHostImpl before the
+ // GestureScrollEnd bubbled from the child.
+ // This timing only seems to be needed for CrOS, but we'll enable it on
+ // all platforms just to lessen the possibility of tests being flakey
+ // on non-CrOS platforms.
+ ack_observer->Wait();
// Scroll the parent down again in order to test scroll bubbling from
// gestures.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698