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

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

Issue 2317253005: SourceEventType added to LatencyInfo (Closed)
Patch Set: Changed the patch to only contain source event type plumbing. Created 4 years, 3 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
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "net/dns/mock_host_resolver.h" 58 #include "net/dns/mock_host_resolver.h"
59 #include "net/test/embedded_test_server/embedded_test_server.h" 59 #include "net/test/embedded_test_server/embedded_test_server.h"
60 #include "testing/gtest/include/gtest/gtest.h" 60 #include "testing/gtest/include/gtest/gtest.h"
61 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" 61 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h"
62 #include "third_party/WebKit/public/web/WebInputEvent.h" 62 #include "third_party/WebKit/public/web/WebInputEvent.h"
63 #include "third_party/WebKit/public/web/WebSandboxFlags.h" 63 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
64 #include "ui/display/display_switches.h" 64 #include "ui/display/display_switches.h"
65 #include "ui/display/screen.h" 65 #include "ui/display/screen.h"
66 #include "ui/events/event.h" 66 #include "ui/events/event.h"
67 #include "ui/events/event_utils.h" 67 #include "ui/events/event_utils.h"
68 #include "ui/events/latency_info.h"
68 #include "ui/gfx/geometry/point.h" 69 #include "ui/gfx/geometry/point.h"
69 70
70 #if defined(USE_AURA) 71 #if defined(USE_AURA)
71 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 72 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
72 #endif 73 #endif
73 74
74 #if defined(OS_MACOSX) 75 #if defined(OS_MACOSX)
75 #include "ui/base/test/scoped_preferred_scroller_style_mac.h" 76 #include "ui/base/test/scoped_preferred_scroller_style_mac.h"
76 #endif 77 #endif
77 78
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 250
250 // Target input event to child frame. 251 // Target input event to child frame.
251 blink::WebMouseEvent child_event; 252 blink::WebMouseEvent child_event;
252 child_event.type = blink::WebInputEvent::MouseDown; 253 child_event.type = blink::WebInputEvent::MouseDown;
253 child_event.button = blink::WebPointerProperties::Button::Left; 254 child_event.button = blink::WebPointerProperties::Button::Left;
254 child_event.x = 75; 255 child_event.x = 75;
255 child_event.y = 75; 256 child_event.y = 75;
256 child_event.clickCount = 1; 257 child_event.clickCount = 1;
257 main_frame_monitor.ResetEventReceived(); 258 main_frame_monitor.ResetEventReceived();
258 child_frame_monitor.ResetEventReceived(); 259 child_frame_monitor.ResetEventReceived();
259 router->RouteMouseEvent(root_view, &child_event); 260 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo());
260 261
261 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); 262 EXPECT_TRUE(child_frame_monitor.EventWasReceived());
262 EXPECT_EQ(23, child_frame_monitor.event().x); 263 EXPECT_EQ(23, child_frame_monitor.event().x);
263 EXPECT_EQ(23, child_frame_monitor.event().y); 264 EXPECT_EQ(23, child_frame_monitor.event().y);
264 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); 265 EXPECT_FALSE(main_frame_monitor.EventWasReceived());
265 266
266 child_frame_monitor.ResetEventReceived(); 267 child_frame_monitor.ResetEventReceived();
267 main_frame_monitor.ResetEventReceived(); 268 main_frame_monitor.ResetEventReceived();
268 269
269 // Target input event to main frame. 270 // Target input event to main frame.
270 blink::WebMouseEvent main_event; 271 blink::WebMouseEvent main_event;
271 main_event.type = blink::WebInputEvent::MouseDown; 272 main_event.type = blink::WebInputEvent::MouseDown;
272 main_event.button = blink::WebPointerProperties::Button::Left; 273 main_event.button = blink::WebPointerProperties::Button::Left;
273 main_event.x = 1; 274 main_event.x = 1;
274 main_event.y = 1; 275 main_event.y = 1;
275 main_event.clickCount = 1; 276 main_event.clickCount = 1;
276 // Ladies and gentlemen, THIS is the main_event! 277 // Ladies and gentlemen, THIS is the main_event!
277 router->RouteMouseEvent(root_view, &main_event); 278 router->RouteMouseEvent(root_view, &main_event, ui::LatencyInfo());
278 279
279 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); 280 EXPECT_FALSE(child_frame_monitor.EventWasReceived());
280 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); 281 EXPECT_TRUE(main_frame_monitor.EventWasReceived());
281 EXPECT_EQ(1, main_frame_monitor.event().x); 282 EXPECT_EQ(1, main_frame_monitor.event().x);
282 EXPECT_EQ(1, main_frame_monitor.event().y); 283 EXPECT_EQ(1, main_frame_monitor.event().y);
283 } 284 }
284 285
285 class RedirectNotificationObserver : public NotificationObserver { 286 class RedirectNotificationObserver : public NotificationObserver {
286 public: 287 public:
287 // Register to listen for notifications of the given type from either a 288 // Register to listen for notifications of the given type from either a
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 1247
1247 // Target input event to nested frame. 1248 // Target input event to nested frame.
1248 blink::WebMouseEvent nested_event; 1249 blink::WebMouseEvent nested_event;
1249 nested_event.type = blink::WebInputEvent::MouseDown; 1250 nested_event.type = blink::WebInputEvent::MouseDown;
1250 nested_event.button = blink::WebPointerProperties::Button::Left; 1251 nested_event.button = blink::WebPointerProperties::Button::Left;
1251 nested_event.x = 125; 1252 nested_event.x = 125;
1252 nested_event.y = 125; 1253 nested_event.y = 125;
1253 nested_event.clickCount = 1; 1254 nested_event.clickCount = 1;
1254 nested_frame_monitor.ResetEventReceived(); 1255 nested_frame_monitor.ResetEventReceived();
1255 main_frame_monitor.ResetEventReceived(); 1256 main_frame_monitor.ResetEventReceived();
1256 router->RouteMouseEvent(root_view, &nested_event); 1257 router->RouteMouseEvent(root_view, &nested_event, ui::LatencyInfo());
1257 1258
1258 EXPECT_TRUE(nested_frame_monitor.EventWasReceived()); 1259 EXPECT_TRUE(nested_frame_monitor.EventWasReceived());
1259 EXPECT_EQ(21, nested_frame_monitor.event().x); 1260 EXPECT_EQ(21, nested_frame_monitor.event().x);
1260 EXPECT_EQ(21, nested_frame_monitor.event().y); 1261 EXPECT_EQ(21, nested_frame_monitor.event().y);
1261 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); 1262 EXPECT_FALSE(main_frame_monitor.EventWasReceived());
1262 } 1263 }
1263 1264
1264 // This test tests that browser process hittesting ignores frames with 1265 // This test tests that browser process hittesting ignores frames with
1265 // pointer-events: none. 1266 // pointer-events: none.
1266 #if defined(OS_ANDROID) 1267 #if defined(OS_ANDROID)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 1312
1312 // Target input event to child frame. 1313 // Target input event to child frame.
1313 blink::WebMouseEvent child_event; 1314 blink::WebMouseEvent child_event;
1314 child_event.type = blink::WebInputEvent::MouseDown; 1315 child_event.type = blink::WebInputEvent::MouseDown;
1315 child_event.button = blink::WebPointerProperties::Button::Left; 1316 child_event.button = blink::WebPointerProperties::Button::Left;
1316 child_event.x = 75; 1317 child_event.x = 75;
1317 child_event.y = 75; 1318 child_event.y = 75;
1318 child_event.clickCount = 1; 1319 child_event.clickCount = 1;
1319 main_frame_monitor.ResetEventReceived(); 1320 main_frame_monitor.ResetEventReceived();
1320 child_frame_monitor.ResetEventReceived(); 1321 child_frame_monitor.ResetEventReceived();
1321 router->RouteMouseEvent(root_view, &child_event); 1322 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo());
1322 1323
1323 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); 1324 EXPECT_TRUE(main_frame_monitor.EventWasReceived());
1324 EXPECT_EQ(75, main_frame_monitor.event().x); 1325 EXPECT_EQ(75, main_frame_monitor.event().x);
1325 EXPECT_EQ(75, main_frame_monitor.event().y); 1326 EXPECT_EQ(75, main_frame_monitor.event().y);
1326 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); 1327 EXPECT_FALSE(child_frame_monitor.EventWasReceived());
1327 } 1328 }
1328 1329
1329 // Tests OOPIF rendering by checking that the RWH of the iframe generates 1330 // Tests OOPIF rendering by checking that the RWH of the iframe generates
1330 // OnSwapCompositorFrame message. 1331 // OnSwapCompositorFrame message.
1331 #if defined(OS_ANDROID) 1332 #if defined(OS_ANDROID)
(...skipping 3549 matching lines...) Expand 10 before | Expand all | Expand 10 after
4881 // Send a MouseMove to the subframe. The frame contains text, and moving the 4882 // Send a MouseMove to the subframe. The frame contains text, and moving the
4882 // mouse over it should cause the renderer to send a mouse cursor update. 4883 // mouse over it should cause the renderer to send a mouse cursor update.
4883 blink::WebMouseEvent mouse_event; 4884 blink::WebMouseEvent mouse_event;
4884 mouse_event.type = blink::WebInputEvent::MouseMove; 4885 mouse_event.type = blink::WebInputEvent::MouseMove;
4885 mouse_event.x = 60; 4886 mouse_event.x = 60;
4886 mouse_event.y = 60; 4887 mouse_event.y = 60;
4887 RenderWidgetHost* rwh_child = 4888 RenderWidgetHost* rwh_child =
4888 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); 4889 root->child_at(0)->current_frame_host()->GetRenderWidgetHost();
4889 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( 4890 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>(
4890 root->current_frame_host()->GetRenderWidgetHost()->GetView()); 4891 root->current_frame_host()->GetRenderWidgetHost()->GetView());
4891 web_contents()->GetInputEventRouter()->RouteMouseEvent(root_view, 4892 web_contents()->GetInputEventRouter()->RouteMouseEvent(
4892 &mouse_event); 4893 root_view, &mouse_event, ui::LatencyInfo());
4893 4894
4894 // CursorMessageFilter::Wait() implicitly tests whether we receive a 4895 // CursorMessageFilter::Wait() implicitly tests whether we receive a
4895 // ViewHostMsg_SetCursor message from the renderer process, because it does 4896 // ViewHostMsg_SetCursor message from the renderer process, because it does
4896 // does not return otherwise. 4897 // does not return otherwise.
4897 filter->Wait(); 4898 filter->Wait();
4898 EXPECT_EQ(filter->last_set_cursor_routing_id(), rwh_child->GetRoutingID()); 4899 EXPECT_EQ(filter->last_set_cursor_routing_id(), rwh_child->GetRoutingID());
4899 } 4900 }
4900 #endif 4901 #endif
4901 4902
4902 // Tests that we are using the correct RenderFrameProxy when navigating an 4903 // Tests that we are using the correct RenderFrameProxy when navigating an
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
5407 5408
5408 gfx::Point point(75, 75); 5409 gfx::Point point(75, 75);
5409 5410
5410 // Target right-click event to child frame. 5411 // Target right-click event to child frame.
5411 blink::WebMouseEvent click_event; 5412 blink::WebMouseEvent click_event;
5412 click_event.type = blink::WebInputEvent::MouseDown; 5413 click_event.type = blink::WebInputEvent::MouseDown;
5413 click_event.button = blink::WebPointerProperties::Button::Right; 5414 click_event.button = blink::WebPointerProperties::Button::Right;
5414 click_event.x = point.x(); 5415 click_event.x = point.x();
5415 click_event.y = point.y(); 5416 click_event.y = point.y();
5416 click_event.clickCount = 1; 5417 click_event.clickCount = 1;
5417 router->RouteMouseEvent(root_view, &click_event); 5418 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo());
5418 5419
5419 // We also need a MouseUp event, needed by Windows. 5420 // We also need a MouseUp event, needed by Windows.
5420 click_event.type = blink::WebInputEvent::MouseUp; 5421 click_event.type = blink::WebInputEvent::MouseUp;
5421 click_event.x = point.x(); 5422 click_event.x = point.x();
5422 click_event.y = point.y(); 5423 click_event.y = point.y();
5423 router->RouteMouseEvent(root_view, &click_event); 5424 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo());
5424 5425
5425 context_menu_delegate.Wait(); 5426 context_menu_delegate.Wait();
5426 5427
5427 ContextMenuParams params = context_menu_delegate.getParams(); 5428 ContextMenuParams params = context_menu_delegate.getParams();
5428 5429
5429 EXPECT_EQ(point.x(), params.x); 5430 EXPECT_EQ(point.x(), params.x);
5430 EXPECT_EQ(point.y(), params.y); 5431 EXPECT_EQ(point.y(), params.y);
5431 } 5432 }
5432 5433
5433 // Test that a mouse right-click to an out-of-process iframe causes a context 5434 // Test that a mouse right-click to an out-of-process iframe causes a context
(...skipping 2561 matching lines...) Expand 10 before | Expand all | Expand 10 after
7995 child_rfh->OnDispatchLoad(); 7996 child_rfh->OnDispatchLoad();
7996 7997
7997 // In the bug, OnDispatchLoad killed the b.com renderer. Ensure that this is 7998 // In the bug, OnDispatchLoad killed the b.com renderer. Ensure that this is
7998 // not the case. Note that the process kill doesn't happen immediately, so 7999 // not the case. Note that the process kill doesn't happen immediately, so
7999 // IsRenderFrameLive() can't be checked here (yet). Instead, check that 8000 // IsRenderFrameLive() can't be checked here (yet). Instead, check that
8000 // JavaScript can still execute in b.com using the popup. 8001 // JavaScript can still execute in b.com using the popup.
8001 EXPECT_TRUE(ExecuteScript(popup_shell->web_contents(), "true")); 8002 EXPECT_TRUE(ExecuteScript(popup_shell->web_contents(), "true"));
8002 } 8003 }
8003 8004
8004 } // namespace content 8005 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698