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

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

Issue 2700523004: Remove docked windows entirely in M59. (Closed)
Patch Set: Rebase and fix 1 test 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
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 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 : change_count_(0), window_(window) {} 1353 : change_count_(0), window_(window) {}
1354 1354
1355 // Number of times OnWindowHierarchyChanged() has been received. 1355 // Number of times OnWindowHierarchyChanged() has been received.
1356 void clear_change_count() { change_count_ = 0; } 1356 void clear_change_count() { change_count_ = 0; }
1357 int change_count() const { return change_count_; } 1357 int change_count() const { return change_count_; }
1358 1358
1359 // aura::WindowObserver overrides: 1359 // aura::WindowObserver overrides:
1360 // Counts number of times a window is reparented. Ignores reparenting into and 1360 // Counts number of times a window is reparented. Ignores reparenting into and
1361 // from a docked container which is expected when a tab is dragged. 1361 // from a docked container which is expected when a tab is dragged.
1362 void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override { 1362 void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override {
1363 if (params.target != window_ || 1363 if (params.target != window_)
1364 (params.old_parent->id() == kShellWindowId_DefaultContainer &&
1365 params.new_parent->id() == kShellWindowId_DockedContainer) ||
1366 (params.old_parent->id() == kShellWindowId_DockedContainer &&
1367 params.new_parent->id() == kShellWindowId_DefaultContainer)) {
1368 return; 1364 return;
1369 }
1370 change_count_++; 1365 change_count_++;
oshima 2017/02/22 06:49:07 looks like this isn't used?
afakhry 2017/02/22 22:04:43 Done.
1371 } 1366 }
1372 1367
1373 private: 1368 private:
1374 int change_count_; 1369 int change_count_;
1375 aura::Window* window_; 1370 aura::Window* window_;
1376 1371
1377 DISALLOW_COPY_AND_ASSIGN(DragMaximizedNonTrackedWindowObserver); 1372 DISALLOW_COPY_AND_ASSIGN(DragMaximizedNonTrackedWindowObserver);
1378 }; 1373 };
1379 1374
1380 } // namespace 1375 } // namespace
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location, 0, 1582 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location, 0,
1588 ui::EventTimeForNow()); 1583 ui::EventTimeForNow());
1589 ui::EventTarget* target = targeter->FindTargetForEvent(root, &touch); 1584 ui::EventTarget* target = targeter->FindTargetForEvent(root, &touch);
1590 if (points[i].is_target_hit) 1585 if (points[i].is_target_hit)
1591 EXPECT_EQ(window.get(), target); 1586 EXPECT_EQ(window.get(), target);
1592 else 1587 else
1593 EXPECT_NE(window.get(), target); 1588 EXPECT_NE(window.get(), target);
1594 } 1589 }
1595 } 1590 }
1596 1591
1597 // Verifies events targeting just outside the window edges for docked windows.
1598 TEST_F(WorkspaceControllerTest, WindowEdgeHitTestDocked) {
1599 aura::test::TestWindowDelegate delegate;
1600 // Make window smaller than the minimum docked area so that the window edges
1601 // are exposed.
1602 delegate.set_maximum_size(gfx::Size(180, 200));
1603 std::unique_ptr<Window> window(aura::test::CreateTestWindowWithDelegate(
1604 &delegate, 123, gfx::Rect(20, 10, 100, 50), NULL));
1605 ParentWindowInPrimaryRootWindow(window.get());
1606 aura::Window* docked_container = Shell::GetContainer(
1607 window->GetRootWindow(), kShellWindowId_DockedContainer);
1608 docked_container->AddChild(window.get());
1609 window->Show();
1610 ui::EventTarget* root = window->GetRootWindow();
1611 ui::EventTargeter* targeter = root->GetEventTargeter();
1612 const gfx::Rect bounds = window->bounds();
1613 const int kNumPoints = 5;
1614 struct {
1615 const char* direction;
1616 gfx::Point location;
1617 bool is_target_hit;
1618 } points[kNumPoints] = {
1619 {"left", gfx::Point(bounds.x() - 2, bounds.y() + 10), true},
1620 {"top", gfx::Point(bounds.x() + 10, bounds.y() - 2), true},
1621 {"right", gfx::Point(bounds.right() + 2, bounds.y() + 10), true},
1622 {"bottom", gfx::Point(bounds.x() + 10, bounds.bottom() + 2), true},
1623 {"outside", gfx::Point(bounds.x() + 10, bounds.y() - 31), false},
1624 };
1625 for (int i = 0; i < kNumPoints; ++i) {
1626 SCOPED_TRACE(points[i].direction);
1627 const gfx::Point& location = points[i].location;
1628 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, location, location,
1629 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE);
1630 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse);
1631 if (points[i].is_target_hit)
1632 EXPECT_EQ(window.get(), target);
1633 else
1634 EXPECT_NE(window.get(), target);
1635
1636 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, location, 0,
1637 ui::EventTimeForNow());
1638 target = targeter->FindTargetForEvent(root, &touch);
1639 if (points[i].is_target_hit)
1640 EXPECT_EQ(window.get(), target);
1641 else
1642 EXPECT_NE(window.get(), target);
1643 }
1644 }
1645
1646 } // namespace ash 1592 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698