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