Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1447)

Side by Side Diff: ash/wm/workspace_controller_unittest.cc

Issue 2715743005: Revert of Avoid two targeting phases in aura client-lib and EventProcessor. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/wm/panels/panel_layout_manager_unittest.cc ('k') | ui/aura/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 std::unique_ptr<Window> first(aura::test::CreateTestWindowWithDelegate( 1474 std::unique_ptr<Window> first(aura::test::CreateTestWindowWithDelegate(
1475 &d_first, 123, gfx::Rect(20, 10, 100, 50), NULL)); 1475 &d_first, 123, gfx::Rect(20, 10, 100, 50), NULL));
1476 ParentWindowInPrimaryRootWindow(first.get()); 1476 ParentWindowInPrimaryRootWindow(first.get());
1477 first->Show(); 1477 first->Show();
1478 1478
1479 std::unique_ptr<Window> second(aura::test::CreateTestWindowWithDelegate( 1479 std::unique_ptr<Window> second(aura::test::CreateTestWindowWithDelegate(
1480 &d_second, 234, gfx::Rect(30, 40, 40, 10), NULL)); 1480 &d_second, 234, gfx::Rect(30, 40, 40, 10), NULL));
1481 ParentWindowInPrimaryRootWindow(second.get()); 1481 ParentWindowInPrimaryRootWindow(second.get());
1482 second->Show(); 1482 second->Show();
1483 1483
1484 aura::Window* root = first->GetRootWindow(); 1484 ui::EventTarget* root = first->GetRootWindow();
1485 ui::EventTargeter* targeter = 1485 ui::EventTargeter* targeter = root->GetEventTargeter();
1486 root->GetHost()->dispatcher()->GetDefaultEventTargeter();
1487 1486
1488 // The windows overlap, and |second| is on top of |first|. Events targeted 1487 // The windows overlap, and |second| is on top of |first|. Events targeted
1489 // slightly outside the edges of the |second| window should still be targeted 1488 // slightly outside the edges of the |second| window should still be targeted
1490 // to |second| to allow resizing the windows easily. 1489 // to |second| to allow resizing the windows easily.
1491 1490
1492 const int kNumPoints = 4; 1491 const int kNumPoints = 4;
1493 struct { 1492 struct {
1494 const char* direction; 1493 const char* direction;
1495 gfx::Point location; 1494 gfx::Point location;
1496 } points[kNumPoints] = { 1495 } points[kNumPoints] = {
(...skipping 27 matching lines...) Expand all
1524 transform.Translate(70, 40); 1523 transform.Translate(70, 40);
1525 second->SetTransform(transform); 1524 second->SetTransform(transform);
1526 } 1525 }
1527 } 1526 }
1528 1527
1529 // Verifies mouse event targeting just outside the window edges for panels. 1528 // Verifies mouse event targeting just outside the window edges for panels.
1530 TEST_F(WorkspaceControllerTest, WindowEdgeMouseHitTestPanel) { 1529 TEST_F(WorkspaceControllerTest, WindowEdgeMouseHitTestPanel) {
1531 aura::test::TestWindowDelegate delegate; 1530 aura::test::TestWindowDelegate delegate;
1532 std::unique_ptr<Window> window( 1531 std::unique_ptr<Window> window(
1533 CreateTestPanel(&delegate, gfx::Rect(20, 10, 100, 50))); 1532 CreateTestPanel(&delegate, gfx::Rect(20, 10, 100, 50)));
1534 aura::Window* root = window->GetRootWindow(); 1533 ui::EventTarget* root = window->GetRootWindow();
1535 ui::EventTargeter* targeter = 1534 ui::EventTargeter* targeter = root->GetEventTargeter();
1536 root->GetHost()->dispatcher()->GetDefaultEventTargeter();
1537 const gfx::Rect bounds = window->bounds(); 1535 const gfx::Rect bounds = window->bounds();
1538 const int kNumPoints = 5; 1536 const int kNumPoints = 5;
1539 struct { 1537 struct {
1540 const char* direction; 1538 const char* direction;
1541 gfx::Point location; 1539 gfx::Point location;
1542 bool is_target_hit; 1540 bool is_target_hit;
1543 } points[kNumPoints] = { 1541 } points[kNumPoints] = {
1544 {"left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true}, 1542 {"left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true},
1545 {"top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true}, 1543 {"top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true},
1546 {"right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true}, 1544 {"right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true},
(...skipping 14 matching lines...) Expand all
1561 } 1559 }
1562 1560
1563 // Verifies touch event targeting just outside the window edges for panels. 1561 // Verifies touch event targeting just outside the window edges for panels.
1564 // The shelf is aligned to the bottom by default, and so touches just below 1562 // The shelf is aligned to the bottom by default, and so touches just below
1565 // the bottom edge of the panel should not target the panel itself because 1563 // the bottom edge of the panel should not target the panel itself because
1566 // an AttachedPanelWindowTargeter is installed on the panel container. 1564 // an AttachedPanelWindowTargeter is installed on the panel container.
1567 TEST_F(WorkspaceControllerTest, WindowEdgeTouchHitTestPanel) { 1565 TEST_F(WorkspaceControllerTest, WindowEdgeTouchHitTestPanel) {
1568 aura::test::TestWindowDelegate delegate; 1566 aura::test::TestWindowDelegate delegate;
1569 std::unique_ptr<Window> window( 1567 std::unique_ptr<Window> window(
1570 CreateTestPanel(&delegate, gfx::Rect(20, 10, 100, 50))); 1568 CreateTestPanel(&delegate, gfx::Rect(20, 10, 100, 50)));
1571 aura::Window* root = window->GetRootWindow(); 1569 ui::EventTarget* root = window->GetRootWindow();
1572 ui::EventTargeter* targeter = 1570 ui::EventTargeter* targeter = root->GetEventTargeter();
1573 root->GetHost()->dispatcher()->GetDefaultEventTargeter();
1574 const gfx::Rect bounds = window->bounds(); 1571 const gfx::Rect bounds = window->bounds();
1575 const int kNumPoints = 5; 1572 const int kNumPoints = 5;
1576 struct { 1573 struct {
1577 const char* direction; 1574 const char* direction;
1578 gfx::Point location; 1575 gfx::Point location;
1579 bool is_target_hit; 1576 bool is_target_hit;
1580 } points[kNumPoints] = { 1577 } points[kNumPoints] = {
1581 {"left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true}, 1578 {"left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true},
1582 {"top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true}, 1579 {"top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true},
1583 {"right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true}, 1580 {"right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true},
(...skipping 19 matching lines...) Expand all
1603 // Make window smaller than the minimum docked area so that the window edges 1600 // Make window smaller than the minimum docked area so that the window edges
1604 // are exposed. 1601 // are exposed.
1605 delegate.set_maximum_size(gfx::Size(180, 200)); 1602 delegate.set_maximum_size(gfx::Size(180, 200));
1606 std::unique_ptr<Window> window(aura::test::CreateTestWindowWithDelegate( 1603 std::unique_ptr<Window> window(aura::test::CreateTestWindowWithDelegate(
1607 &delegate, 123, gfx::Rect(20, 10, 100, 50), NULL)); 1604 &delegate, 123, gfx::Rect(20, 10, 100, 50), NULL));
1608 ParentWindowInPrimaryRootWindow(window.get()); 1605 ParentWindowInPrimaryRootWindow(window.get());
1609 aura::Window* docked_container = Shell::GetContainer( 1606 aura::Window* docked_container = Shell::GetContainer(
1610 window->GetRootWindow(), kShellWindowId_DockedContainer); 1607 window->GetRootWindow(), kShellWindowId_DockedContainer);
1611 docked_container->AddChild(window.get()); 1608 docked_container->AddChild(window.get());
1612 window->Show(); 1609 window->Show();
1613 aura::Window* root = window->GetRootWindow(); 1610 ui::EventTarget* root = window->GetRootWindow();
1614 ui::EventTargeter* targeter = 1611 ui::EventTargeter* targeter = root->GetEventTargeter();
1615 root->GetHost()->dispatcher()->GetDefaultEventTargeter();
1616 const gfx::Rect bounds = window->bounds(); 1612 const gfx::Rect bounds = window->bounds();
1617 const int kNumPoints = 5; 1613 const int kNumPoints = 5;
1618 struct { 1614 struct {
1619 const char* direction; 1615 const char* direction;
1620 gfx::Point location; 1616 gfx::Point location;
1621 bool is_target_hit; 1617 bool is_target_hit;
1622 } points[kNumPoints] = { 1618 } points[kNumPoints] = {
1623 {"left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true}, 1619 {"left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true},
1624 {"top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true}, 1620 {"top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true},
1625 {"right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true}, 1621 {"right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true},
(...skipping 15 matching lines...) Expand all
1641 ui::EventTimeForNow()); 1637 ui::EventTimeForNow());
1642 target = targeter->FindTargetForEvent(root, &touch); 1638 target = targeter->FindTargetForEvent(root, &touch);
1643 if (points[i].is_target_hit) 1639 if (points[i].is_target_hit)
1644 EXPECT_EQ(window.get(), target); 1640 EXPECT_EQ(window.get(), target);
1645 else 1641 else
1646 EXPECT_NE(window.get(), target); 1642 EXPECT_NE(window.get(), target);
1647 } 1643 }
1648 } 1644 }
1649 1645
1650 } // namespace ash 1646 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/panels/panel_layout_manager_unittest.cc ('k') | ui/aura/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698