| 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" | |
| 68 #include "ui/gfx/geometry/point.h" | 67 #include "ui/gfx/geometry/point.h" |
| 69 | 68 |
| 70 #if defined(USE_AURA) | 69 #if defined(USE_AURA) |
| 71 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 70 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 72 #endif | 71 #endif |
| 73 | 72 |
| 74 #if defined(OS_MACOSX) | 73 #if defined(OS_MACOSX) |
| 75 #include "ui/base/test/scoped_preferred_scroller_style_mac.h" | 74 #include "ui/base/test/scoped_preferred_scroller_style_mac.h" |
| 76 #endif | 75 #endif |
| 77 | 76 |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 248 |
| 250 // Target input event to child frame. | 249 // Target input event to child frame. |
| 251 blink::WebMouseEvent child_event; | 250 blink::WebMouseEvent child_event; |
| 252 child_event.type = blink::WebInputEvent::MouseDown; | 251 child_event.type = blink::WebInputEvent::MouseDown; |
| 253 child_event.button = blink::WebPointerProperties::Button::Left; | 252 child_event.button = blink::WebPointerProperties::Button::Left; |
| 254 child_event.x = 75; | 253 child_event.x = 75; |
| 255 child_event.y = 75; | 254 child_event.y = 75; |
| 256 child_event.clickCount = 1; | 255 child_event.clickCount = 1; |
| 257 main_frame_monitor.ResetEventReceived(); | 256 main_frame_monitor.ResetEventReceived(); |
| 258 child_frame_monitor.ResetEventReceived(); | 257 child_frame_monitor.ResetEventReceived(); |
| 259 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo()); | 258 router->RouteMouseEvent(root_view, &child_event); |
| 260 | 259 |
| 261 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | 260 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
| 262 EXPECT_EQ(23, child_frame_monitor.event().x); | 261 EXPECT_EQ(23, child_frame_monitor.event().x); |
| 263 EXPECT_EQ(23, child_frame_monitor.event().y); | 262 EXPECT_EQ(23, child_frame_monitor.event().y); |
| 264 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | 263 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
| 265 | 264 |
| 266 child_frame_monitor.ResetEventReceived(); | 265 child_frame_monitor.ResetEventReceived(); |
| 267 main_frame_monitor.ResetEventReceived(); | 266 main_frame_monitor.ResetEventReceived(); |
| 268 | 267 |
| 269 // Target input event to main frame. | 268 // Target input event to main frame. |
| 270 blink::WebMouseEvent main_event; | 269 blink::WebMouseEvent main_event; |
| 271 main_event.type = blink::WebInputEvent::MouseDown; | 270 main_event.type = blink::WebInputEvent::MouseDown; |
| 272 main_event.button = blink::WebPointerProperties::Button::Left; | 271 main_event.button = blink::WebPointerProperties::Button::Left; |
| 273 main_event.x = 1; | 272 main_event.x = 1; |
| 274 main_event.y = 1; | 273 main_event.y = 1; |
| 275 main_event.clickCount = 1; | 274 main_event.clickCount = 1; |
| 276 // Ladies and gentlemen, THIS is the main_event! | 275 // Ladies and gentlemen, THIS is the main_event! |
| 277 router->RouteMouseEvent(root_view, &main_event, ui::LatencyInfo()); | 276 router->RouteMouseEvent(root_view, &main_event); |
| 278 | 277 |
| 279 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 278 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
| 280 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 279 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
| 281 EXPECT_EQ(1, main_frame_monitor.event().x); | 280 EXPECT_EQ(1, main_frame_monitor.event().x); |
| 282 EXPECT_EQ(1, main_frame_monitor.event().y); | 281 EXPECT_EQ(1, main_frame_monitor.event().y); |
| 283 } | 282 } |
| 284 | 283 |
| 285 class RedirectNotificationObserver : public NotificationObserver { | 284 class RedirectNotificationObserver : public NotificationObserver { |
| 286 public: | 285 public: |
| 287 // Register to listen for notifications of the given type from either a | 286 // 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... |
| 1219 | 1218 |
| 1220 // Target input event to nested frame. | 1219 // Target input event to nested frame. |
| 1221 blink::WebMouseEvent nested_event; | 1220 blink::WebMouseEvent nested_event; |
| 1222 nested_event.type = blink::WebInputEvent::MouseDown; | 1221 nested_event.type = blink::WebInputEvent::MouseDown; |
| 1223 nested_event.button = blink::WebPointerProperties::Button::Left; | 1222 nested_event.button = blink::WebPointerProperties::Button::Left; |
| 1224 nested_event.x = 125; | 1223 nested_event.x = 125; |
| 1225 nested_event.y = 125; | 1224 nested_event.y = 125; |
| 1226 nested_event.clickCount = 1; | 1225 nested_event.clickCount = 1; |
| 1227 nested_frame_monitor.ResetEventReceived(); | 1226 nested_frame_monitor.ResetEventReceived(); |
| 1228 main_frame_monitor.ResetEventReceived(); | 1227 main_frame_monitor.ResetEventReceived(); |
| 1229 router->RouteMouseEvent(root_view, &nested_event, ui::LatencyInfo()); | 1228 router->RouteMouseEvent(root_view, &nested_event); |
| 1230 | 1229 |
| 1231 EXPECT_TRUE(nested_frame_monitor.EventWasReceived()); | 1230 EXPECT_TRUE(nested_frame_monitor.EventWasReceived()); |
| 1232 EXPECT_EQ(21, nested_frame_monitor.event().x); | 1231 EXPECT_EQ(21, nested_frame_monitor.event().x); |
| 1233 EXPECT_EQ(21, nested_frame_monitor.event().y); | 1232 EXPECT_EQ(21, nested_frame_monitor.event().y); |
| 1234 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | 1233 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
| 1235 } | 1234 } |
| 1236 | 1235 |
| 1237 // This test tests that browser process hittesting ignores frames with | 1236 // This test tests that browser process hittesting ignores frames with |
| 1238 // pointer-events: none. | 1237 // pointer-events: none. |
| 1239 #if defined(OS_ANDROID) | 1238 #if defined(OS_ANDROID) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1284 | 1283 |
| 1285 // Target input event to child frame. | 1284 // Target input event to child frame. |
| 1286 blink::WebMouseEvent child_event; | 1285 blink::WebMouseEvent child_event; |
| 1287 child_event.type = blink::WebInputEvent::MouseDown; | 1286 child_event.type = blink::WebInputEvent::MouseDown; |
| 1288 child_event.button = blink::WebPointerProperties::Button::Left; | 1287 child_event.button = blink::WebPointerProperties::Button::Left; |
| 1289 child_event.x = 75; | 1288 child_event.x = 75; |
| 1290 child_event.y = 75; | 1289 child_event.y = 75; |
| 1291 child_event.clickCount = 1; | 1290 child_event.clickCount = 1; |
| 1292 main_frame_monitor.ResetEventReceived(); | 1291 main_frame_monitor.ResetEventReceived(); |
| 1293 child_frame_monitor.ResetEventReceived(); | 1292 child_frame_monitor.ResetEventReceived(); |
| 1294 router->RouteMouseEvent(root_view, &child_event, ui::LatencyInfo()); | 1293 router->RouteMouseEvent(root_view, &child_event); |
| 1295 | 1294 |
| 1296 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 1295 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
| 1297 EXPECT_EQ(75, main_frame_monitor.event().x); | 1296 EXPECT_EQ(75, main_frame_monitor.event().x); |
| 1298 EXPECT_EQ(75, main_frame_monitor.event().y); | 1297 EXPECT_EQ(75, main_frame_monitor.event().y); |
| 1299 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 1298 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
| 1300 } | 1299 } |
| 1301 | 1300 |
| 1302 // This test verifies that MouseEnter and MouseLeave events fire correctly | 1301 // This test verifies that MouseEnter and MouseLeave events fire correctly |
| 1303 // when the mouse cursor moves between processes. | 1302 // when the mouse cursor moves between processes. |
| 1304 #if defined(OS_ANDROID) | 1303 #if defined(OS_ANDROID) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 gfx::Point point_in_b_frame(313, 147); | 1368 gfx::Point point_in_b_frame(313, 147); |
| 1370 gfx::Point point_in_d_frame(471, 207); | 1369 gfx::Point point_in_d_frame(471, 207); |
| 1371 | 1370 |
| 1372 blink::WebMouseEvent mouse_event; | 1371 blink::WebMouseEvent mouse_event; |
| 1373 mouse_event.type = blink::WebInputEvent::MouseMove; | 1372 mouse_event.type = blink::WebInputEvent::MouseMove; |
| 1374 mouse_event.x = point_in_a_frame.x(); | 1373 mouse_event.x = point_in_a_frame.x(); |
| 1375 mouse_event.y = point_in_a_frame.y(); | 1374 mouse_event.y = point_in_a_frame.y(); |
| 1376 | 1375 |
| 1377 // Send an initial MouseMove to the root view, which shouldn't affect the | 1376 // Send an initial MouseMove to the root view, which shouldn't affect the |
| 1378 // other renderers. | 1377 // other renderers. |
| 1379 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, | 1378 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event); |
| 1380 ui::LatencyInfo()); | |
| 1381 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); | 1379 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); |
| 1382 a_frame_monitor.ResetEventReceived(); | 1380 a_frame_monitor.ResetEventReceived(); |
| 1383 EXPECT_FALSE(b_frame_monitor.EventWasReceived()); | 1381 EXPECT_FALSE(b_frame_monitor.EventWasReceived()); |
| 1384 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); | 1382 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); |
| 1385 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); | 1383 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); |
| 1386 | 1384 |
| 1387 // Next send a MouseMove to B frame, which shouldn't affect C or D but | 1385 // Next send a MouseMove to B frame, which shouldn't affect C or D but |
| 1388 // A should receive a MouseMove event. | 1386 // A should receive a MouseMove event. |
| 1389 mouse_event.x = point_in_b_frame.x(); | 1387 mouse_event.x = point_in_b_frame.x(); |
| 1390 mouse_event.y = point_in_b_frame.y(); | 1388 mouse_event.y = point_in_b_frame.y(); |
| 1391 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, | 1389 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event); |
| 1392 ui::LatencyInfo()); | |
| 1393 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); | 1390 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); |
| 1394 EXPECT_EQ(a_frame_monitor.event().type, blink::WebInputEvent::MouseMove); | 1391 EXPECT_EQ(a_frame_monitor.event().type, blink::WebInputEvent::MouseMove); |
| 1395 a_frame_monitor.ResetEventReceived(); | 1392 a_frame_monitor.ResetEventReceived(); |
| 1396 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); | 1393 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); |
| 1397 b_frame_monitor.ResetEventReceived(); | 1394 b_frame_monitor.ResetEventReceived(); |
| 1398 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); | 1395 EXPECT_FALSE(c_frame_monitor.EventWasReceived()); |
| 1399 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); | 1396 EXPECT_FALSE(d_frame_monitor.EventWasReceived()); |
| 1400 | 1397 |
| 1401 // Next send a MouseMove to D frame, which should have side effects in every | 1398 // Next send a MouseMove to D frame, which should have side effects in every |
| 1402 // other RenderWidgetHostView. | 1399 // other RenderWidgetHostView. |
| 1403 mouse_event.x = point_in_d_frame.x(); | 1400 mouse_event.x = point_in_d_frame.x(); |
| 1404 mouse_event.y = point_in_d_frame.y(); | 1401 mouse_event.y = point_in_d_frame.y(); |
| 1405 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event, | 1402 web_contents()->GetInputEventRouter()->RouteMouseEvent(rwhv_a, &mouse_event); |
| 1406 ui::LatencyInfo()); | |
| 1407 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); | 1403 EXPECT_TRUE(a_frame_monitor.EventWasReceived()); |
| 1408 EXPECT_EQ(a_frame_monitor.event().type, blink::WebInputEvent::MouseMove); | 1404 EXPECT_EQ(a_frame_monitor.event().type, blink::WebInputEvent::MouseMove); |
| 1409 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); | 1405 EXPECT_TRUE(b_frame_monitor.EventWasReceived()); |
| 1410 EXPECT_EQ(b_frame_monitor.event().type, blink::WebInputEvent::MouseLeave); | 1406 EXPECT_EQ(b_frame_monitor.event().type, blink::WebInputEvent::MouseLeave); |
| 1411 EXPECT_TRUE(c_frame_monitor.EventWasReceived()); | 1407 EXPECT_TRUE(c_frame_monitor.EventWasReceived()); |
| 1412 EXPECT_EQ(c_frame_monitor.event().type, blink::WebInputEvent::MouseMove); | 1408 EXPECT_EQ(c_frame_monitor.event().type, blink::WebInputEvent::MouseMove); |
| 1413 EXPECT_TRUE(d_frame_monitor.EventWasReceived()); | 1409 EXPECT_TRUE(d_frame_monitor.EventWasReceived()); |
| 1414 } | 1410 } |
| 1415 | 1411 |
| 1416 // Verify that mouse capture works on a RenderWidgetHostView level, so that | 1412 // Verify that mouse capture works on a RenderWidgetHostView level, so that |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 | 1455 |
| 1460 // Target MouseDown to child frame. | 1456 // Target MouseDown to child frame. |
| 1461 blink::WebMouseEvent mouse_event; | 1457 blink::WebMouseEvent mouse_event; |
| 1462 mouse_event.type = blink::WebInputEvent::MouseDown; | 1458 mouse_event.type = blink::WebInputEvent::MouseDown; |
| 1463 mouse_event.button = blink::WebPointerProperties::Button::Left; | 1459 mouse_event.button = blink::WebPointerProperties::Button::Left; |
| 1464 mouse_event.x = 75; | 1460 mouse_event.x = 75; |
| 1465 mouse_event.y = 75; | 1461 mouse_event.y = 75; |
| 1466 mouse_event.clickCount = 1; | 1462 mouse_event.clickCount = 1; |
| 1467 main_frame_monitor.ResetEventReceived(); | 1463 main_frame_monitor.ResetEventReceived(); |
| 1468 child_frame_monitor.ResetEventReceived(); | 1464 child_frame_monitor.ResetEventReceived(); |
| 1469 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1465 router->RouteMouseEvent(root_view, &mouse_event); |
| 1470 | 1466 |
| 1471 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | 1467 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
| 1472 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | 1468 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
| 1473 | 1469 |
| 1474 // Target MouseMove to main frame. This should still be routed to the | 1470 // Target MouseMove to main frame. This should still be routed to the |
| 1475 // child frame because it is now capturing mouse input. | 1471 // child frame because it is now capturing mouse input. |
| 1476 mouse_event.type = blink::WebInputEvent::MouseMove; | 1472 mouse_event.type = blink::WebInputEvent::MouseMove; |
| 1477 mouse_event.modifiers = blink::WebInputEvent::LeftButtonDown; | 1473 mouse_event.modifiers = blink::WebInputEvent::LeftButtonDown; |
| 1478 mouse_event.x = 1; | 1474 mouse_event.x = 1; |
| 1479 mouse_event.y = 1; | 1475 mouse_event.y = 1; |
| 1480 // Note that this event is sent twice, with the monitors cleared after | 1476 // Note that this event is sent twice, with the monitors cleared after |
| 1481 // the first time, because the first MouseMove to the child frame | 1477 // the first time, because the first MouseMove to the child frame |
| 1482 // causes a MouseMove to be sent to the main frame also, which we | 1478 // causes a MouseMove to be sent to the main frame also, which we |
| 1483 // need to ignore. | 1479 // need to ignore. |
| 1484 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1480 router->RouteMouseEvent(root_view, &mouse_event); |
| 1485 main_frame_monitor.ResetEventReceived(); | 1481 main_frame_monitor.ResetEventReceived(); |
| 1486 child_frame_monitor.ResetEventReceived(); | 1482 child_frame_monitor.ResetEventReceived(); |
| 1487 mouse_event.x = 1; | 1483 mouse_event.x = 1; |
| 1488 mouse_event.y = 2; | 1484 mouse_event.y = 2; |
| 1489 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1485 router->RouteMouseEvent(root_view, &mouse_event); |
| 1490 | 1486 |
| 1491 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | 1487 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
| 1492 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | 1488 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
| 1493 | 1489 |
| 1494 // A MouseUp to the child frame should cancel the mouse capture. | 1490 // A MouseUp to the child frame should cancel the mouse capture. |
| 1495 mouse_event.type = blink::WebInputEvent::MouseUp; | 1491 mouse_event.type = blink::WebInputEvent::MouseUp; |
| 1496 mouse_event.modifiers = 0; | 1492 mouse_event.modifiers = 0; |
| 1497 mouse_event.x = 75; | 1493 mouse_event.x = 75; |
| 1498 mouse_event.y = 75; | 1494 mouse_event.y = 75; |
| 1499 main_frame_monitor.ResetEventReceived(); | 1495 main_frame_monitor.ResetEventReceived(); |
| 1500 child_frame_monitor.ResetEventReceived(); | 1496 child_frame_monitor.ResetEventReceived(); |
| 1501 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1497 router->RouteMouseEvent(root_view, &mouse_event); |
| 1502 | 1498 |
| 1503 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); | 1499 EXPECT_FALSE(main_frame_monitor.EventWasReceived()); |
| 1504 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); | 1500 EXPECT_TRUE(child_frame_monitor.EventWasReceived()); |
| 1505 | 1501 |
| 1506 // Subsequent MouseMove events targeted to the main frame should be routed | 1502 // Subsequent MouseMove events targeted to the main frame should be routed |
| 1507 // to that frame. | 1503 // to that frame. |
| 1508 mouse_event.type = blink::WebInputEvent::MouseMove; | 1504 mouse_event.type = blink::WebInputEvent::MouseMove; |
| 1509 mouse_event.x = 1; | 1505 mouse_event.x = 1; |
| 1510 mouse_event.y = 3; | 1506 mouse_event.y = 3; |
| 1511 // Sending the MouseMove twice for the same reason as above. | 1507 // Sending the MouseMove twice for the same reason as above. |
| 1512 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1508 router->RouteMouseEvent(root_view, &mouse_event); |
| 1513 main_frame_monitor.ResetEventReceived(); | 1509 main_frame_monitor.ResetEventReceived(); |
| 1514 child_frame_monitor.ResetEventReceived(); | 1510 child_frame_monitor.ResetEventReceived(); |
| 1515 mouse_event.x = 1; | 1511 mouse_event.x = 1; |
| 1516 mouse_event.y = 4; | 1512 mouse_event.y = 4; |
| 1517 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1513 router->RouteMouseEvent(root_view, &mouse_event); |
| 1518 | 1514 |
| 1519 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 1515 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
| 1520 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 1516 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
| 1521 | 1517 |
| 1522 // Target MouseDown to the main frame to cause it to capture input. | 1518 // Target MouseDown to the main frame to cause it to capture input. |
| 1523 mouse_event.type = blink::WebInputEvent::MouseDown; | 1519 mouse_event.type = blink::WebInputEvent::MouseDown; |
| 1524 mouse_event.x = 1; | 1520 mouse_event.x = 1; |
| 1525 mouse_event.y = 1; | 1521 mouse_event.y = 1; |
| 1526 main_frame_monitor.ResetEventReceived(); | 1522 main_frame_monitor.ResetEventReceived(); |
| 1527 child_frame_monitor.ResetEventReceived(); | 1523 child_frame_monitor.ResetEventReceived(); |
| 1528 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1524 router->RouteMouseEvent(root_view, &mouse_event); |
| 1529 | 1525 |
| 1530 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 1526 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
| 1531 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 1527 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
| 1532 | 1528 |
| 1533 // Sending a MouseMove to the child frame should still result in the main | 1529 // Sending a MouseMove to the child frame should still result in the main |
| 1534 // frame receiving the event. | 1530 // frame receiving the event. |
| 1535 mouse_event.type = blink::WebInputEvent::MouseMove; | 1531 mouse_event.type = blink::WebInputEvent::MouseMove; |
| 1536 mouse_event.modifiers = blink::WebInputEvent::LeftButtonDown; | 1532 mouse_event.modifiers = blink::WebInputEvent::LeftButtonDown; |
| 1537 mouse_event.x = 75; | 1533 mouse_event.x = 75; |
| 1538 mouse_event.y = 75; | 1534 mouse_event.y = 75; |
| 1539 main_frame_monitor.ResetEventReceived(); | 1535 main_frame_monitor.ResetEventReceived(); |
| 1540 child_frame_monitor.ResetEventReceived(); | 1536 child_frame_monitor.ResetEventReceived(); |
| 1541 router->RouteMouseEvent(root_view, &mouse_event, ui::LatencyInfo()); | 1537 router->RouteMouseEvent(root_view, &mouse_event); |
| 1542 | 1538 |
| 1543 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); | 1539 EXPECT_TRUE(main_frame_monitor.EventWasReceived()); |
| 1544 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); | 1540 EXPECT_FALSE(child_frame_monitor.EventWasReceived()); |
| 1545 } | 1541 } |
| 1546 | 1542 |
| 1547 // Tests OOPIF rendering by checking that the RWH of the iframe generates | 1543 // Tests OOPIF rendering by checking that the RWH of the iframe generates |
| 1548 // OnSwapCompositorFrame message. | 1544 // OnSwapCompositorFrame message. |
| 1549 #if defined(OS_ANDROID) | 1545 #if defined(OS_ANDROID) |
| 1550 // http://crbug.com/471850 | 1546 // http://crbug.com/471850 |
| 1551 #define MAYBE_CompositorFrameSwapped DISABLED_CompositorFrameSwapped | 1547 #define MAYBE_CompositorFrameSwapped DISABLED_CompositorFrameSwapped |
| (...skipping 3547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5099 // Send a MouseMove to the subframe. The frame contains text, and moving the | 5095 // Send a MouseMove to the subframe. The frame contains text, and moving the |
| 5100 // mouse over it should cause the renderer to send a mouse cursor update. | 5096 // mouse over it should cause the renderer to send a mouse cursor update. |
| 5101 blink::WebMouseEvent mouse_event; | 5097 blink::WebMouseEvent mouse_event; |
| 5102 mouse_event.type = blink::WebInputEvent::MouseMove; | 5098 mouse_event.type = blink::WebInputEvent::MouseMove; |
| 5103 mouse_event.x = 60; | 5099 mouse_event.x = 60; |
| 5104 mouse_event.y = 60; | 5100 mouse_event.y = 60; |
| 5105 RenderWidgetHost* rwh_child = | 5101 RenderWidgetHost* rwh_child = |
| 5106 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); | 5102 root->child_at(0)->current_frame_host()->GetRenderWidgetHost(); |
| 5107 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | 5103 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( |
| 5108 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | 5104 root->current_frame_host()->GetRenderWidgetHost()->GetView()); |
| 5109 web_contents()->GetInputEventRouter()->RouteMouseEvent( | 5105 web_contents()->GetInputEventRouter()->RouteMouseEvent(root_view, |
| 5110 root_view, &mouse_event, ui::LatencyInfo()); | 5106 &mouse_event); |
| 5111 | 5107 |
| 5112 // CursorMessageFilter::Wait() implicitly tests whether we receive a | 5108 // CursorMessageFilter::Wait() implicitly tests whether we receive a |
| 5113 // ViewHostMsg_SetCursor message from the renderer process, because it does | 5109 // ViewHostMsg_SetCursor message from the renderer process, because it does |
| 5114 // does not return otherwise. | 5110 // does not return otherwise. |
| 5115 filter->Wait(); | 5111 filter->Wait(); |
| 5116 EXPECT_EQ(filter->last_set_cursor_routing_id(), rwh_child->GetRoutingID()); | 5112 EXPECT_EQ(filter->last_set_cursor_routing_id(), rwh_child->GetRoutingID()); |
| 5117 } | 5113 } |
| 5118 #endif | 5114 #endif |
| 5119 | 5115 |
| 5120 // Tests that we are using the correct RenderFrameProxy when navigating an | 5116 // Tests that we are using the correct RenderFrameProxy when navigating an |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5625 | 5621 |
| 5626 gfx::Point point(75, 75); | 5622 gfx::Point point(75, 75); |
| 5627 | 5623 |
| 5628 // Target right-click event to child frame. | 5624 // Target right-click event to child frame. |
| 5629 blink::WebMouseEvent click_event; | 5625 blink::WebMouseEvent click_event; |
| 5630 click_event.type = blink::WebInputEvent::MouseDown; | 5626 click_event.type = blink::WebInputEvent::MouseDown; |
| 5631 click_event.button = blink::WebPointerProperties::Button::Right; | 5627 click_event.button = blink::WebPointerProperties::Button::Right; |
| 5632 click_event.x = point.x(); | 5628 click_event.x = point.x(); |
| 5633 click_event.y = point.y(); | 5629 click_event.y = point.y(); |
| 5634 click_event.clickCount = 1; | 5630 click_event.clickCount = 1; |
| 5635 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo()); | 5631 router->RouteMouseEvent(root_view, &click_event); |
| 5636 | 5632 |
| 5637 // We also need a MouseUp event, needed by Windows. | 5633 // We also need a MouseUp event, needed by Windows. |
| 5638 click_event.type = blink::WebInputEvent::MouseUp; | 5634 click_event.type = blink::WebInputEvent::MouseUp; |
| 5639 click_event.x = point.x(); | 5635 click_event.x = point.x(); |
| 5640 click_event.y = point.y(); | 5636 click_event.y = point.y(); |
| 5641 router->RouteMouseEvent(root_view, &click_event, ui::LatencyInfo()); | 5637 router->RouteMouseEvent(root_view, &click_event); |
| 5642 | 5638 |
| 5643 context_menu_delegate.Wait(); | 5639 context_menu_delegate.Wait(); |
| 5644 | 5640 |
| 5645 ContextMenuParams params = context_menu_delegate.getParams(); | 5641 ContextMenuParams params = context_menu_delegate.getParams(); |
| 5646 | 5642 |
| 5647 EXPECT_EQ(point.x(), params.x); | 5643 EXPECT_EQ(point.x(), params.x); |
| 5648 EXPECT_EQ(point.y(), params.y); | 5644 EXPECT_EQ(point.y(), params.y); |
| 5649 } | 5645 } |
| 5650 | 5646 |
| 5651 // Test that a mouse right-click to an out-of-process iframe causes a context | 5647 // 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... |
| 8224 " Site A ------------ proxies for B C\n" | 8220 " Site A ------------ proxies for B C\n" |
| 8225 " +--Site B ------- proxies for A C\n" | 8221 " +--Site B ------- proxies for A C\n" |
| 8226 " +--Site C -- proxies for A B\n" | 8222 " +--Site C -- proxies for A B\n" |
| 8227 "Where A = http://a.com/\n" | 8223 "Where A = http://a.com/\n" |
| 8228 " B = http://b.com/\n" | 8224 " B = http://b.com/\n" |
| 8229 " C = http://c.com/", | 8225 " C = http://c.com/", |
| 8230 DepictFrameTree(root)); | 8226 DepictFrameTree(root)); |
| 8231 } | 8227 } |
| 8232 | 8228 |
| 8233 } // namespace content | 8229 } // namespace content |
| OLD | NEW |