| OLD | NEW |
| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 #include "net/dns/mock_host_resolver.h" | 57 #include "net/dns/mock_host_resolver.h" |
| 58 #include "net/test/embedded_test_server/embedded_test_server.h" | 58 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 59 #include "testing/gtest/include/gtest/gtest.h" | 59 #include "testing/gtest/include/gtest/gtest.h" |
| 60 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" | 60 #include "third_party/WebKit/public/platform/WebInsecureRequestPolicy.h" |
| 61 #include "third_party/WebKit/public/web/WebInputEvent.h" | 61 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 62 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 62 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
| 63 #include "ui/display/display_switches.h" | 63 #include "ui/display/display_switches.h" |
| 64 #include "ui/display/screen.h" | 64 #include "ui/display/screen.h" |
| 65 #include "ui/events/event.h" | 65 #include "ui/events/event.h" |
| 66 #include "ui/events/event_utils.h" | 66 #include "ui/events/event_utils.h" |
| 67 #include "ui/events/latency_info.h" |
| 67 #include "ui/gfx/geometry/point.h" | 68 #include "ui/gfx/geometry/point.h" |
| 68 | 69 |
| 69 #if defined(USE_AURA) | 70 #if defined(USE_AURA) |
| 70 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 71 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 71 #endif | 72 #endif |
| 72 | 73 |
| 73 #if defined(OS_MACOSX) | 74 #if defined(OS_MACOSX) |
| 74 #include "ui/base/test/scoped_preferred_scroller_style_mac.h" | 75 #include "ui/base/test/scoped_preferred_scroller_style_mac.h" |
| 75 #endif | 76 #endif |
| 76 | 77 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 | 249 |
| 249 // Target input event to child frame. | 250 // Target input event to child frame. |
| 250 blink::WebMouseEvent child_event; | 251 blink::WebMouseEvent child_event; |
| 251 child_event.type = blink::WebInputEvent::MouseDown; | 252 child_event.type = blink::WebInputEvent::MouseDown; |
| 252 child_event.button = blink::WebPointerProperties::Button::Left; | 253 child_event.button = blink::WebPointerProperties::Button::Left; |
| 253 child_event.x = 75; | 254 child_event.x = 75; |
| 254 child_event.y = 75; | 255 child_event.y = 75; |
| 255 child_event.clickCount = 1; | 256 child_event.clickCount = 1; |
| 256 main_frame_monitor.ResetEventReceived(); | 257 main_frame_monitor.ResetEventReceived(); |
| 257 child_frame_monitor.ResetEventReceived(); | 258 child_frame_monitor.ResetEventReceived(); |
| 258 router->RouteMouseEvent(root_view, &child_event); | 259 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo()); |
| 259 | 260 |
| 260 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | 261 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
| 261 EXPECT_EQ(23, child_frame_monitor.event().x); | 262 EXPECT_EQ(23, child_frame_monitor.event().x); |
| 262 EXPECT_EQ(23, child_frame_monitor.event().y); | 263 EXPECT_EQ(23, child_frame_monitor.event().y); |
| 263 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | 264 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
| 264 | 265 |
| 265 child_frame_monitor.ResetEventReceived(); | 266 child_frame_monitor.ResetEventReceived(); |
| 266 main_frame_monitor.ResetEventReceived(); | 267 main_frame_monitor.ResetEventReceived(); |
| 267 | 268 |
| 268 // Target input event to main frame. | 269 // Target input event to main frame. |
| 269 blink::WebMouseEvent main_event; | 270 blink::WebMouseEvent main_event; |
| 270 main_event.type = blink::WebInputEvent::MouseDown; | 271 main_event.type = blink::WebInputEvent::MouseDown; |
| 271 main_event.button = blink::WebPointerProperties::Button::Left; | 272 main_event.button = blink::WebPointerProperties::Button::Left; |
| 272 main_event.x = 1; | 273 main_event.x = 1; |
| 273 main_event.y = 1; | 274 main_event.y = 1; |
| 274 main_event.clickCount = 1; | 275 main_event.clickCount = 1; |
| 275 // Ladies and gentlemen, THIS is the main_event! | 276 // Ladies and gentlemen, THIS is the main_event! |
| 276 router->RouteMouseEvent(root_view, &main_event); | 277 router->RouteMouseEvent(root_view, &main_event, ui::LatencyInfo()); |
| 277 | 278 |
| 278 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 279 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
| 279 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 280 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
| 280 EXPECT_EQ(1, main_frame_monitor.event().x); | 281 EXPECT_EQ(1, main_frame_monitor.event().x); |
| 281 EXPECT_EQ(1, main_frame_monitor.event().y); | 282 EXPECT_EQ(1, main_frame_monitor.event().y); |
| 282 } | 283 } |
| 283 | 284 |
| 284 class RedirectNotificationObserver : public NotificationObserver { | 285 class RedirectNotificationObserver : public NotificationObserver { |
| 285 public: | 286 public: |
| 286 // Register to listen for notifications of the given type from either a | 287 // Register to listen for notifications of the given type from either a |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 | 1219 |
| 1219 // Target input event to nested frame. | 1220 // Target input event to nested frame. |
| 1220 blink::WebMouseEvent nested_event; | 1221 blink::WebMouseEvent nested_event; |
| 1221 nested_event.type = blink::WebInputEvent::MouseDown; | 1222 nested_event.type = blink::WebInputEvent::MouseDown; |
| 1222 nested_event.button = blink::WebPointerProperties::Button::Left; | 1223 nested_event.button = blink::WebPointerProperties::Button::Left; |
| 1223 nested_event.x = 125; | 1224 nested_event.x = 125; |
| 1224 nested_event.y = 125; | 1225 nested_event.y = 125; |
| 1225 nested_event.clickCount = 1; | 1226 nested_event.clickCount = 1; |
| 1226 nested_frame_monitor.ResetEventReceived(); | 1227 nested_frame_monitor.ResetEventReceived(); |
| 1227 main_frame_monitor.ResetEventReceived(); | 1228 main_frame_monitor.ResetEventReceived(); |
| 1228 router->RouteMouseEvent(root_view, &nested_event); | 1229 router->RouteMouseEvent(root_view, &nested_event, ui::LatencyInfo()); |
| 1229 | 1230 |
| 1230 EXPECT_TRUE(nested_frame_monitor.EventWasReceived()); | 1231 EXPECT_TRUE(nested_frame_monitor.EventWasReceived()); |
| 1231 EXPECT_EQ(21, nested_frame_monitor.event().x); | 1232 EXPECT_EQ(21, nested_frame_monitor.event().x); |
| 1232 EXPECT_EQ(21, nested_frame_monitor.event().y); | 1233 EXPECT_EQ(21, nested_frame_monitor.event().y); |
| 1233 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | 1234 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
| 1234 } | 1235 } |
| 1235 | 1236 |
| 1236 // This test tests that browser process hittesting ignores frames with | 1237 // This test tests that browser process hittesting ignores frames with |
| 1237 // pointer-events: none. | 1238 // pointer-events: none. |
| 1238 #if defined(OS_ANDROID) | 1239 #if defined(OS_ANDROID) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1283 | 1284 |
| 1284 // Target input event to child frame. | 1285 // Target input event to child frame. |
| 1285 blink::WebMouseEvent child_event; | 1286 blink::WebMouseEvent child_event; |
| 1286 child_event.type = blink::WebInputEvent::MouseDown; | 1287 child_event.type = blink::WebInputEvent::MouseDown; |
| 1287 child_event.button = blink::WebPointerProperties::Button::Left; | 1288 child_event.button = blink::WebPointerProperties::Button::Left; |
| 1288 child_event.x = 75; | 1289 child_event.x = 75; |
| 1289 child_event.y = 75; | 1290 child_event.y = 75; |
| 1290 child_event.clickCount = 1; | 1291 child_event.clickCount = 1; |
| 1291 main_frame_monitor.ResetEventReceived(); | 1292 main_frame_monitor.ResetEventReceived(); |
| 1292 child_frame_monitor.ResetEventReceived(); | 1293 child_frame_monitor.ResetEventReceived(); |
| 1293 router->RouteMouseEvent(root_view, &child_event); | 1294 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo()); |
| 1294 | 1295 |
| 1295 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 1296 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
| 1296 EXPECT_EQ(75, main_frame_monitor.event().x); | 1297 EXPECT_EQ(75, main_frame_monitor.event().x); |
| 1297 EXPECT_EQ(75, main_frame_monitor.event().y); | 1298 EXPECT_EQ(75, main_frame_monitor.event().y); |
| 1298 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 1299 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
| 1299 } | 1300 } |
| 1300 | 1301 |
| 1301 // This test verifies that MouseEnter and MouseLeave events fire correctly | 1302 // This test verifies that MouseEnter and MouseLeave events fire correctly |
| 1302 // when the mouse cursor moves between processes. | 1303 // when the mouse cursor moves between processes. |
| 1303 #if defined(OS_ANDROID) | 1304 #if defined(OS_ANDROID) |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 gfx::Point point_in_d_frame(rwhv_d->GetViewBounds().x() + 2, | 1371 gfx::Point point_in_d_frame(rwhv_d->GetViewBounds().x() + 2, |
| 1371 rwhv_d->GetViewBounds().y() + 2); | 1372 rwhv_d->GetViewBounds().y() + 2); |
| 1372 | 1373 |
| 1373 blink::WebMouseEvent mouse_event; | 1374 blink::WebMouseEvent mouse_event; |
| 1374 mouse_event.type = blink::WebInputEvent::MouseMove; | 1375 mouse_event.type = blink::WebInputEvent::MouseMove; |
| 1375 mouse_event.x = point_in_a_frame.x(); | 1376 mouse_event.x = point_in_a_frame.x(); |
| 1376 mouse_event.y = point_in_a_frame.y(); | 1377 mouse_event.y = point_in_a_frame.y(); |
| 1377 | 1378 |
| 1378 // Send an initial MouseMove to the root view, which shouldn't affect the | 1379 // Send an initial MouseMove to the root view, which shouldn't affect the |
| 1379 // other renderers. | 1380 // other renderers. |
| 1380 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event); | 1381 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, |
| 1382 ui::LatencyInfo()); |
| 1381 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); | 1383 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); |
| 1382 a_frame_monitor.ResetEventReceived(); | 1384 a_frame_monitor.ResetEventReceived(); |
| 1383 EXPECT_FALSE(b_frame_monitor.EventWasReceived()); | 1385 EXPECT_FALSE(b_frame_monitor.EventWasReceived()); |
| 1384 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); | 1386 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); |
| 1385 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); | 1387 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); |
| 1386 | 1388 |
| 1387 // Next send a MouseMove to B frame, which shouldn't affect C or D but | 1389 // Next send a MouseMove to B frame, which shouldn't affect C or D but |
| 1388 // A should receive a MouseMove event. | 1390 // A should receive a MouseMove event. |
| 1389 mouse_event.x = point_in_b_frame.x(); | 1391 mouse_event.x = point_in_b_frame.x(); |
| 1390 mouse_event.y = point_in_b_frame.y(); | 1392 mouse_event.y = point_in_b_frame.y(); |
| 1391 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event); | 1393 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, |
| 1394 ui::LatencyInfo()); |
| 1392 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); | 1395 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); |
| 1393 EXPECT_EQ(a_frame_monitor.event().type, blink::WebInputEvent::MouseMove); | 1396 EXPECT_EQ(a_frame_monitor.event().type, blink::WebInputEvent::MouseMove); |
| 1394 a_frame_monitor.ResetEventReceived(); | 1397 a_frame_monitor.ResetEventReceived(); |
| 1395 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); | 1398 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); |
| 1396 b_frame_monitor.ResetEventReceived(); | 1399 b_frame_monitor.ResetEventReceived(); |
| 1397 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); | 1400 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); |
| 1398 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); | 1401 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); |
| 1399 | 1402 |
| 1400 // Next send a MouseMove to D frame, which should have side effects in every | 1403 // Next send a MouseMove to D frame, which should have side effects in every |
| 1401 // other RenderWidgetHostView. | 1404 // other RenderWidgetHostView. |
| 1402 mouse_event.x = point_in_d_frame.x(); | 1405 mouse_event.x = point_in_d_frame.x(); |
| 1403 mouse_event.y = point_in_d_frame.y(); | 1406 mouse_event.y = point_in_d_frame.y(); |
| 1404 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event); | 1407 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, |
| 1408 ui::LatencyInfo()); |
| 1405 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); | 1409 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); |
| 1406 EXPECT_EQ(a_frame_monitor.event().type, blink::WebInputEvent::MouseMove); | 1410 EXPECT_EQ(a_frame_monitor.event().type, blink::WebInputEvent::MouseMove); |
| 1407 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); | 1411 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); |
| 1408 EXPECT_EQ(b_frame_monitor.event().type, blink::WebInputEvent::MouseLeave); | 1412 EXPECT_EQ(b_frame_monitor.event().type, blink::WebInputEvent::MouseLeave); |
| 1409 EXPECT_TRUE(c_frame_monitor.EventWasReceived()); | 1413 EXPECT_TRUE(c_frame_monitor.EventWasReceived()); |
| 1410 EXPECT_EQ(c_frame_monitor.event().type, blink::WebInputEvent::MouseMove); | 1414 EXPECT_EQ(c_frame_monitor.event().type, blink::WebInputEvent::MouseMove); |
| 1411 EXPECT_TRUE(d_frame_monitor.EventWasReceived()); | 1415 EXPECT_TRUE(d_frame_monitor.EventWasReceived()); |
| 1412 } | 1416 } |
| 1413 | 1417 |
| 1414 // Tests OOPIF rendering by checking that the RWH of the iframe generates | 1418 // Tests OOPIF rendering by checking that the RWH of the iframe generates |
| (...skipping 3551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4966 // Send a MouseMove to the subframe. The frame contains text, and moving the | 4970 // Send a MouseMove to the subframe. The frame contains text, and moving the |
| 4967 // mouse over it should cause the renderer to send a mouse cursor update. | 4971 // mouse over it should cause the renderer to send a mouse cursor update. |
| 4968 blink::WebMouseEvent mouse_event; | 4972 blink::WebMouseEvent mouse_event; |
| 4969 mouse_event.type = blink::WebInputEvent::MouseMove; | 4973 mouse_event.type = blink::WebInputEvent::MouseMove; |
| 4970 mouse_event.x = 60; | 4974 mouse_event.x = 60; |
| 4971 mouse_event.y = 60; | 4975 mouse_event.y = 60; |
| 4972 RenderWidgetHost* rwh_child = | 4976 RenderWidgetHost* rwh_child = |
| 4973 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); | 4977 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); |
| 4974 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | 4978 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
| 4975 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 4979 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 4976 web_contents()->GetInputEventRouter()->RouteMouseEvent(root_view, | 4980 web_contents()->GetInputEventRouter()->RouteMouseEvent( |
| 4977 &mouse_event); | 4981 root_view, &mouse_event, ui::LatencyInfo()); |
| 4978 | 4982 |
| 4979 // CursorMessageFilter::Wait() implicitly tests whether we receive a | 4983 // CursorMessageFilter::Wait() implicitly tests whether we receive a |
| 4980 // ViewHostMsg_SetCursor message from the renderer process, because it does | 4984 // ViewHostMsg_SetCursor message from the renderer process, because it does |
| 4981 // does not return otherwise. | 4985 // does not return otherwise. |
| 4982 filter->Wait(); | 4986 filter->Wait(); |
| 4983 EXPECT_EQ(filter->last_set_cursor_routing_id(), rwh_child->GetRoutingID()); | 4987 EXPECT_EQ(filter->last_set_cursor_routing_id(), rwh_child->GetRoutingID()); |
| 4984 } | 4988 } |
| 4985 #endif | 4989 #endif |
| 4986 | 4990 |
| 4987 // Tests that we are using the correct RenderFrameProxy when navigating an | 4991 // Tests that we are using the correct RenderFrameProxy when navigating an |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5492 | 5496 |
| 5493 gfx::Point point(75, 75); | 5497 gfx::Point point(75, 75); |
| 5494 | 5498 |
| 5495 // Target right-click event to child frame. | 5499 // Target right-click event to child frame. |
| 5496 blink::WebMouseEvent click_event; | 5500 blink::WebMouseEvent click_event; |
| 5497 click_event.type = blink::WebInputEvent::MouseDown; | 5501 click_event.type = blink::WebInputEvent::MouseDown; |
| 5498 click_event.button = blink::WebPointerProperties::Button::Right; | 5502 click_event.button = blink::WebPointerProperties::Button::Right; |
| 5499 click_event.x = point.x(); | 5503 click_event.x = point.x(); |
| 5500 click_event.y = point.y(); | 5504 click_event.y = point.y(); |
| 5501 click_event.clickCount = 1; | 5505 click_event.clickCount = 1; |
| 5502 router->RouteMouseEvent(root_view, &click_event); | 5506 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo()); |
| 5503 | 5507 |
| 5504 // We also need a MouseUp event, needed by Windows. | 5508 // We also need a MouseUp event, needed by Windows. |
| 5505 click_event.type = blink::WebInputEvent::MouseUp; | 5509 click_event.type = blink::WebInputEvent::MouseUp; |
| 5506 click_event.x = point.x(); | 5510 click_event.x = point.x(); |
| 5507 click_event.y = point.y(); | 5511 click_event.y = point.y(); |
| 5508 router->RouteMouseEvent(root_view, &click_event); | 5512 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo()); |
| 5509 | 5513 |
| 5510 context_menu_delegate.Wait(); | 5514 context_menu_delegate.Wait(); |
| 5511 | 5515 |
| 5512 ContextMenuParams params = context_menu_delegate.getParams(); | 5516 ContextMenuParams params = context_menu_delegate.getParams(); |
| 5513 | 5517 |
| 5514 EXPECT_EQ(point.x(), params.x); | 5518 EXPECT_EQ(point.x(), params.x); |
| 5515 EXPECT_EQ(point.y(), params.y); | 5519 EXPECT_EQ(point.y(), params.y); |
| 5516 } | 5520 } |
| 5517 | 5521 |
| 5518 // Test that a mouse right-click to an out-of-process iframe causes a context | 5522 // Test that a mouse right-click to an out-of-process iframe causes a context |
| (...skipping 2572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8091 " Site A ------------ proxies for B C\n" | 8095 " Site A ------------ proxies for B C\n" |
| 8092 " +--Site B ------- proxies for A C\n" | 8096 " +--Site B ------- proxies for A C\n" |
| 8093 " +--Site C -- proxies for A B\n" | 8097 " +--Site C -- proxies for A B\n" |
| 8094 "Where A = http://a.com/\n" | 8098 "Where A = http://a.com/\n" |
| 8095 " B = http://b.com/\n" | 8099 " B = http://b.com/\n" |
| 8096 " C = http://c.com/", | 8100 " C = http://c.com/", |
| 8097 DepictFrameTree(root)); | 8101 DepictFrameTree(root)); |
| 8098 } | 8102 } |
| 8099 | 8103 |
| 8100 } // namespace content | 8104 } // namespace content |
| OLD | NEW |