| 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/common/wm/workspace_controller.h" | 5 #include "ash/common/wm/workspace_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "ash/common/session/session_controller.h" | 9 #include "ash/common/session/session_controller.h" |
| 10 #include "ash/common/shelf/shelf_layout_manager.h" | 10 #include "ash/common/shelf/shelf_layout_manager.h" |
| (...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1446 }; | 1446 }; |
| 1447 // Do two iterations, first without any transform on |second|, and the second | 1447 // Do two iterations, first without any transform on |second|, and the second |
| 1448 // time after applying some transform on |second| so that it doesn't get | 1448 // time after applying some transform on |second| so that it doesn't get |
| 1449 // targeted. | 1449 // targeted. |
| 1450 for (int times = 0; times < 2; ++times) { | 1450 for (int times = 0; times < 2; ++times) { |
| 1451 SCOPED_TRACE(times == 0 ? "Without transform" : "With transform"); | 1451 SCOPED_TRACE(times == 0 ? "Without transform" : "With transform"); |
| 1452 aura::Window* expected_target = times == 0 ? second.get() : first.get(); | 1452 aura::Window* expected_target = times == 0 ? second.get() : first.get(); |
| 1453 for (int i = 0; i < kNumPoints; ++i) { | 1453 for (int i = 0; i < kNumPoints; ++i) { |
| 1454 SCOPED_TRACE(points[i].direction); | 1454 SCOPED_TRACE(points[i].direction); |
| 1455 const gfx::Point& location = points[i].location; | 1455 const gfx::Point& location = points[i].location; |
| 1456 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, location, location, | 1456 ui::MouseEvent mouse( |
| 1457 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 1457 ui::ET_MOUSE_MOVED, location, location, ui::EventTimeForNow(), |
| 1458 ui::EF_NONE, ui::EF_NONE, |
| 1459 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 1458 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); | 1460 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); |
| 1459 EXPECT_EQ(expected_target, target); | 1461 EXPECT_EQ(expected_target, target); |
| 1460 | 1462 |
| 1461 ui::TouchEvent touch( | 1463 ui::TouchEvent touch( |
| 1462 ui::ET_TOUCH_PRESSED, location, ui::EventTimeForNow(), | 1464 ui::ET_TOUCH_PRESSED, location, ui::EventTimeForNow(), |
| 1463 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0)); | 1465 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0)); |
| 1464 target = targeter->FindTargetForEvent(root, &touch); | 1466 target = targeter->FindTargetForEvent(root, &touch); |
| 1465 EXPECT_EQ(expected_target, target); | 1467 EXPECT_EQ(expected_target, target); |
| 1466 } | 1468 } |
| 1467 // Apply a transform on |second|. After the transform is applied, the window | 1469 // Apply a transform on |second|. After the transform is applied, the window |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1489 } points[kNumPoints] = { | 1491 } points[kNumPoints] = { |
| 1490 {"left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true}, | 1492 {"left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true}, |
| 1491 {"top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true}, | 1493 {"top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true}, |
| 1492 {"right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true}, | 1494 {"right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true}, |
| 1493 {"bottom", gfx::Point(bounds.x() + 10, bounds.bottom() + 2), true}, | 1495 {"bottom", gfx::Point(bounds.x() + 10, bounds.bottom() + 2), true}, |
| 1494 {"outside", gfx::Point(bounds.x() + 10, bounds.y() - 31), false}, | 1496 {"outside", gfx::Point(bounds.x() + 10, bounds.y() - 31), false}, |
| 1495 }; | 1497 }; |
| 1496 for (int i = 0; i < kNumPoints; ++i) { | 1498 for (int i = 0; i < kNumPoints; ++i) { |
| 1497 SCOPED_TRACE(points[i].direction); | 1499 SCOPED_TRACE(points[i].direction); |
| 1498 const gfx::Point& location = points[i].location; | 1500 const gfx::Point& location = points[i].location; |
| 1499 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, location, location, | 1501 ui::MouseEvent mouse( |
| 1500 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 1502 ui::ET_MOUSE_MOVED, location, location, ui::EventTimeForNow(), |
| 1503 ui::EF_NONE, ui::EF_NONE, |
| 1504 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 1501 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); | 1505 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); |
| 1502 if (points[i].is_target_hit) | 1506 if (points[i].is_target_hit) |
| 1503 EXPECT_EQ(window.get(), target); | 1507 EXPECT_EQ(window.get(), target); |
| 1504 else | 1508 else |
| 1505 EXPECT_NE(window.get(), target); | 1509 EXPECT_NE(window.get(), target); |
| 1506 } | 1510 } |
| 1507 } | 1511 } |
| 1508 | 1512 |
| 1509 // Verifies touch event targeting just outside the window edges for panels. | 1513 // Verifies touch event targeting just outside the window edges for panels. |
| 1510 // The shelf is aligned to the bottom by default, and so touches just below | 1514 // The shelf is aligned to the bottom by default, and so touches just below |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1538 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0)); | 1542 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_TOUCH, 0)); |
| 1539 ui::EventTarget* target = targeter->FindTargetForEvent(root, &touch); | 1543 ui::EventTarget* target = targeter->FindTargetForEvent(root, &touch); |
| 1540 if (points[i].is_target_hit) | 1544 if (points[i].is_target_hit) |
| 1541 EXPECT_EQ(window.get(), target); | 1545 EXPECT_EQ(window.get(), target); |
| 1542 else | 1546 else |
| 1543 EXPECT_NE(window.get(), target); | 1547 EXPECT_NE(window.get(), target); |
| 1544 } | 1548 } |
| 1545 } | 1549 } |
| 1546 | 1550 |
| 1547 } // namespace ash | 1551 } // namespace ash |
| OLD | NEW |