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

Side by Side Diff: ash/wm/workspace/workspace_layout_manager_unittest.cc

Issue 2072853002: Implement "pinned" mode in ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 6 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/window_cycle_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/wm/workspace/workspace_layout_manager.h" 5 #include "ash/common/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/aura/wm_window_aura.h" 10 #include "ash/aura/wm_window_aura.h"
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 always_on_top_window2->SetProperty(aura::client::kAlwaysOnTopKey, true); 658 always_on_top_window2->SetProperty(aura::client::kAlwaysOnTopKey, true);
659 // Making a window fullscreen temporarily suspends always on top state. 659 // Making a window fullscreen temporarily suspends always on top state.
660 fullscreen_window->SetProperty(aura::client::kShowStateKey, 660 fullscreen_window->SetProperty(aura::client::kShowStateKey,
661 ui::SHOW_STATE_FULLSCREEN); 661 ui::SHOW_STATE_FULLSCREEN);
662 EXPECT_FALSE( 662 EXPECT_FALSE(
663 always_on_top_window1->GetProperty(aura::client::kAlwaysOnTopKey)); 663 always_on_top_window1->GetProperty(aura::client::kAlwaysOnTopKey));
664 EXPECT_FALSE( 664 EXPECT_FALSE(
665 always_on_top_window2->GetProperty(aura::client::kAlwaysOnTopKey)); 665 always_on_top_window2->GetProperty(aura::client::kAlwaysOnTopKey));
666 EXPECT_NE(nullptr, GetRootWindowController(fullscreen_window->GetRootWindow()) 666 EXPECT_NE(nullptr, GetRootWindowController(fullscreen_window->GetRootWindow())
667 ->GetWindowForFullscreenMode()); 667 ->GetWindowForFullscreenMode());
668
669 // Adding a new always-on-top window is not affected by fullscreen.
670 std::unique_ptr<aura::Window> always_on_top_window3(CreateTestWindow(bounds));
671 always_on_top_window3->SetProperty(aura::client::kAlwaysOnTopKey, true);
672 EXPECT_TRUE(
673 always_on_top_window3->GetProperty(aura::client::kAlwaysOnTopKey));
674
668 // Making fullscreen window normal restores always on top windows. 675 // Making fullscreen window normal restores always on top windows.
669 fullscreen_window->SetProperty(aura::client::kShowStateKey, 676 fullscreen_window->SetProperty(aura::client::kShowStateKey,
670 ui::SHOW_STATE_NORMAL); 677 ui::SHOW_STATE_NORMAL);
671 EXPECT_TRUE( 678 EXPECT_TRUE(
672 always_on_top_window1->GetProperty(aura::client::kAlwaysOnTopKey)); 679 always_on_top_window1->GetProperty(aura::client::kAlwaysOnTopKey));
673 EXPECT_TRUE( 680 EXPECT_TRUE(
674 always_on_top_window2->GetProperty(aura::client::kAlwaysOnTopKey)); 681 always_on_top_window2->GetProperty(aura::client::kAlwaysOnTopKey));
682 EXPECT_TRUE(
683 always_on_top_window3->GetProperty(aura::client::kAlwaysOnTopKey));
675 EXPECT_EQ(nullptr, GetRootWindowController(fullscreen_window->GetRootWindow()) 684 EXPECT_EQ(nullptr, GetRootWindowController(fullscreen_window->GetRootWindow())
676 ->GetWindowForFullscreenMode()); 685 ->GetWindowForFullscreenMode());
677 } 686 }
678 687
688 // Similary, pinned window causes always_on_top_ windows to stack below.
689 TEST_F(WorkspaceLayoutManagerSoloTest, PinnedSuspendsAlwaysOnTop) {
690 gfx::Rect bounds(100, 100, 200, 200);
691 std::unique_ptr<aura::Window> pinned_window(CreateTestWindow(bounds));
692 std::unique_ptr<aura::Window> always_on_top_window1(CreateTestWindow(bounds));
693 std::unique_ptr<aura::Window> always_on_top_window2(CreateTestWindow(bounds));
694 always_on_top_window1->SetProperty(aura::client::kAlwaysOnTopKey, true);
695 always_on_top_window2->SetProperty(aura::client::kAlwaysOnTopKey, true);
696
697 // Making a window pinned temporarily suspends always on top state.
698 wm::PinWindow(pinned_window.get());
699 EXPECT_FALSE(
700 always_on_top_window1->GetProperty(aura::client::kAlwaysOnTopKey));
701 EXPECT_FALSE(
702 always_on_top_window2->GetProperty(aura::client::kAlwaysOnTopKey));
703
704 // Adding a new always-on-top window also is affected by pinned mode.
705 std::unique_ptr<aura::Window> always_on_top_window3(CreateTestWindow(bounds));
706 always_on_top_window3->SetProperty(aura::client::kAlwaysOnTopKey, true);
707 EXPECT_FALSE(
708 always_on_top_window3->GetProperty(aura::client::kAlwaysOnTopKey));
709
710 // Making pinned window normal restores always on top windows.
711 WmWindowAura::Get(pinned_window.get())->GetWindowState()->Restore();
712 EXPECT_TRUE(
713 always_on_top_window1->GetProperty(aura::client::kAlwaysOnTopKey));
714 EXPECT_TRUE(
715 always_on_top_window2->GetProperty(aura::client::kAlwaysOnTopKey));
716 EXPECT_TRUE(
717 always_on_top_window3->GetProperty(aura::client::kAlwaysOnTopKey));
718 }
719
679 // Tests fullscreen window size during root window resize. 720 // Tests fullscreen window size during root window resize.
680 TEST_F(WorkspaceLayoutManagerSoloTest, FullscreenRootWindowResize) { 721 TEST_F(WorkspaceLayoutManagerSoloTest, FullscreenRootWindowResize) {
681 gfx::Rect bounds(100, 100, 200, 200); 722 gfx::Rect bounds(100, 100, 200, 200);
682 std::unique_ptr<aura::Window> window(CreateTestWindow(bounds)); 723 std::unique_ptr<aura::Window> window(CreateTestWindow(bounds));
683 // Fullscreen window fills the whole display. 724 // Fullscreen window fills the whole display.
684 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); 725 window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN);
685 EXPECT_EQ(display::Screen::GetScreen() 726 EXPECT_EQ(display::Screen::GetScreen()
686 ->GetDisplayNearestWindow(window.get()) 727 ->GetDisplayNearestWindow(window.get())
687 .bounds() 728 .bounds()
688 .ToString(), 729 .ToString(),
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 EXPECT_EQ(gfx::Rect(50, 1193 EXPECT_EQ(gfx::Rect(50,
1153 keyboard_bounds.y() - keyboard_bounds.height()/2, 1194 keyboard_bounds.y() - keyboard_bounds.height()/2,
1154 occluded_window_bounds.width(), 1195 occluded_window_bounds.width(),
1155 occluded_window_bounds.height()).ToString(), 1196 occluded_window_bounds.height()).ToString(),
1156 window->bounds().ToString()); 1197 window->bounds().ToString());
1157 HideKeyboard(); 1198 HideKeyboard();
1158 EXPECT_EQ(occluded_window_bounds.ToString(), window->bounds().ToString()); 1199 EXPECT_EQ(occluded_window_bounds.ToString(), window->bounds().ToString());
1159 } 1200 }
1160 1201
1161 } // namespace ash 1202 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_cycle_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698