| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "services/ui/ws/event_dispatcher.h" | 5 #include "services/ui/ws/event_dispatcher.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <queue> | 10 #include <queue> |
| (...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 // Tests that events on a modal parent target the modal child. | 1369 // Tests that events on a modal parent target the modal child. |
| 1370 TEST_F(EventDispatcherTest, ModalWindowEventOnModalParent) { | 1370 TEST_F(EventDispatcherTest, ModalWindowEventOnModalParent) { |
| 1371 std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3)); | 1371 std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3)); |
| 1372 std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5)); | 1372 std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5)); |
| 1373 | 1373 |
| 1374 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1374 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1375 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); | 1375 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); |
| 1376 w2->SetBounds(gfx::Rect(50, 10, 10, 10)); | 1376 w2->SetBounds(gfx::Rect(50, 10, 10, 10)); |
| 1377 | 1377 |
| 1378 w1->AddTransientWindow(w2.get()); | 1378 w1->AddTransientWindow(w2.get()); |
| 1379 w2->SetModal(); | 1379 w2->SetModal(MODAL_TYPE_WINDOW); |
| 1380 | 1380 |
| 1381 // Send event that is over |w1|. | 1381 // Send event that is over |w1|. |
| 1382 const ui::PointerEvent mouse_pressed(ui::MouseEvent( | 1382 const ui::PointerEvent mouse_pressed(ui::MouseEvent( |
| 1383 ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15), | 1383 ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15), |
| 1384 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); | 1384 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); |
| 1385 event_dispatcher()->ProcessEvent(mouse_pressed, | 1385 event_dispatcher()->ProcessEvent(mouse_pressed, |
| 1386 EventDispatcher::AcceleratorMatchPhase::ANY); | 1386 EventDispatcher::AcceleratorMatchPhase::ANY); |
| 1387 | 1387 |
| 1388 std::unique_ptr<DispatchedEventDetails> details = | 1388 std::unique_ptr<DispatchedEventDetails> details = |
| 1389 test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails(); | 1389 test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1402 // Tests that events on a modal child target the modal child itself. | 1402 // Tests that events on a modal child target the modal child itself. |
| 1403 TEST_F(EventDispatcherTest, ModalWindowEventOnModalChild) { | 1403 TEST_F(EventDispatcherTest, ModalWindowEventOnModalChild) { |
| 1404 std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3)); | 1404 std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3)); |
| 1405 std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5)); | 1405 std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5)); |
| 1406 | 1406 |
| 1407 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1407 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1408 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); | 1408 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); |
| 1409 w2->SetBounds(gfx::Rect(50, 10, 10, 10)); | 1409 w2->SetBounds(gfx::Rect(50, 10, 10, 10)); |
| 1410 | 1410 |
| 1411 w1->AddTransientWindow(w2.get()); | 1411 w1->AddTransientWindow(w2.get()); |
| 1412 w2->SetModal(); | 1412 w2->SetModal(MODAL_TYPE_WINDOW); |
| 1413 | 1413 |
| 1414 // Send event that is over |w2|. | 1414 // Send event that is over |w2|. |
| 1415 const ui::PointerEvent mouse_pressed(ui::MouseEvent( | 1415 const ui::PointerEvent mouse_pressed(ui::MouseEvent( |
| 1416 ui::ET_MOUSE_PRESSED, gfx::Point(55, 15), gfx::Point(55, 15), | 1416 ui::ET_MOUSE_PRESSED, gfx::Point(55, 15), gfx::Point(55, 15), |
| 1417 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); | 1417 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); |
| 1418 event_dispatcher()->ProcessEvent(mouse_pressed, | 1418 event_dispatcher()->ProcessEvent(mouse_pressed, |
| 1419 EventDispatcher::AcceleratorMatchPhase::ANY); | 1419 EventDispatcher::AcceleratorMatchPhase::ANY); |
| 1420 | 1420 |
| 1421 std::unique_ptr<DispatchedEventDetails> details = | 1421 std::unique_ptr<DispatchedEventDetails> details = |
| 1422 test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails(); | 1422 test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1438 std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3)); | 1438 std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3)); |
| 1439 std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5)); | 1439 std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5)); |
| 1440 std::unique_ptr<ServerWindow> w3 = CreateChildWindow(WindowId(1, 6)); | 1440 std::unique_ptr<ServerWindow> w3 = CreateChildWindow(WindowId(1, 6)); |
| 1441 | 1441 |
| 1442 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1442 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1443 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); | 1443 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); |
| 1444 w2->SetBounds(gfx::Rect(50, 10, 10, 10)); | 1444 w2->SetBounds(gfx::Rect(50, 10, 10, 10)); |
| 1445 w3->SetBounds(gfx::Rect(70, 10, 10, 10)); | 1445 w3->SetBounds(gfx::Rect(70, 10, 10, 10)); |
| 1446 | 1446 |
| 1447 w1->AddTransientWindow(w2.get()); | 1447 w1->AddTransientWindow(w2.get()); |
| 1448 w2->SetModal(); | 1448 w2->SetModal(MODAL_TYPE_WINDOW); |
| 1449 | 1449 |
| 1450 // Send event that is over |w3|. | 1450 // Send event that is over |w3|. |
| 1451 const ui::PointerEvent mouse_pressed(ui::MouseEvent( | 1451 const ui::PointerEvent mouse_pressed(ui::MouseEvent( |
| 1452 ui::ET_MOUSE_PRESSED, gfx::Point(75, 15), gfx::Point(75, 15), | 1452 ui::ET_MOUSE_PRESSED, gfx::Point(75, 15), gfx::Point(75, 15), |
| 1453 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); | 1453 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); |
| 1454 event_dispatcher()->ProcessEvent(mouse_pressed, | 1454 event_dispatcher()->ProcessEvent(mouse_pressed, |
| 1455 EventDispatcher::AcceleratorMatchPhase::ANY); | 1455 EventDispatcher::AcceleratorMatchPhase::ANY); |
| 1456 | 1456 |
| 1457 std::unique_ptr<DispatchedEventDetails> details = | 1457 std::unique_ptr<DispatchedEventDetails> details = |
| 1458 test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails(); | 1458 test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1475 std::unique_ptr<ServerWindow> w11 = | 1475 std::unique_ptr<ServerWindow> w11 = |
| 1476 CreateChildWindowWithParent(WindowId(1, 4), w1.get()); | 1476 CreateChildWindowWithParent(WindowId(1, 4), w1.get()); |
| 1477 std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5)); | 1477 std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5)); |
| 1478 | 1478 |
| 1479 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1479 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1480 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); | 1480 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); |
| 1481 w11->SetBounds(gfx::Rect(10, 10, 10, 10)); | 1481 w11->SetBounds(gfx::Rect(10, 10, 10, 10)); |
| 1482 w2->SetBounds(gfx::Rect(50, 10, 10, 10)); | 1482 w2->SetBounds(gfx::Rect(50, 10, 10, 10)); |
| 1483 | 1483 |
| 1484 w1->AddTransientWindow(w2.get()); | 1484 w1->AddTransientWindow(w2.get()); |
| 1485 w2->SetModal(); | 1485 w2->SetModal(MODAL_TYPE_WINDOW); |
| 1486 | 1486 |
| 1487 // Send event that is over |w11|. | 1487 // Send event that is over |w11|. |
| 1488 const ui::PointerEvent mouse_pressed(ui::MouseEvent( | 1488 const ui::PointerEvent mouse_pressed(ui::MouseEvent( |
| 1489 ui::ET_MOUSE_PRESSED, gfx::Point(25, 25), gfx::Point(25, 25), | 1489 ui::ET_MOUSE_PRESSED, gfx::Point(25, 25), gfx::Point(25, 25), |
| 1490 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); | 1490 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); |
| 1491 event_dispatcher()->ProcessEvent(mouse_pressed, | 1491 event_dispatcher()->ProcessEvent(mouse_pressed, |
| 1492 EventDispatcher::AcceleratorMatchPhase::ANY); | 1492 EventDispatcher::AcceleratorMatchPhase::ANY); |
| 1493 | 1493 |
| 1494 std::unique_ptr<DispatchedEventDetails> details = | 1494 std::unique_ptr<DispatchedEventDetails> details = |
| 1495 test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails(); | 1495 test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails(); |
| 1496 ASSERT_TRUE(details); | 1496 ASSERT_TRUE(details); |
| 1497 EXPECT_EQ(w2.get(), details->window); | 1497 EXPECT_EQ(w2.get(), details->window); |
| 1498 EXPECT_TRUE(details->IsNonclientArea()); | 1498 EXPECT_TRUE(details->IsNonclientArea()); |
| 1499 | 1499 |
| 1500 ASSERT_TRUE(details->event); | 1500 ASSERT_TRUE(details->event); |
| 1501 ASSERT_TRUE(details->event->IsPointerEvent()); | 1501 ASSERT_TRUE(details->event->IsPointerEvent()); |
| 1502 | 1502 |
| 1503 ui::PointerEvent* dispatched_event = details->event->AsPointerEvent(); | 1503 ui::PointerEvent* dispatched_event = details->event->AsPointerEvent(); |
| 1504 EXPECT_EQ(gfx::Point(25, 25), dispatched_event->root_location()); | 1504 EXPECT_EQ(gfx::Point(25, 25), dispatched_event->root_location()); |
| 1505 EXPECT_EQ(gfx::Point(-25, 15), dispatched_event->location()); | 1505 EXPECT_EQ(gfx::Point(-25, 15), dispatched_event->location()); |
| 1506 } | 1506 } |
| 1507 | 1507 |
| 1508 // Tests that events on a system modal window target the modal window itself. | 1508 // Tests that events on a system modal window target the modal window itself. |
| 1509 TEST_F(EventDispatcherTest, ModalWindowEventOnSystemModal) { | 1509 TEST_F(EventDispatcherTest, ModalWindowEventOnSystemModal) { |
| 1510 std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3)); | 1510 std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3)); |
| 1511 | 1511 |
| 1512 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1512 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1513 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); | 1513 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); |
| 1514 w1->SetModal(); | 1514 w1->SetModal(MODAL_TYPE_SYSTEM); |
| 1515 | 1515 |
| 1516 // Send event that is over |w1|. | 1516 // Send event that is over |w1|. |
| 1517 const ui::PointerEvent mouse_pressed(ui::MouseEvent( | 1517 const ui::PointerEvent mouse_pressed(ui::MouseEvent( |
| 1518 ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15), | 1518 ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15), |
| 1519 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); | 1519 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); |
| 1520 event_dispatcher()->ProcessEvent(mouse_pressed, | 1520 event_dispatcher()->ProcessEvent(mouse_pressed, |
| 1521 EventDispatcher::AcceleratorMatchPhase::ANY); | 1521 EventDispatcher::AcceleratorMatchPhase::ANY); |
| 1522 | 1522 |
| 1523 std::unique_ptr<DispatchedEventDetails> details = | 1523 std::unique_ptr<DispatchedEventDetails> details = |
| 1524 test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails(); | 1524 test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails(); |
| 1525 ASSERT_TRUE(details); | 1525 ASSERT_TRUE(details); |
| 1526 EXPECT_EQ(w1.get(), details->window); | 1526 EXPECT_EQ(w1.get(), details->window); |
| 1527 EXPECT_TRUE(details->IsClientArea()); | 1527 EXPECT_TRUE(details->IsClientArea()); |
| 1528 | 1528 |
| 1529 ASSERT_TRUE(details->event); | 1529 ASSERT_TRUE(details->event); |
| 1530 ASSERT_TRUE(details->event->IsPointerEvent()); | 1530 ASSERT_TRUE(details->event->IsPointerEvent()); |
| 1531 | 1531 |
| 1532 ui::PointerEvent* dispatched_event = details->event->AsPointerEvent(); | 1532 ui::PointerEvent* dispatched_event = details->event->AsPointerEvent(); |
| 1533 EXPECT_EQ(gfx::Point(15, 15), dispatched_event->root_location()); | 1533 EXPECT_EQ(gfx::Point(15, 15), dispatched_event->root_location()); |
| 1534 EXPECT_EQ(gfx::Point(5, 5), dispatched_event->location()); | 1534 EXPECT_EQ(gfx::Point(5, 5), dispatched_event->location()); |
| 1535 } | 1535 } |
| 1536 | 1536 |
| 1537 // Tests that events outside of system modal window target the modal window. | 1537 // Tests that events outside of system modal window target the modal window. |
| 1538 TEST_F(EventDispatcherTest, ModalWindowEventOutsideSystemModal) { | 1538 TEST_F(EventDispatcherTest, ModalWindowEventOutsideSystemModal) { |
| 1539 std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3)); | 1539 std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3)); |
| 1540 | 1540 |
| 1541 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1541 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1542 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); | 1542 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); |
| 1543 w1->SetModal(); | 1543 w1->SetModal(MODAL_TYPE_SYSTEM); |
| 1544 event_dispatcher()->AddSystemModalWindow(w1.get()); | 1544 event_dispatcher()->AddSystemModalWindow(w1.get()); |
| 1545 | 1545 |
| 1546 // Send event that is over |w1|. | 1546 // Send event that is over |w1|. |
| 1547 const ui::PointerEvent mouse_pressed(ui::MouseEvent( | 1547 const ui::PointerEvent mouse_pressed(ui::MouseEvent( |
| 1548 ui::ET_MOUSE_PRESSED, gfx::Point(45, 15), gfx::Point(45, 15), | 1548 ui::ET_MOUSE_PRESSED, gfx::Point(45, 15), gfx::Point(45, 15), |
| 1549 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); | 1549 base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); |
| 1550 event_dispatcher()->ProcessEvent(mouse_pressed, | 1550 event_dispatcher()->ProcessEvent(mouse_pressed, |
| 1551 EventDispatcher::AcceleratorMatchPhase::ANY); | 1551 EventDispatcher::AcceleratorMatchPhase::ANY); |
| 1552 | 1552 |
| 1553 std::unique_ptr<DispatchedEventDetails> details = | 1553 std::unique_ptr<DispatchedEventDetails> details = |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1570 std::unique_ptr<ServerWindow> w11 = | 1570 std::unique_ptr<ServerWindow> w11 = |
| 1571 CreateChildWindowWithParent(WindowId(1, 4), w1.get()); | 1571 CreateChildWindowWithParent(WindowId(1, 4), w1.get()); |
| 1572 std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5)); | 1572 std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5)); |
| 1573 | 1573 |
| 1574 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1574 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1575 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); | 1575 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); |
| 1576 w11->SetBounds(gfx::Rect(10, 10, 10, 10)); | 1576 w11->SetBounds(gfx::Rect(10, 10, 10, 10)); |
| 1577 w2->SetBounds(gfx::Rect(50, 10, 10, 10)); | 1577 w2->SetBounds(gfx::Rect(50, 10, 10, 10)); |
| 1578 | 1578 |
| 1579 w1->AddTransientWindow(w2.get()); | 1579 w1->AddTransientWindow(w2.get()); |
| 1580 w2->SetModal(); | 1580 w2->SetModal(MODAL_TYPE_WINDOW); |
| 1581 | 1581 |
| 1582 EXPECT_FALSE(event_dispatcher()->SetCaptureWindow(w11.get(), kClientAreaId)); | 1582 EXPECT_FALSE(event_dispatcher()->SetCaptureWindow(w11.get(), kClientAreaId)); |
| 1583 EXPECT_EQ(nullptr, event_dispatcher()->capture_window()); | 1583 EXPECT_EQ(nullptr, event_dispatcher()->capture_window()); |
| 1584 } | 1584 } |
| 1585 | 1585 |
| 1586 // Tests that setting capture to a window unrelated to a modal parent works. | 1586 // Tests that setting capture to a window unrelated to a modal parent works. |
| 1587 TEST_F(EventDispatcherTest, ModalWindowSetCaptureUnrelatedWindow) { | 1587 TEST_F(EventDispatcherTest, ModalWindowSetCaptureUnrelatedWindow) { |
| 1588 std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3)); | 1588 std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3)); |
| 1589 std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 4)); | 1589 std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 4)); |
| 1590 std::unique_ptr<ServerWindow> w3 = CreateChildWindow(WindowId(1, 5)); | 1590 std::unique_ptr<ServerWindow> w3 = CreateChildWindow(WindowId(1, 5)); |
| 1591 | 1591 |
| 1592 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); | 1592 root_window()->SetBounds(gfx::Rect(0, 0, 100, 100)); |
| 1593 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); | 1593 w1->SetBounds(gfx::Rect(10, 10, 30, 30)); |
| 1594 w2->SetBounds(gfx::Rect(50, 10, 10, 10)); | 1594 w2->SetBounds(gfx::Rect(50, 10, 10, 10)); |
| 1595 w3->SetBounds(gfx::Rect(70, 10, 10, 10)); | 1595 w3->SetBounds(gfx::Rect(70, 10, 10, 10)); |
| 1596 | 1596 |
| 1597 w1->AddTransientWindow(w2.get()); | 1597 w1->AddTransientWindow(w2.get()); |
| 1598 w2->SetModal(); | 1598 w2->SetModal(MODAL_TYPE_WINDOW); |
| 1599 | 1599 |
| 1600 EXPECT_TRUE(event_dispatcher()->SetCaptureWindow(w3.get(), kClientAreaId)); | 1600 EXPECT_TRUE(event_dispatcher()->SetCaptureWindow(w3.get(), kClientAreaId)); |
| 1601 EXPECT_EQ(w3.get(), event_dispatcher()->capture_window()); | 1601 EXPECT_EQ(w3.get(), event_dispatcher()->capture_window()); |
| 1602 } | 1602 } |
| 1603 | 1603 |
| 1604 // Tests that setting capture fails when there is a system modal window. | 1604 // Tests that setting capture fails when there is a system modal window. |
| 1605 TEST_F(EventDispatcherTest, ModalWindowSystemSetCapture) { | 1605 TEST_F(EventDispatcherTest, ModalWindowSystemSetCapture) { |
| 1606 std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3)); | 1606 std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3)); |
| 1607 std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 4)); | 1607 std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 4)); |
| 1608 | 1608 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1811 | 1811 |
| 1812 event_dispatcher()->SetMousePointerScreenLocation(gfx::Point(15, 15)); | 1812 event_dispatcher()->SetMousePointerScreenLocation(gfx::Point(15, 15)); |
| 1813 EXPECT_EQ(c1.get(), event_dispatcher()->mouse_cursor_source_window()); | 1813 EXPECT_EQ(c1.get(), event_dispatcher()->mouse_cursor_source_window()); |
| 1814 c1.reset(); | 1814 c1.reset(); |
| 1815 EXPECT_EQ(nullptr, event_dispatcher()->mouse_cursor_source_window()); | 1815 EXPECT_EQ(nullptr, event_dispatcher()->mouse_cursor_source_window()); |
| 1816 } | 1816 } |
| 1817 | 1817 |
| 1818 } // namespace test | 1818 } // namespace test |
| 1819 } // namespace ws | 1819 } // namespace ws |
| 1820 } // namespace ui | 1820 } // namespace ui |
| OLD | NEW |