| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 result += " "; | 75 result += " "; |
| 76 result += layer_i->second; | 76 result += layer_i->second; |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 return result; | 79 return result; |
| 80 } | 80 } |
| 81 | 81 |
| 82 class WorkspaceControllerTest : public test::AshTestBase { | 82 class WorkspaceControllerTest : public test::AshTestBase { |
| 83 public: | 83 public: |
| 84 WorkspaceControllerTest() {} | 84 WorkspaceControllerTest() {} |
| 85 virtual ~WorkspaceControllerTest() {} | 85 ~WorkspaceControllerTest() override {} |
| 86 | 86 |
| 87 aura::Window* CreateTestWindowUnparented() { | 87 aura::Window* CreateTestWindowUnparented() { |
| 88 aura::Window* window = new aura::Window(NULL); | 88 aura::Window* window = new aura::Window(NULL); |
| 89 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 89 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 90 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); | 90 window->SetType(ui::wm::WINDOW_TYPE_NORMAL); |
| 91 window->Init(aura::WINDOW_LAYER_TEXTURED); | 91 window->Init(aura::WINDOW_LAYER_TEXTURED); |
| 92 return window; | 92 return window; |
| 93 } | 93 } |
| 94 | 94 |
| 95 aura::Window* CreateTestWindow() { | 95 aura::Window* CreateTestWindow() { |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 | 639 |
| 640 // WindowDelegate used by DontCrashOnChangeAndActivate. | 640 // WindowDelegate used by DontCrashOnChangeAndActivate. |
| 641 class DontCrashOnChangeAndActivateDelegate | 641 class DontCrashOnChangeAndActivateDelegate |
| 642 : public aura::test::TestWindowDelegate { | 642 : public aura::test::TestWindowDelegate { |
| 643 public: | 643 public: |
| 644 DontCrashOnChangeAndActivateDelegate() : window_(NULL) {} | 644 DontCrashOnChangeAndActivateDelegate() : window_(NULL) {} |
| 645 | 645 |
| 646 void set_window(aura::Window* window) { window_ = window; } | 646 void set_window(aura::Window* window) { window_ = window; } |
| 647 | 647 |
| 648 // WindowDelegate overrides: | 648 // WindowDelegate overrides: |
| 649 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 649 void OnBoundsChanged(const gfx::Rect& old_bounds, |
| 650 const gfx::Rect& new_bounds) override { | 650 const gfx::Rect& new_bounds) override { |
| 651 if (window_) { | 651 if (window_) { |
| 652 wm::ActivateWindow(window_); | 652 wm::ActivateWindow(window_); |
| 653 window_ = NULL; | 653 window_ = NULL; |
| 654 } | 654 } |
| 655 } | 655 } |
| 656 | 656 |
| 657 private: | 657 private: |
| 658 aura::Window* window_; | 658 aura::Window* window_; |
| 659 | 659 |
| 660 DISALLOW_COPY_AND_ASSIGN(DontCrashOnChangeAndActivateDelegate); | 660 DISALLOW_COPY_AND_ASSIGN(DontCrashOnChangeAndActivateDelegate); |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1322 | 1322 |
| 1323 // Number of times OnWindowHierarchyChanged() has been received. | 1323 // Number of times OnWindowHierarchyChanged() has been received. |
| 1324 void clear_change_count() { change_count_ = 0; } | 1324 void clear_change_count() { change_count_ = 0; } |
| 1325 int change_count() const { | 1325 int change_count() const { |
| 1326 return change_count_; | 1326 return change_count_; |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 // aura::WindowObserver overrides: | 1329 // aura::WindowObserver overrides: |
| 1330 // Counts number of times a window is reparented. Ignores reparenting into and | 1330 // Counts number of times a window is reparented. Ignores reparenting into and |
| 1331 // from a docked container which is expected when a tab is dragged. | 1331 // from a docked container which is expected when a tab is dragged. |
| 1332 virtual void OnWindowHierarchyChanged( | 1332 void OnWindowHierarchyChanged(const HierarchyChangeParams& params) override { |
| 1333 const HierarchyChangeParams& params) override { | |
| 1334 if (params.target != window_ || | 1333 if (params.target != window_ || |
| 1335 (params.old_parent->id() == kShellWindowId_DefaultContainer && | 1334 (params.old_parent->id() == kShellWindowId_DefaultContainer && |
| 1336 params.new_parent->id() == kShellWindowId_DockedContainer) || | 1335 params.new_parent->id() == kShellWindowId_DockedContainer) || |
| 1337 (params.old_parent->id() == kShellWindowId_DockedContainer && | 1336 (params.old_parent->id() == kShellWindowId_DockedContainer && |
| 1338 params.new_parent->id() == kShellWindowId_DefaultContainer)) { | 1337 params.new_parent->id() == kShellWindowId_DefaultContainer)) { |
| 1339 return; | 1338 return; |
| 1340 } | 1339 } |
| 1341 change_count_++; | 1340 change_count_++; |
| 1342 } | 1341 } |
| 1343 | 1342 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1369 EXPECT_TRUE(maximized_window->IsVisible()); | 1368 EXPECT_TRUE(maximized_window->IsVisible()); |
| 1370 } | 1369 } |
| 1371 | 1370 |
| 1372 namespace { | 1371 namespace { |
| 1373 | 1372 |
| 1374 // Subclass of WorkspaceControllerTest that runs tests with docked windows | 1373 // Subclass of WorkspaceControllerTest that runs tests with docked windows |
| 1375 // enabled and disabled. | 1374 // enabled and disabled. |
| 1376 class WorkspaceControllerTestDragging : public WorkspaceControllerTest { | 1375 class WorkspaceControllerTestDragging : public WorkspaceControllerTest { |
| 1377 public: | 1376 public: |
| 1378 WorkspaceControllerTestDragging() {} | 1377 WorkspaceControllerTestDragging() {} |
| 1379 virtual ~WorkspaceControllerTestDragging() {} | 1378 ~WorkspaceControllerTestDragging() override {} |
| 1380 | 1379 |
| 1381 private: | 1380 private: |
| 1382 DISALLOW_COPY_AND_ASSIGN(WorkspaceControllerTestDragging); | 1381 DISALLOW_COPY_AND_ASSIGN(WorkspaceControllerTestDragging); |
| 1383 }; | 1382 }; |
| 1384 | 1383 |
| 1385 } // namespace | 1384 } // namespace |
| 1386 | 1385 |
| 1387 // Verifies that when dragging a window over the shelf overlap is detected | 1386 // Verifies that when dragging a window over the shelf overlap is detected |
| 1388 // during and after the drag. | 1387 // during and after the drag. |
| 1389 TEST_F(WorkspaceControllerTestDragging, DragWindowOverlapShelf) { | 1388 TEST_F(WorkspaceControllerTestDragging, DragWindowOverlapShelf) { |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1609 ui::EventTimeForNow()); | 1608 ui::EventTimeForNow()); |
| 1610 target = targeter->FindTargetForEvent(root, &touch); | 1609 target = targeter->FindTargetForEvent(root, &touch); |
| 1611 if (points[i].is_target_hit) | 1610 if (points[i].is_target_hit) |
| 1612 EXPECT_EQ(window.get(), target); | 1611 EXPECT_EQ(window.get(), target); |
| 1613 else | 1612 else |
| 1614 EXPECT_NE(window.get(), target); | 1613 EXPECT_NE(window.get(), target); |
| 1615 } | 1614 } |
| 1616 } | 1615 } |
| 1617 | 1616 |
| 1618 } // namespace ash | 1617 } // namespace ash |
| OLD | NEW |