| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/workspace_manager2.h" | 5 #include "ash/wm/workspace/workspace_manager2.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/root_window_controller.h" |
| 8 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
| 9 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 10 #include "ash/shell_window_ids.h" | 11 #include "ash/shell_window_ids.h" |
| 12 #include "ash/system/status_area_widget.h" |
| 11 #include "ash/test/ash_test_base.h" | 13 #include "ash/test/ash_test_base.h" |
| 12 #include "ash/wm/activation_controller.h" | 14 #include "ash/wm/activation_controller.h" |
| 13 #include "ash/wm/property_util.h" | 15 #include "ash/wm/property_util.h" |
| 14 #include "ash/wm/shelf_layout_manager.h" | 16 #include "ash/wm/shelf_layout_manager.h" |
| 15 #include "ash/wm/window_properties.h" | 17 #include "ash/wm/window_properties.h" |
| 16 #include "ash/wm/window_util.h" | 18 #include "ash/wm/window_util.h" |
| 17 #include "ash/wm/workspace/workspace2.h" | 19 #include "ash/wm/workspace/workspace2.h" |
| 18 #include "ash/wm/workspace_controller_test_helper.h" | 20 #include "ash/wm/workspace_controller_test_helper.h" |
| 19 #include "base/command_line.h" | 21 #include "base/command_line.h" |
| 20 #include "base/string_number_conversions.h" | 22 #include "base/string_number_conversions.h" |
| 21 #include "ui/aura/client/aura_constants.h" | 23 #include "ui/aura/client/aura_constants.h" |
| 22 #include "ui/aura/root_window.h" | 24 #include "ui/aura/root_window.h" |
| 23 #include "ui/aura/test/event_generator.h" | 25 #include "ui/aura/test/event_generator.h" |
| 24 #include "ui/aura/test/test_window_delegate.h" | 26 #include "ui/aura/test/test_window_delegate.h" |
| 25 #include "ui/aura/test/test_windows.h" | 27 #include "ui/aura/test/test_windows.h" |
| 26 #include "ui/aura/window.h" | 28 #include "ui/aura/window.h" |
| 27 #include "ui/base/ui_base_types.h" | 29 #include "ui/base/ui_base_types.h" |
| 28 #include "ui/compositor/layer.h" | 30 #include "ui/compositor/layer.h" |
| 29 #include "ui/gfx/screen.h" | 31 #include "ui/gfx/screen.h" |
| 30 #include "ui/views/widget/widget.h" | 32 #include "ui/views/widget/widget.h" |
| 31 | 33 |
| 32 using aura::Window; | 34 using aura::Window; |
| 33 | 35 |
| 34 namespace ash { | 36 namespace ash { |
| 35 namespace internal { | 37 namespace internal { |
| 36 | 38 |
| 37 namespace { | |
| 38 | |
| 39 bool GetWindowOverlapsShelf() { | |
| 40 return Shell::GetInstance()->shelf()->window_overlaps_shelf(); | |
| 41 } | |
| 42 | |
| 43 } // namespace | |
| 44 | |
| 45 class WorkspaceManager2Test : public test::AshTestBase { | 39 class WorkspaceManager2Test : public test::AshTestBase { |
| 46 public: | 40 public: |
| 47 WorkspaceManager2Test() : manager_(NULL) {} | 41 WorkspaceManager2Test() : manager_(NULL) {} |
| 48 virtual ~WorkspaceManager2Test() {} | 42 virtual ~WorkspaceManager2Test() {} |
| 49 | 43 |
| 50 aura::Window* CreateTestWindowUnparented() { | 44 aura::Window* CreateTestWindowUnparented() { |
| 51 aura::Window* window = new aura::Window(NULL); | 45 aura::Window* window = new aura::Window(NULL); |
| 52 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); | 46 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); |
| 53 window->SetType(aura::client::WINDOW_TYPE_NORMAL); | 47 window->SetType(aura::client::WINDOW_TYPE_NORMAL); |
| 54 window->Init(ui::LAYER_TEXTURED); | 48 window->Init(ui::LAYER_TEXTURED); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 } | 68 } |
| 75 | 69 |
| 76 gfx::Rect GetFullscreenBounds(aura::Window* window) { | 70 gfx::Rect GetFullscreenBounds(aura::Window* window) { |
| 77 return Shell::GetScreen()->GetDisplayNearestWindow(window).bounds(); | 71 return Shell::GetScreen()->GetDisplayNearestWindow(window).bounds(); |
| 78 } | 72 } |
| 79 | 73 |
| 80 Workspace2* active_workspace() { | 74 Workspace2* active_workspace() { |
| 81 return manager_->active_workspace_; | 75 return manager_->active_workspace_; |
| 82 } | 76 } |
| 83 | 77 |
| 78 ShelfLayoutManager* shelf_layout_manager() { |
| 79 return Shell::GetPrimaryRootWindowController()->shelf(); |
| 80 } |
| 81 |
| 82 bool GetWindowOverlapsShelf() { |
| 83 return shelf_layout_manager()->window_overlaps_shelf(); |
| 84 } |
| 85 |
| 84 Workspace2* FindBy(aura::Window* window) const { | 86 Workspace2* FindBy(aura::Window* window) const { |
| 85 return manager_->FindBy(window); | 87 return manager_->FindBy(window); |
| 86 } | 88 } |
| 87 | 89 |
| 88 std::string WorkspaceStateString(Workspace2* workspace) { | 90 std::string WorkspaceStateString(Workspace2* workspace) { |
| 89 return (workspace->is_maximized() ? "M" : "") + | 91 return (workspace->is_maximized() ? "M" : "") + |
| 90 base::IntToString(static_cast<int>( | 92 base::IntToString(static_cast<int>( |
| 91 workspace->window()->children().size())); | 93 workspace->window()->children().size())); |
| 92 } | 94 } |
| 93 | 95 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 // updated. | 455 // updated. |
| 454 TEST_F(WorkspaceManager2Test, ShelfStateUpdated) { | 456 TEST_F(WorkspaceManager2Test, ShelfStateUpdated) { |
| 455 // Since ShelfLayoutManager queries for mouse location, move the mouse so | 457 // Since ShelfLayoutManager queries for mouse location, move the mouse so |
| 456 // it isn't over the shelf. | 458 // it isn't over the shelf. |
| 457 aura::test::EventGenerator generator( | 459 aura::test::EventGenerator generator( |
| 458 Shell::GetPrimaryRootWindow(), gfx::Point()); | 460 Shell::GetPrimaryRootWindow(), gfx::Point()); |
| 459 generator.MoveMouseTo(0, 0); | 461 generator.MoveMouseTo(0, 0); |
| 460 | 462 |
| 461 scoped_ptr<Window> w1(CreateTestWindow()); | 463 scoped_ptr<Window> w1(CreateTestWindow()); |
| 462 const gfx::Rect w1_bounds(0, 1, 101, 102); | 464 const gfx::Rect w1_bounds(0, 1, 101, 102); |
| 463 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); | 465 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 464 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 466 shelf->SetAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 465 const gfx::Rect touches_shelf_bounds( | 467 const gfx::Rect touches_shelf_bounds( |
| 466 0, shelf->GetIdealBounds().y() - 10, 101, 102); | 468 0, shelf->GetIdealBounds().y() - 10, 101, 102); |
| 467 // Move |w1| to overlap the shelf. | 469 // Move |w1| to overlap the shelf. |
| 468 w1->SetBounds(touches_shelf_bounds); | 470 w1->SetBounds(touches_shelf_bounds); |
| 469 EXPECT_FALSE(GetWindowOverlapsShelf()); | 471 EXPECT_FALSE(GetWindowOverlapsShelf()); |
| 470 | 472 |
| 471 // A visible ignored window should not trigger the overlap. | 473 // A visible ignored window should not trigger the overlap. |
| 472 scoped_ptr<Window> w_ignored(CreateTestWindow()); | 474 scoped_ptr<Window> w_ignored(CreateTestWindow()); |
| 473 w_ignored->SetBounds(touches_shelf_bounds); | 475 w_ignored->SetBounds(touches_shelf_bounds); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 wm::ActivateWindow(w1.get()); | 670 wm::ActivateWindow(w1.get()); |
| 669 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | 671 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
| 670 EXPECT_FALSE(w1->IsVisible()); | 672 EXPECT_FALSE(w1->IsVisible()); |
| 671 w1->Show(); | 673 w1->Show(); |
| 672 EXPECT_TRUE(w1->IsVisible()); | 674 EXPECT_TRUE(w1->IsVisible()); |
| 673 } | 675 } |
| 674 | 676 |
| 675 // Test that we report we're in the fullscreen state even if the fullscreen | 677 // Test that we report we're in the fullscreen state even if the fullscreen |
| 676 // window isn't being managed by us (http://crbug.com/123931). | 678 // window isn't being managed by us (http://crbug.com/123931). |
| 677 TEST_F(WorkspaceManager2Test, GetWindowStateWithUnmanagedFullscreenWindow) { | 679 TEST_F(WorkspaceManager2Test, GetWindowStateWithUnmanagedFullscreenWindow) { |
| 678 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); | 680 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 679 | 681 |
| 680 // We need to create a regular window first so there's an active workspace. | 682 // We need to create a regular window first so there's an active workspace. |
| 681 scoped_ptr<Window> w1(CreateTestWindow()); | 683 scoped_ptr<Window> w1(CreateTestWindow()); |
| 682 w1->Show(); | 684 w1->Show(); |
| 683 | 685 |
| 684 scoped_ptr<Window> w2(CreateTestWindow()); | 686 scoped_ptr<Window> w2(CreateTestWindow()); |
| 685 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 687 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 686 SetPersistsAcrossAllWorkspaces( | 688 SetPersistsAcrossAllWorkspaces( |
| 687 w2.get(), | 689 w2.get(), |
| 688 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); | 690 WINDOW_PERSISTS_ACROSS_ALL_WORKSPACES_VALUE_YES); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 711 w2.reset(); | 713 w2.reset(); |
| 712 ASSERT_EQ("1 active=0", StateString()); | 714 ASSERT_EQ("1 active=0", StateString()); |
| 713 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); | 715 EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); |
| 714 EXPECT_EQ(WORKSPACE_WINDOW_STATE_DEFAULT, manager_->GetWindowState()); | 716 EXPECT_EQ(WORKSPACE_WINDOW_STATE_DEFAULT, manager_->GetWindowState()); |
| 715 } | 717 } |
| 716 | 718 |
| 717 // Variant of GetWindowStateWithUnmanagedFullscreenWindow that uses a maximized | 719 // Variant of GetWindowStateWithUnmanagedFullscreenWindow that uses a maximized |
| 718 // window rather than a normal window. | 720 // window rather than a normal window. |
| 719 TEST_F(WorkspaceManager2Test, | 721 TEST_F(WorkspaceManager2Test, |
| 720 GetWindowStateWithUnmanagedFullscreenWindowWithMaximized) { | 722 GetWindowStateWithUnmanagedFullscreenWindowWithMaximized) { |
| 721 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); | 723 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 722 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 724 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 723 | 725 |
| 724 // Make the first window maximized. | 726 // Make the first window maximized. |
| 725 scoped_ptr<Window> w1(CreateTestWindow()); | 727 scoped_ptr<Window> w1(CreateTestWindow()); |
| 726 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 728 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 727 w1->Show(); | 729 w1->Show(); |
| 728 | 730 |
| 729 scoped_ptr<Window> w2(CreateTestWindow()); | 731 scoped_ptr<Window> w2(CreateTestWindow()); |
| 730 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); | 732 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); |
| 731 SetPersistsAcrossAllWorkspaces( | 733 SetPersistsAcrossAllWorkspaces( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 | 778 |
| 777 // Verifies going from maximized to minimized sets the right state for painting | 779 // Verifies going from maximized to minimized sets the right state for painting |
| 778 // the background of the launcher. | 780 // the background of the launcher. |
| 779 TEST_F(WorkspaceManager2Test, MinimizeResetsVisibility) { | 781 TEST_F(WorkspaceManager2Test, MinimizeResetsVisibility) { |
| 780 scoped_ptr<Window> w1(CreateTestWindow()); | 782 scoped_ptr<Window> w1(CreateTestWindow()); |
| 781 w1->Show(); | 783 w1->Show(); |
| 782 wm::ActivateWindow(w1.get()); | 784 wm::ActivateWindow(w1.get()); |
| 783 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 785 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 784 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | 786 w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
| 785 EXPECT_EQ(ShelfLayoutManager::VISIBLE, | 787 EXPECT_EQ(ShelfLayoutManager::VISIBLE, |
| 786 Shell::GetInstance()->shelf()->visibility_state()); | 788 shelf_layout_manager()->visibility_state()); |
| 787 EXPECT_FALSE(Shell::GetInstance()->launcher()->paints_background()); | 789 EXPECT_FALSE(Launcher::ForPrimaryDisplay()->paints_background()); |
| 788 } | 790 } |
| 789 | 791 |
| 790 // Verifies transients are moved when maximizing. | 792 // Verifies transients are moved when maximizing. |
| 791 TEST_F(WorkspaceManager2Test, MoveTransientOnMaximize) { | 793 TEST_F(WorkspaceManager2Test, MoveTransientOnMaximize) { |
| 792 scoped_ptr<Window> w1(CreateTestWindow()); | 794 scoped_ptr<Window> w1(CreateTestWindow()); |
| 793 w1->Show(); | 795 w1->Show(); |
| 794 scoped_ptr<Window> w2(CreateTestWindow()); | 796 scoped_ptr<Window> w2(CreateTestWindow()); |
| 795 w1->AddTransientChild(w2.get()); | 797 w1->AddTransientChild(w2.get()); |
| 796 w2->Show(); | 798 w2->Show(); |
| 797 wm::ActivateWindow(w1.get()); | 799 wm::ActivateWindow(w1.get()); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 EXPECT_TRUE(w1->IsVisible()); | 879 EXPECT_TRUE(w1->IsVisible()); |
| 878 } | 880 } |
| 879 | 881 |
| 880 // Verifies windows that are offscreen don't move when switching workspaces. | 882 // Verifies windows that are offscreen don't move when switching workspaces. |
| 881 TEST_F(WorkspaceManager2Test, DontMoveOnSwitch) { | 883 TEST_F(WorkspaceManager2Test, DontMoveOnSwitch) { |
| 882 aura::test::EventGenerator generator( | 884 aura::test::EventGenerator generator( |
| 883 Shell::GetPrimaryRootWindow(), gfx::Point()); | 885 Shell::GetPrimaryRootWindow(), gfx::Point()); |
| 884 generator.MoveMouseTo(0, 0); | 886 generator.MoveMouseTo(0, 0); |
| 885 | 887 |
| 886 scoped_ptr<Window> w1(CreateTestWindow()); | 888 scoped_ptr<Window> w1(CreateTestWindow()); |
| 887 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); | 889 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 888 const gfx::Rect touches_shelf_bounds( | 890 const gfx::Rect touches_shelf_bounds( |
| 889 0, shelf->GetIdealBounds().y() - 10, 101, 102); | 891 0, shelf->GetIdealBounds().y() - 10, 101, 102); |
| 890 // Move |w1| to overlap the shelf. | 892 // Move |w1| to overlap the shelf. |
| 891 w1->SetBounds(touches_shelf_bounds); | 893 w1->SetBounds(touches_shelf_bounds); |
| 892 w1->Show(); | 894 w1->Show(); |
| 893 wm::ActivateWindow(w1.get()); | 895 wm::ActivateWindow(w1.get()); |
| 894 | 896 |
| 895 // Create another window and maximize it. | 897 // Create another window and maximize it. |
| 896 scoped_ptr<Window> w2(CreateTestWindow()); | 898 scoped_ptr<Window> w2(CreateTestWindow()); |
| 897 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); | 899 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); |
| 898 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 900 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 899 w2->Show(); | 901 w2->Show(); |
| 900 wm::ActivateWindow(w2.get()); | 902 wm::ActivateWindow(w2.get()); |
| 901 | 903 |
| 902 // Switch to w1. | 904 // Switch to w1. |
| 903 wm::ActivateWindow(w1.get()); | 905 wm::ActivateWindow(w1.get()); |
| 904 EXPECT_EQ(touches_shelf_bounds.ToString(), w1->bounds().ToString()); | 906 EXPECT_EQ(touches_shelf_bounds.ToString(), w1->bounds().ToString()); |
| 905 } | 907 } |
| 906 | 908 |
| 907 // Verifies that windows that are completely offscreen move when switching | 909 // Verifies that windows that are completely offscreen move when switching |
| 908 // workspaces. | 910 // workspaces. |
| 909 TEST_F(WorkspaceManager2Test, MoveOnSwitch) { | 911 TEST_F(WorkspaceManager2Test, MoveOnSwitch) { |
| 910 aura::test::EventGenerator generator( | 912 aura::test::EventGenerator generator( |
| 911 Shell::GetPrimaryRootWindow(), gfx::Point()); | 913 Shell::GetPrimaryRootWindow(), gfx::Point()); |
| 912 generator.MoveMouseTo(0, 0); | 914 generator.MoveMouseTo(0, 0); |
| 913 | 915 |
| 914 scoped_ptr<Window> w1(CreateTestWindow()); | 916 scoped_ptr<Window> w1(CreateTestWindow()); |
| 915 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); | 917 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 916 const gfx::Rect w1_bounds(0, shelf->GetIdealBounds().y(), 100, 200); | 918 const gfx::Rect w1_bounds(0, shelf->GetIdealBounds().y(), 100, 200); |
| 917 // Move |w1| so that the top edge is the same as the top edge of the shelf. | 919 // Move |w1| so that the top edge is the same as the top edge of the shelf. |
| 918 w1->SetBounds(w1_bounds); | 920 w1->SetBounds(w1_bounds); |
| 919 w1->Show(); | 921 w1->Show(); |
| 920 wm::ActivateWindow(w1.get()); | 922 wm::ActivateWindow(w1.get()); |
| 921 EXPECT_EQ(w1_bounds.ToString(), w1->bounds().ToString()); | 923 EXPECT_EQ(w1_bounds.ToString(), w1->bounds().ToString()); |
| 922 | 924 |
| 923 // Create another window and maximize it. | 925 // Create another window and maximize it. |
| 924 scoped_ptr<Window> w2(CreateTestWindow()); | 926 scoped_ptr<Window> w2(CreateTestWindow()); |
| 925 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); | 927 w2->SetBounds(gfx::Rect(10, 11, 250, 251)); |
| 926 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); | 928 w2->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); |
| 927 w2->Show(); | 929 w2->Show(); |
| 928 wm::ActivateWindow(w2.get()); | 930 wm::ActivateWindow(w2.get()); |
| 929 | 931 |
| 930 // Increase the size of the shelf. This would make |w1| fall completely out of | 932 // Increase the size of the shelf. This would make |w1| fall completely out of |
| 931 // the display work area. | 933 // the display work area. |
| 932 gfx::Size size = shelf->status()->GetWindowBoundsInScreen().size(); | 934 gfx::Size size(shelf->status_area_widget()->GetWindowBoundsInScreen().size()); |
| 933 size.Enlarge(0, 30); | 935 size.Enlarge(0, 30); |
| 934 shelf->status()->SetSize(size); | 936 shelf->status_area_widget()->SetSize(size); |
| 935 | 937 |
| 936 // Switch to w1. The window should have moved. | 938 // Switch to w1. The window should have moved. |
| 937 wm::ActivateWindow(w1.get()); | 939 wm::ActivateWindow(w1.get()); |
| 938 EXPECT_NE(w1_bounds.ToString(), w1->bounds().ToString()); | 940 EXPECT_NE(w1_bounds.ToString(), w1->bounds().ToString()); |
| 939 } | 941 } |
| 940 | 942 |
| 941 // Verifies Focus() works in a window that isn't in the active workspace. | 943 // Verifies Focus() works in a window that isn't in the active workspace. |
| 942 TEST_F(WorkspaceManager2Test, FocusOnFullscreenInSeparateWorkspace) { | 944 TEST_F(WorkspaceManager2Test, FocusOnFullscreenInSeparateWorkspace) { |
| 943 scoped_ptr<Window> w1(CreateTestWindow()); | 945 scoped_ptr<Window> w1(CreateTestWindow()); |
| 944 w1->SetBounds(gfx::Rect(10, 11, 250, 251)); | 946 w1->SetBounds(gfx::Rect(10, 11, 250, 251)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 985 | 987 |
| 986 } // namespace | 988 } // namespace |
| 987 | 989 |
| 988 // Exercises possible crash in W2. Here's the sequence: | 990 // Exercises possible crash in W2. Here's the sequence: |
| 989 // . minimize a maximized window. | 991 // . minimize a maximized window. |
| 990 // . remove the window (which happens when switching displays). | 992 // . remove the window (which happens when switching displays). |
| 991 // . add the window back. | 993 // . add the window back. |
| 992 // . show the window and during the bounds change activate it. | 994 // . show the window and during the bounds change activate it. |
| 993 TEST_F(WorkspaceManager2Test, DontCrashOnChangeAndActivate) { | 995 TEST_F(WorkspaceManager2Test, DontCrashOnChangeAndActivate) { |
| 994 // Force the shelf | 996 // Force the shelf |
| 995 ShelfLayoutManager* shelf = Shell::GetInstance()->shelf(); | 997 ShelfLayoutManager* shelf = shelf_layout_manager(); |
| 996 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 998 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 997 | 999 |
| 998 DontCrashOnChangeAndActivateDelegate delegate; | 1000 DontCrashOnChangeAndActivateDelegate delegate; |
| 999 scoped_ptr<Window> w1( | 1001 scoped_ptr<Window> w1( |
| 1000 CreateTestWindowWithDelegate(&delegate, 1000, gfx::Rect(10, 11, 250, 251), | 1002 CreateTestWindowWithDelegate(&delegate, 1000, gfx::Rect(10, 11, 250, 251), |
| 1001 NULL)); | 1003 NULL)); |
| 1002 w1->Show(); | 1004 w1->Show(); |
| 1003 wm::ActivateWindow(w1.get()); | 1005 wm::ActivateWindow(w1.get()); |
| 1004 wm::MaximizeWindow(w1.get()); | 1006 wm::MaximizeWindow(w1.get()); |
| 1005 wm::MinimizeWindow(w1.get()); | 1007 wm::MinimizeWindow(w1.get()); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 EXPECT_EQ(w1->parent(), w2->parent()); | 1102 EXPECT_EQ(w1->parent(), w2->parent()); |
| 1101 ASSERT_EQ("0 M2 active=1", StateString()); | 1103 ASSERT_EQ("0 M2 active=1", StateString()); |
| 1102 | 1104 |
| 1103 // Activate |w1|, should result in dropping |w2| to the desktop. | 1105 // Activate |w1|, should result in dropping |w2| to the desktop. |
| 1104 wm::ActivateWindow(w1.get()); | 1106 wm::ActivateWindow(w1.get()); |
| 1105 ASSERT_EQ("1 M1 active=1", StateString()); | 1107 ASSERT_EQ("1 M1 active=1", StateString()); |
| 1106 } | 1108 } |
| 1107 | 1109 |
| 1108 } // namespace internal | 1110 } // namespace internal |
| 1109 } // namespace ash | 1111 } // namespace ash |
| OLD | NEW |