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_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "ash/public/cpp/config.h" | 10 #include "ash/public/cpp/config.h" |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 CreateTestWindowInShellWithBounds(bounds)); | 723 CreateTestWindowInShellWithBounds(bounds)); |
724 always_on_top_window1->SetProperty(aura::client::kAlwaysOnTopKey, true); | 724 always_on_top_window1->SetProperty(aura::client::kAlwaysOnTopKey, true); |
725 always_on_top_window2->SetProperty(aura::client::kAlwaysOnTopKey, true); | 725 always_on_top_window2->SetProperty(aura::client::kAlwaysOnTopKey, true); |
726 // Making a window fullscreen temporarily suspends always on top state. | 726 // Making a window fullscreen temporarily suspends always on top state. |
727 fullscreen_window->SetProperty(aura::client::kShowStateKey, | 727 fullscreen_window->SetProperty(aura::client::kShowStateKey, |
728 ui::SHOW_STATE_FULLSCREEN); | 728 ui::SHOW_STATE_FULLSCREEN); |
729 EXPECT_FALSE( | 729 EXPECT_FALSE( |
730 always_on_top_window1->GetProperty(aura::client::kAlwaysOnTopKey)); | 730 always_on_top_window1->GetProperty(aura::client::kAlwaysOnTopKey)); |
731 EXPECT_FALSE( | 731 EXPECT_FALSE( |
732 always_on_top_window2->GetProperty(aura::client::kAlwaysOnTopKey)); | 732 always_on_top_window2->GetProperty(aura::client::kAlwaysOnTopKey)); |
733 EXPECT_NE(nullptr, wm::GetWindowForFullscreenMode( | 733 EXPECT_NE(nullptr, wm::GetWindowForFullscreenMode(fullscreen_window.get())); |
734 WmWindow::Get(fullscreen_window.get()))); | |
735 | 734 |
736 // Adding a new always-on-top window is not affected by fullscreen. | 735 // Adding a new always-on-top window is not affected by fullscreen. |
737 std::unique_ptr<aura::Window> always_on_top_window3( | 736 std::unique_ptr<aura::Window> always_on_top_window3( |
738 CreateTestWindowInShellWithBounds(bounds)); | 737 CreateTestWindowInShellWithBounds(bounds)); |
739 always_on_top_window3->SetProperty(aura::client::kAlwaysOnTopKey, true); | 738 always_on_top_window3->SetProperty(aura::client::kAlwaysOnTopKey, true); |
740 EXPECT_TRUE( | 739 EXPECT_TRUE( |
741 always_on_top_window3->GetProperty(aura::client::kAlwaysOnTopKey)); | 740 always_on_top_window3->GetProperty(aura::client::kAlwaysOnTopKey)); |
742 | 741 |
743 // Making fullscreen window normal restores always on top windows. | 742 // Making fullscreen window normal restores always on top windows. |
744 fullscreen_window->SetProperty(aura::client::kShowStateKey, | 743 fullscreen_window->SetProperty(aura::client::kShowStateKey, |
745 ui::SHOW_STATE_NORMAL); | 744 ui::SHOW_STATE_NORMAL); |
746 EXPECT_TRUE( | 745 EXPECT_TRUE( |
747 always_on_top_window1->GetProperty(aura::client::kAlwaysOnTopKey)); | 746 always_on_top_window1->GetProperty(aura::client::kAlwaysOnTopKey)); |
748 EXPECT_TRUE( | 747 EXPECT_TRUE( |
749 always_on_top_window2->GetProperty(aura::client::kAlwaysOnTopKey)); | 748 always_on_top_window2->GetProperty(aura::client::kAlwaysOnTopKey)); |
750 EXPECT_TRUE( | 749 EXPECT_TRUE( |
751 always_on_top_window3->GetProperty(aura::client::kAlwaysOnTopKey)); | 750 always_on_top_window3->GetProperty(aura::client::kAlwaysOnTopKey)); |
752 EXPECT_EQ(nullptr, wm::GetWindowForFullscreenMode( | 751 EXPECT_EQ(nullptr, wm::GetWindowForFullscreenMode(fullscreen_window.get())); |
753 WmWindow::Get(fullscreen_window.get()))); | |
754 } | 752 } |
755 | 753 |
756 // Similary, pinned window causes always_on_top_ windows to stack below. | 754 // Similary, pinned window causes always_on_top_ windows to stack below. |
757 TEST_F(WorkspaceLayoutManagerSoloTest, PinnedSuspendsAlwaysOnTop) { | 755 TEST_F(WorkspaceLayoutManagerSoloTest, PinnedSuspendsAlwaysOnTop) { |
758 gfx::Rect bounds(100, 100, 200, 200); | 756 gfx::Rect bounds(100, 100, 200, 200); |
759 std::unique_ptr<aura::Window> pinned_window( | 757 std::unique_ptr<aura::Window> pinned_window( |
760 CreateTestWindowInShellWithBounds(bounds)); | 758 CreateTestWindowInShellWithBounds(bounds)); |
761 std::unique_ptr<aura::Window> always_on_top_window1( | 759 std::unique_ptr<aura::Window> always_on_top_window1( |
762 CreateTestWindowInShellWithBounds(bounds)); | 760 CreateTestWindowInShellWithBounds(bounds)); |
763 std::unique_ptr<aura::Window> always_on_top_window2( | 761 std::unique_ptr<aura::Window> always_on_top_window2( |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()).ToString(), | 924 ScreenUtil::GetMaximizedWindowBoundsInParent(window.get()).ToString(), |
927 window_bounds.ToString()); | 925 window_bounds.ToString()); |
928 EXPECT_EQ(window_bounds.ToString(), window->bounds().ToString()); | 926 EXPECT_EQ(window_bounds.ToString(), window->bounds().ToString()); |
929 } | 927 } |
930 | 928 |
931 // Following tests are written to test the backdrop functionality. | 929 // Following tests are written to test the backdrop functionality. |
932 | 930 |
933 namespace { | 931 namespace { |
934 | 932 |
935 WorkspaceLayoutManager* GetWorkspaceLayoutManager(aura::Window* container) { | 933 WorkspaceLayoutManager* GetWorkspaceLayoutManager(aura::Window* container) { |
936 return static_cast<WorkspaceLayoutManager*>( | 934 return static_cast<WorkspaceLayoutManager*>(container->layout_manager()); |
937 WmWindow::Get(container)->GetLayoutManager()); | |
938 } | 935 } |
939 | 936 |
940 class WorkspaceLayoutManagerBackdropTest : public test::AshTestBase { | 937 class WorkspaceLayoutManagerBackdropTest : public test::AshTestBase { |
941 public: | 938 public: |
942 WorkspaceLayoutManagerBackdropTest() : default_container_(nullptr) {} | 939 WorkspaceLayoutManagerBackdropTest() : default_container_(nullptr) {} |
943 ~WorkspaceLayoutManagerBackdropTest() override {} | 940 ~WorkspaceLayoutManagerBackdropTest() override {} |
944 | 941 |
945 void SetUp() override { | 942 void SetUp() override { |
946 AshTestBase::SetUp(); | 943 AshTestBase::SetUp(); |
947 UpdateDisplay("800x600"); | 944 UpdateDisplay("800x600"); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 window->SetBounds(keyboard_bounds()); | 1267 window->SetBounds(keyboard_bounds()); |
1271 wm::GetWindowState(window.get())->set_ignore_keyboard_bounds_change(true); | 1268 wm::GetWindowState(window.get())->set_ignore_keyboard_bounds_change(true); |
1272 wm::ActivateWindow(window.get()); | 1269 wm::ActivateWindow(window.get()); |
1273 | 1270 |
1274 EXPECT_EQ(keyboard_bounds(), window->bounds()); | 1271 EXPECT_EQ(keyboard_bounds(), window->bounds()); |
1275 ShowKeyboard(); | 1272 ShowKeyboard(); |
1276 EXPECT_EQ(keyboard_bounds(), window->bounds()); | 1273 EXPECT_EQ(keyboard_bounds(), window->bounds()); |
1277 } | 1274 } |
1278 | 1275 |
1279 } // namespace ash | 1276 } // namespace ash |
OLD | NEW |