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

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 2052353002: Route ScrollEvents to correct process under OOPIF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test added Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/site_per_process_browsertest.h" 5 #include "content/browser/site_per_process_browsertest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 event_ = event; 172 event_ = event;
173 return false; 173 return false;
174 } 174 }
175 RenderWidgetHost* host_; 175 RenderWidgetHost* host_;
176 bool event_received_; 176 bool event_received_;
177 blink::WebMouseEvent event_; 177 blink::WebMouseEvent event_;
178 178
179 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostMouseEventMonitor); 179 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostMouseEventMonitor);
180 }; 180 };
181 181
182 class TestInputEventObserver : public RenderWidgetHost::InputEventObserver {
183 public:
184 explicit TestInputEventObserver(RenderWidgetHost* host)
185 : host_(host),
186 event_received_(false),
187 last_event_type_(blink::WebInputEvent::Undefined) {
188 host_->AddInputEventObserver(this);
189 }
190
191 ~TestInputEventObserver() override { host_->RemoveInputEventObserver(this); }
192
193 bool EventWasReceived() const { return event_received_; }
194 void ResetEventReceived() { event_received_ = false; }
195 blink::WebInputEvent::Type EventType() const { return last_event_type_; }
196
197 void OnInputEvent(const blink::WebInputEvent& event) override {
198 event_received_ = true;
199 last_event_type_ = event.type;
200 };
201
202 RenderWidgetHost* host_;
203 bool event_received_;
204 blink::WebInputEvent::Type last_event_type_;
205
206 DISALLOW_COPY_AND_ASSIGN(TestInputEventObserver);
207 };
208
182 // Helper function that performs a surface hittest. 209 // Helper function that performs a surface hittest.
183 void SurfaceHitTestTestHelper( 210 void SurfaceHitTestTestHelper(
184 Shell* shell, 211 Shell* shell,
185 net::test_server::EmbeddedTestServer* embedded_test_server) { 212 net::test_server::EmbeddedTestServer* embedded_test_server) {
186 GURL main_url(embedded_test_server->GetURL( 213 GURL main_url(embedded_test_server->GetURL(
187 "/frame_tree/page_with_positioned_frame.html")); 214 "/frame_tree/page_with_positioned_frame.html"));
188 NavigateToURL(shell, main_url); 215 NavigateToURL(shell, main_url);
189 216
190 // It is safe to obtain the root frame tree node here, as it doesn't change. 217 // It is safe to obtain the root frame tree node here, as it doesn't change.
191 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell->web_contents()) 218 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell->web_contents())
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 // with scroll bubbling. 1070 // with scroll bubbling.
1044 while (update_rect.y() > initial_y) { 1071 while (update_rect.y() > initial_y) {
1045 base::RunLoop run_loop; 1072 base::RunLoop run_loop;
1046 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 1073 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
1047 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout()); 1074 FROM_HERE, run_loop.QuitClosure(), TestTimeouts::tiny_timeout());
1048 run_loop.Run(); 1075 run_loop.Run();
1049 update_rect = filter->last_rect(); 1076 update_rect = filter->last_rect();
1050 } 1077 }
1051 } 1078 }
1052 1079
1080 // Test that an ET_SCROLL event sent to an out-of-process iframe correctly
1081 // results in a scroll. This is only handled by RenderWidgetHostViewAura
1082 // and is needed for trackpad scrolling on Chromebooks.
1083 #if !defined(USE_AURA)
1084 #define MAYBE_ScrollEventToOOPIF DISABLED_ScrollEventToOOPIF
1085 #else
1086 #define MAYBE_ScrollEventToOOPIF ScrollEventToOOPIF
1087 #endif
1088 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, MAYBE_ScrollEventToOOPIF) {
1089 GURL main_url(embedded_test_server()->GetURL(
1090 "/frame_tree/page_with_positioned_frame.html"));
1091 NavigateToURL(shell(), main_url);
1092
1093 // It is safe to obtain the root frame tree node here, as it doesn't change.
1094 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
1095 ->GetFrameTree()
1096 ->root();
1097 ASSERT_EQ(1U, root->child_count());
1098
1099 FrameTreeNode* child_node = root->child_at(0);
1100 GURL site_url(embedded_test_server()->GetURL("baz.com", "/title1.html"));
1101 EXPECT_EQ(site_url, child_node->current_url());
1102 EXPECT_NE(shell()->web_contents()->GetSiteInstance(),
1103 child_node->current_frame_host()->GetSiteInstance());
1104
1105 RenderWidgetHostViewAura* rwhv_parent =
1106 static_cast<RenderWidgetHostViewAura*>(
1107 root->current_frame_host()->GetRenderWidgetHost()->GetView());
1108
1109 RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>(
1110 child_node->current_frame_host()->GetRenderWidgetHost()->GetView());
1111
1112 SurfaceHitTestReadyNotifier notifier(
1113 static_cast<RenderWidgetHostViewChildFrame*>(rwhv_child));
1114 notifier.WaitForSurfaceReady();
1115
1116 // Create listener for input events.
1117 TestInputEventObserver child_frame_monitor(
1118 child_node->current_frame_host()->GetRenderWidgetHost());
1119
1120 // Send a ui::ScrollEvent that will hit test to the child frame.
1121 ui::ScrollEvent scroll_event(ui::ET_SCROLL, gfx::Point(75, 75),
1122 ui::EventTimeForNow(), ui::EF_NONE,
1123 0, 10, // Offsets
1124 0, 10, // Offset ordinals
1125 2);
1126 rwhv_parent->OnScrollEvent(&scroll_event);
1127
1128 // Verify that this a mouse wheel event was sent to the child frame renderer.
1129 EXPECT_TRUE(child_frame_monitor.EventWasReceived());
1130 EXPECT_EQ(child_frame_monitor.EventType(), blink::WebInputEvent::MouseWheel);
1131 }
1132
1053 // Test that mouse events are being routed to the correct RenderWidgetHostView 1133 // Test that mouse events are being routed to the correct RenderWidgetHostView
1054 // based on coordinates. 1134 // based on coordinates.
1055 #if defined(OS_ANDROID) || defined(THREAD_SANITIZER) 1135 #if defined(OS_ANDROID) || defined(THREAD_SANITIZER)
1056 // Browser process hit testing is not implemented on Android. 1136 // Browser process hit testing is not implemented on Android.
1057 // https://crbug.com/491334 1137 // https://crbug.com/491334
1058 // The test times out often on TSAN bot. 1138 // The test times out often on TSAN bot.
1059 // https://crbug.com/591170. 1139 // https://crbug.com/591170.
1060 #define MAYBE_SurfaceHitTestTest DISABLED_SurfaceHitTestTest 1140 #define MAYBE_SurfaceHitTestTest DISABLED_SurfaceHitTestTest
1061 #else 1141 #else
1062 #define MAYBE_SurfaceHitTestTest SurfaceHitTestTest 1142 #define MAYBE_SurfaceHitTestTest SurfaceHitTestTest
(...skipping 6134 matching lines...) Expand 10 before | Expand all | Expand 10 after
7197 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); 7277 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)));
7198 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); 7278 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0)));
7199 7279
7200 // Cross-site navigation should preserve the fullscreen flags. 7280 // Cross-site navigation should preserve the fullscreen flags.
7201 NavigateFrameToURL(root->child_at(0)->child_at(0), 7281 NavigateFrameToURL(root->child_at(0)->child_at(0),
7202 embedded_test_server()->GetURL("d.com", "/title1.html")); 7282 embedded_test_server()->GetURL("d.com", "/title1.html"));
7203 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); 7283 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0)));
7204 } 7284 }
7205 7285
7206 } // namespace content 7286 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698