| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/wm/workspace_controller.h" | 5 #include "ash/wm/workspace_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
| (...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 { "bottom", gfx::Point(50, 52) }, // outside the bottom edge. | 1470 { "bottom", gfx::Point(50, 52) }, // outside the bottom edge. |
| 1471 }; | 1471 }; |
| 1472 // Do two iterations, first without any transform on |second|, and the second | 1472 // Do two iterations, first without any transform on |second|, and the second |
| 1473 // time after applying some transform on |second| so that it doesn't get | 1473 // time after applying some transform on |second| so that it doesn't get |
| 1474 // targeted. | 1474 // targeted. |
| 1475 for (int times = 0; times < 2; ++times) { | 1475 for (int times = 0; times < 2; ++times) { |
| 1476 SCOPED_TRACE(times == 0 ? "Without transform" : "With transform"); | 1476 SCOPED_TRACE(times == 0 ? "Without transform" : "With transform"); |
| 1477 aura::Window* expected_target = times == 0 ? second.get() : first.get(); | 1477 aura::Window* expected_target = times == 0 ? second.get() : first.get(); |
| 1478 for (int i = 0; i < kNumPoints; ++i) { | 1478 for (int i = 0; i < kNumPoints; ++i) { |
| 1479 SCOPED_TRACE(points[i].direction); | 1479 SCOPED_TRACE(points[i].direction); |
| 1480 const gfx::Point& location = points[i].location; | 1480 auto location = gfx::PointF(points[i].location); |
| 1481 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, location, location, | 1481 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, location, location, |
| 1482 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 1482 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); |
| 1483 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); | 1483 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); |
| 1484 EXPECT_EQ(expected_target, target); | 1484 EXPECT_EQ(expected_target, target); |
| 1485 | 1485 |
| 1486 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location, 0, | 1486 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location, 0, |
| 1487 ui::EventTimeForNow()); | 1487 ui::EventTimeForNow()); |
| 1488 target = targeter->FindTargetForEvent(root, &touch); | 1488 target = targeter->FindTargetForEvent(root, &touch); |
| 1489 EXPECT_EQ(expected_target, target); | 1489 EXPECT_EQ(expected_target, target); |
| 1490 } | 1490 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1511 bool is_target_hit; | 1511 bool is_target_hit; |
| 1512 } points[kNumPoints] = { | 1512 } points[kNumPoints] = { |
| 1513 { "left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true }, | 1513 { "left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true }, |
| 1514 { "top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true }, | 1514 { "top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true }, |
| 1515 { "right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true }, | 1515 { "right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true }, |
| 1516 { "bottom", gfx::Point(bounds.x() + 10, bounds.bottom() + 2), true }, | 1516 { "bottom", gfx::Point(bounds.x() + 10, bounds.bottom() + 2), true }, |
| 1517 { "outside", gfx::Point(bounds.x() + 10, bounds.y() - 31), false }, | 1517 { "outside", gfx::Point(bounds.x() + 10, bounds.y() - 31), false }, |
| 1518 }; | 1518 }; |
| 1519 for (int i = 0; i < kNumPoints; ++i) { | 1519 for (int i = 0; i < kNumPoints; ++i) { |
| 1520 SCOPED_TRACE(points[i].direction); | 1520 SCOPED_TRACE(points[i].direction); |
| 1521 const gfx::Point& location = points[i].location; | 1521 auto location = gfx::PointF(points[i].location); |
| 1522 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, location, location, | 1522 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, location, location, |
| 1523 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 1523 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); |
| 1524 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); | 1524 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); |
| 1525 if (points[i].is_target_hit) | 1525 if (points[i].is_target_hit) |
| 1526 EXPECT_EQ(window.get(), target); | 1526 EXPECT_EQ(window.get(), target); |
| 1527 else | 1527 else |
| 1528 EXPECT_NE(window.get(), target); | 1528 EXPECT_NE(window.get(), target); |
| 1529 } | 1529 } |
| 1530 } | 1530 } |
| 1531 | 1531 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1547 bool is_target_hit; | 1547 bool is_target_hit; |
| 1548 } points[kNumPoints] = { | 1548 } points[kNumPoints] = { |
| 1549 { "left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true }, | 1549 { "left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true }, |
| 1550 { "top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true }, | 1550 { "top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true }, |
| 1551 { "right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true }, | 1551 { "right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true }, |
| 1552 { "bottom", gfx::Point(bounds.x() + 10, bounds.bottom() + 2), false }, | 1552 { "bottom", gfx::Point(bounds.x() + 10, bounds.bottom() + 2), false }, |
| 1553 { "outside", gfx::Point(bounds.x() + 10, bounds.y() - 31), false }, | 1553 { "outside", gfx::Point(bounds.x() + 10, bounds.y() - 31), false }, |
| 1554 }; | 1554 }; |
| 1555 for (int i = 0; i < kNumPoints; ++i) { | 1555 for (int i = 0; i < kNumPoints; ++i) { |
| 1556 SCOPED_TRACE(points[i].direction); | 1556 SCOPED_TRACE(points[i].direction); |
| 1557 const gfx::Point& location = points[i].location; | 1557 auto location = gfx::PointF(points[i].location); |
| 1558 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location, 0, | 1558 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location, 0, |
| 1559 ui::EventTimeForNow()); | 1559 ui::EventTimeForNow()); |
| 1560 ui::EventTarget* target = targeter->FindTargetForEvent(root, &touch); | 1560 ui::EventTarget* target = targeter->FindTargetForEvent(root, &touch); |
| 1561 if (points[i].is_target_hit) | 1561 if (points[i].is_target_hit) |
| 1562 EXPECT_EQ(window.get(), target); | 1562 EXPECT_EQ(window.get(), target); |
| 1563 else | 1563 else |
| 1564 EXPECT_NE(window.get(), target); | 1564 EXPECT_NE(window.get(), target); |
| 1565 } | 1565 } |
| 1566 } | 1566 } |
| 1567 | 1567 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1588 bool is_target_hit; | 1588 bool is_target_hit; |
| 1589 } points[kNumPoints] = { | 1589 } points[kNumPoints] = { |
| 1590 { "left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true }, | 1590 { "left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true }, |
| 1591 { "top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true }, | 1591 { "top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true }, |
| 1592 { "right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true }, | 1592 { "right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true }, |
| 1593 { "bottom", gfx::Point(bounds.x() + 10, bounds.bottom() + 2), true }, | 1593 { "bottom", gfx::Point(bounds.x() + 10, bounds.bottom() + 2), true }, |
| 1594 { "outside", gfx::Point(bounds.x() + 10, bounds.y() - 31), false }, | 1594 { "outside", gfx::Point(bounds.x() + 10, bounds.y() - 31), false }, |
| 1595 }; | 1595 }; |
| 1596 for (int i = 0; i < kNumPoints; ++i) { | 1596 for (int i = 0; i < kNumPoints; ++i) { |
| 1597 SCOPED_TRACE(points[i].direction); | 1597 SCOPED_TRACE(points[i].direction); |
| 1598 const gfx::Point& location = points[i].location; | 1598 auto location = gfx::PointF(points[i].location); |
| 1599 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, location, location, | 1599 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, location, location, |
| 1600 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 1600 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); |
| 1601 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); | 1601 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); |
| 1602 if (points[i].is_target_hit) | 1602 if (points[i].is_target_hit) |
| 1603 EXPECT_EQ(window.get(), target); | 1603 EXPECT_EQ(window.get(), target); |
| 1604 else | 1604 else |
| 1605 EXPECT_NE(window.get(), target); | 1605 EXPECT_NE(window.get(), target); |
| 1606 | 1606 |
| 1607 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location, 0, | 1607 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location, 0, |
| 1608 ui::EventTimeForNow()); | 1608 ui::EventTimeForNow()); |
| 1609 target = targeter->FindTargetForEvent(root, &touch); | 1609 target = targeter->FindTargetForEvent(root, &touch); |
| 1610 if (points[i].is_target_hit) | 1610 if (points[i].is_target_hit) |
| 1611 EXPECT_EQ(window.get(), target); | 1611 EXPECT_EQ(window.get(), target); |
| 1612 else | 1612 else |
| 1613 EXPECT_NE(window.get(), target); | 1613 EXPECT_NE(window.get(), target); |
| 1614 } | 1614 } |
| 1615 } | 1615 } |
| 1616 | 1616 |
| 1617 } // namespace ash | 1617 } // namespace ash |
| OLD | NEW |