| 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(), | 1371 gfx::Point point_in_d_frame(rwhv_d->GetViewBounds().x(), |
| 1371 rwhv_d->GetViewBounds().y()); | 1372 rwhv_d->GetViewBounds().y()); |
| 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 // Verify that mouse capture works on a RenderWidgetHostView level, so that | 1418 // Verify that mouse capture works on a RenderWidgetHostView level, so that |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 | 1461 |
| 1458 // Target MouseDown to child frame. | 1462 // Target MouseDown to child frame. |
| 1459 blink::WebMouseEvent mouse_event; | 1463 blink::WebMouseEvent mouse_event; |
| 1460 mouse_event.type = blink::WebInputEvent::MouseDown; | 1464 mouse_event.type = blink::WebInputEvent::MouseDown; |
| 1461 mouse_event.button = blink::WebPointerProperties::Button::Left; | 1465 mouse_event.button = blink::WebPointerProperties::Button::Left; |
| 1462 mouse_event.x = 75; | 1466 mouse_event.x = 75; |
| 1463 mouse_event.y = 75; | 1467 mouse_event.y = 75; |
| 1464 mouse_event.clickCount = 1; | 1468 mouse_event.clickCount = 1; |
| 1465 main_frame_monitor.ResetEventReceived(); | 1469 main_frame_monitor.ResetEventReceived(); |
| 1466 child_frame_monitor.ResetEventReceived(); | 1470 child_frame_monitor.ResetEventReceived(); |
| 1467 router->RouteMouseEvent(root_view, &mouse_event); | 1471 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
| 1468 | 1472 |
| 1469 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | 1473 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
| 1470 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | 1474 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
| 1471 | 1475 |
| 1472 // Target MouseMove to main frame. This should still be routed to the | 1476 // Target MouseMove to main frame. This should still be routed to the |
| 1473 // child frame because it is now capturing mouse input. | 1477 // child frame because it is now capturing mouse input. |
| 1474 mouse_event.type = blink::WebInputEvent::MouseMove; | 1478 mouse_event.type = blink::WebInputEvent::MouseMove; |
| 1475 mouse_event.modifiers = blink::WebInputEvent::LeftButtonDown; | 1479 mouse_event.modifiers = blink::WebInputEvent::LeftButtonDown; |
| 1476 mouse_event.x = 1; | 1480 mouse_event.x = 1; |
| 1477 mouse_event.y = 1; | 1481 mouse_event.y = 1; |
| 1478 // Note that this event is sent twice, with the monitors cleared after | 1482 // Note that this event is sent twice, with the monitors cleared after |
| 1479 // the first time, because the first MouseMove to the child frame | 1483 // the first time, because the first MouseMove to the child frame |
| 1480 // causes a MouseMove to be sent to the main frame also, which we | 1484 // causes a MouseMove to be sent to the main frame also, which we |
| 1481 // need to ignore. | 1485 // need to ignore. |
| 1482 router->RouteMouseEvent(root_view, &mouse_event); | 1486 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
| 1483 main_frame_monitor.ResetEventReceived(); | 1487 main_frame_monitor.ResetEventReceived(); |
| 1484 child_frame_monitor.ResetEventReceived(); | 1488 child_frame_monitor.ResetEventReceived(); |
| 1485 mouse_event.x = 1; | 1489 mouse_event.x = 1; |
| 1486 mouse_event.y = 2; | 1490 mouse_event.y = 2; |
| 1487 router->RouteMouseEvent(root_view, &mouse_event); | 1491 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
| 1488 | 1492 |
| 1489 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | 1493 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
| 1490 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | 1494 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
| 1491 | 1495 |
| 1492 // A MouseUp to the child frame should cancel the mouse capture. | 1496 // A MouseUp to the child frame should cancel the mouse capture. |
| 1493 mouse_event.type = blink::WebInputEvent::MouseUp; | 1497 mouse_event.type = blink::WebInputEvent::MouseUp; |
| 1494 mouse_event.modifiers = 0; | 1498 mouse_event.modifiers = 0; |
| 1495 mouse_event.x = 75; | 1499 mouse_event.x = 75; |
| 1496 mouse_event.y = 75; | 1500 mouse_event.y = 75; |
| 1497 main_frame_monitor.ResetEventReceived(); | 1501 main_frame_monitor.ResetEventReceived(); |
| 1498 child_frame_monitor.ResetEventReceived(); | 1502 child_frame_monitor.ResetEventReceived(); |
| 1499 router->RouteMouseEvent(root_view, &mouse_event); | 1503 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
| 1500 | 1504 |
| 1501 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | 1505 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
| 1502 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | 1506 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
| 1503 | 1507 |
| 1504 // Subsequent MouseMove events targeted to the main frame should be routed | 1508 // Subsequent MouseMove events targeted to the main frame should be routed |
| 1505 // to that frame. | 1509 // to that frame. |
| 1506 mouse_event.type = blink::WebInputEvent::MouseMove; | 1510 mouse_event.type = blink::WebInputEvent::MouseMove; |
| 1507 mouse_event.x = 1; | 1511 mouse_event.x = 1; |
| 1508 mouse_event.y = 3; | 1512 mouse_event.y = 3; |
| 1509 // Sending the MouseMove twice for the same reason as above. | 1513 // Sending the MouseMove twice for the same reason as above. |
| 1510 router->RouteMouseEvent(root_view, &mouse_event); | 1514 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
| 1511 main_frame_monitor.ResetEventReceived(); | 1515 main_frame_monitor.ResetEventReceived(); |
| 1512 child_frame_monitor.ResetEventReceived(); | 1516 child_frame_monitor.ResetEventReceived(); |
| 1513 mouse_event.x = 1; | 1517 mouse_event.x = 1; |
| 1514 mouse_event.y = 4; | 1518 mouse_event.y = 4; |
| 1515 router->RouteMouseEvent(root_view, &mouse_event); | 1519 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
| 1516 | 1520 |
| 1517 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 1521 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
| 1518 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 1522 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
| 1519 | 1523 |
| 1520 // Target MouseDown to the main frame to cause it to capture input. | 1524 // Target MouseDown to the main frame to cause it to capture input. |
| 1521 mouse_event.type = blink::WebInputEvent::MouseDown; | 1525 mouse_event.type = blink::WebInputEvent::MouseDown; |
| 1522 mouse_event.x = 1; | 1526 mouse_event.x = 1; |
| 1523 mouse_event.y = 1; | 1527 mouse_event.y = 1; |
| 1524 main_frame_monitor.ResetEventReceived(); | 1528 main_frame_monitor.ResetEventReceived(); |
| 1525 child_frame_monitor.ResetEventReceived(); | 1529 child_frame_monitor.ResetEventReceived(); |
| 1526 router->RouteMouseEvent(root_view, &mouse_event); | 1530 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
| 1527 | 1531 |
| 1528 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 1532 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
| 1529 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 1533 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
| 1530 | 1534 |
| 1531 // Sending a MouseMove to the child frame should still result in the main | 1535 // Sending a MouseMove to the child frame should still result in the main |
| 1532 // frame receiving the event. | 1536 // frame receiving the event. |
| 1533 mouse_event.type = blink::WebInputEvent::MouseMove; | 1537 mouse_event.type = blink::WebInputEvent::MouseMove; |
| 1534 mouse_event.modifiers = blink::WebInputEvent::LeftButtonDown; | 1538 mouse_event.modifiers = blink::WebInputEvent::LeftButtonDown; |
| 1535 mouse_event.x = 75; | 1539 mouse_event.x = 75; |
| 1536 mouse_event.y = 75; | 1540 mouse_event.y = 75; |
| 1537 main_frame_monitor.ResetEventReceived(); | 1541 main_frame_monitor.ResetEventReceived(); |
| 1538 child_frame_monitor.ResetEventReceived(); | 1542 child_frame_monitor.ResetEventReceived(); |
| 1539 router->RouteMouseEvent(root_view, &mouse_event); | 1543 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); |
| 1540 | 1544 |
| 1541 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 1545 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
| 1542 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 1546 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
| 1543 } | 1547 } |
| 1544 | 1548 |
| 1545 // Tests OOPIF rendering by checking that the RWH of the iframe generates | 1549 // Tests OOPIF rendering by checking that the RWH of the iframe generates |
| 1546 // OnSwapCompositorFrame message. | 1550 // OnSwapCompositorFrame message. |
| 1547 #if defined(OS_ANDROID) | 1551 #if defined(OS_ANDROID) |
| 1548 // http://crbug.com/471850 | 1552 // http://crbug.com/471850 |
| 1549 #define MAYBE_CompositorFrameSwapped DISABLED_CompositorFrameSwapped | 1553 #define MAYBE_CompositorFrameSwapped DISABLED_CompositorFrameSwapped |
| (...skipping 3547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5097 // Send a MouseMove to the subframe. The frame contains text, and moving the | 5101 // Send a MouseMove to the subframe. The frame contains text, and moving the |
| 5098 // mouse over it should cause the renderer to send a mouse cursor update. | 5102 // mouse over it should cause the renderer to send a mouse cursor update. |
| 5099 blink::WebMouseEvent mouse_event; | 5103 blink::WebMouseEvent mouse_event; |
| 5100 mouse_event.type = blink::WebInputEvent::MouseMove; | 5104 mouse_event.type = blink::WebInputEvent::MouseMove; |
| 5101 mouse_event.x = 60; | 5105 mouse_event.x = 60; |
| 5102 mouse_event.y = 60; | 5106 mouse_event.y = 60; |
| 5103 RenderWidgetHost* rwh_child = | 5107 RenderWidgetHost* rwh_child = |
| 5104 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); | 5108 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); |
| 5105 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | 5109 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
| 5106 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 5110 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 5107 web_contents()->GetInputEventRouter()->RouteMouseEvent(root_view, | 5111 web_contents()->GetInputEventRouter()->RouteMouseEvent( |
| 5108 &mouse_event); | 5112 root_view, &mouse_event, ui::LatencyInfo()); |
| 5109 | 5113 |
| 5110 // CursorMessageFilter::Wait() implicitly tests whether we receive a | 5114 // CursorMessageFilter::Wait() implicitly tests whether we receive a |
| 5111 // ViewHostMsg_SetCursor message from the renderer process, because it does | 5115 // ViewHostMsg_SetCursor message from the renderer process, because it does |
| 5112 // does not return otherwise. | 5116 // does not return otherwise. |
| 5113 filter->Wait(); | 5117 filter->Wait(); |
| 5114 EXPECT_EQ(filter->last_set_cursor_routing_id(), rwh_child->GetRoutingID()); | 5118 EXPECT_EQ(filter->last_set_cursor_routing_id(), rwh_child->GetRoutingID()); |
| 5115 } | 5119 } |
| 5116 #endif | 5120 #endif |
| 5117 | 5121 |
| 5118 // Tests that we are using the correct RenderFrameProxy when navigating an | 5122 // Tests that we are using the correct RenderFrameProxy when navigating an |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5623 | 5627 |
| 5624 gfx::Point point(75, 75); | 5628 gfx::Point point(75, 75); |
| 5625 | 5629 |
| 5626 // Target right-click event to child frame. | 5630 // Target right-click event to child frame. |
| 5627 blink::WebMouseEvent click_event; | 5631 blink::WebMouseEvent click_event; |
| 5628 click_event.type = blink::WebInputEvent::MouseDown; | 5632 click_event.type = blink::WebInputEvent::MouseDown; |
| 5629 click_event.button = blink::WebPointerProperties::Button::Right; | 5633 click_event.button = blink::WebPointerProperties::Button::Right; |
| 5630 click_event.x = point.x(); | 5634 click_event.x = point.x(); |
| 5631 click_event.y = point.y(); | 5635 click_event.y = point.y(); |
| 5632 click_event.clickCount = 1; | 5636 click_event.clickCount = 1; |
| 5633 router->RouteMouseEvent(root_view, &click_event); | 5637 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo()); |
| 5634 | 5638 |
| 5635 // We also need a MouseUp event, needed by Windows. | 5639 // We also need a MouseUp event, needed by Windows. |
| 5636 click_event.type = blink::WebInputEvent::MouseUp; | 5640 click_event.type = blink::WebInputEvent::MouseUp; |
| 5637 click_event.x = point.x(); | 5641 click_event.x = point.x(); |
| 5638 click_event.y = point.y(); | 5642 click_event.y = point.y(); |
| 5639 router->RouteMouseEvent(root_view, &click_event); | 5643 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo()); |
| 5640 | 5644 |
| 5641 context_menu_delegate.Wait(); | 5645 context_menu_delegate.Wait(); |
| 5642 | 5646 |
| 5643 ContextMenuParams params = context_menu_delegate.getParams(); | 5647 ContextMenuParams params = context_menu_delegate.getParams(); |
| 5644 | 5648 |
| 5645 EXPECT_EQ(point.x(), params.x); | 5649 EXPECT_EQ(point.x(), params.x); |
| 5646 EXPECT_EQ(point.y(), params.y); | 5650 EXPECT_EQ(point.y(), params.y); |
| 5647 } | 5651 } |
| 5648 | 5652 |
| 5649 // Test that a mouse right-click to an out-of-process iframe causes a context | 5653 // 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... |
| 8222 " Site A ------------ proxies for B C\n" | 8226 " Site A ------------ proxies for B C\n" |
| 8223 " +--Site B ------- proxies for A C\n" | 8227 " +--Site B ------- proxies for A C\n" |
| 8224 " +--Site C -- proxies for A B\n" | 8228 " +--Site C -- proxies for A B\n" |
| 8225 "Where A = http://a.com/\n" | 8229 "Where A = http://a.com/\n" |
| 8226 " B = http://b.com/\n" | 8230 " B = http://b.com/\n" |
| 8227 " C = http://c.com/", | 8231 " C = http://c.com/", |
| 8228 DepictFrameTree(root)); | 8232 DepictFrameTree(root)); |
| 8229 } | 8233 } |
| 8230 | 8234 |
| 8231 } // namespace content | 8235 } // namespace content |
| OLD | NEW |