Index: ash/wm/window_state_unittest.cc |
diff --git a/ash/wm/window_state_unittest.cc b/ash/wm/window_state_unittest.cc |
index e225d91f68a05456a20fa9ec20ac642ee1a446b2..6431f4fae76a03ece7f67b021aa94d54e3a3ffd1 100644 |
--- a/ash/wm/window_state_unittest.cc |
+++ b/ash/wm/window_state_unittest.cc |
@@ -11,6 +11,7 @@ |
#include "ash/common/wm/wm_event.h" |
#include "ash/test/ash_md_test_base.h" |
#include "ash/wm/window_state_aura.h" |
+#include "ash/wm/window_util.h" |
#include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
#include "ui/aura/client/aura_constants.h" |
#include "ui/aura/test/test_window_delegate.h" |
@@ -360,6 +361,33 @@ TEST_P(WindowStateTest, DoNotResizeMaximizedWindowInFullscreen) { |
maximized->GetBoundsInScreen().ToString()); |
} |
+TEST_P(WindowStateTest, TrustedPinned) { |
+ std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); |
+ WindowState* window_state = GetWindowState(window.get()); |
+ EXPECT_FALSE(window_state->IsTrustedPinned()); |
+ wm::PinWindow(window.get(), true /* trusted */); |
+ EXPECT_TRUE(window_state->IsTrustedPinned()); |
+ |
+ gfx::Rect work_area = |
+ display::Screen::GetScreen()->GetPrimaryDisplay().work_area(); |
+ EXPECT_EQ(work_area.ToString(), window->bounds().ToString()); |
+ |
+ // Sending non-unpin/non-workspace related event should be ignored. |
+ { |
+ const WMEvent fullscreen_event(WM_EVENT_FULLSCREEN); |
+ window_state->OnWMEvent(&fullscreen_event); |
+ } |
+ EXPECT_TRUE(window_state->IsTrustedPinned()); |
+ |
+ // Update display triggers workspace event. |
+ UpdateDisplay("300x200"); |
+ EXPECT_EQ("0,0 300x200", window->GetBoundsInScreen().ToString()); |
+ |
+ // Unpin should work. |
+ window_state->Restore(); |
+ EXPECT_FALSE(window_state->IsTrustedPinned()); |
+} |
+ |
TEST_P(WindowStateTest, AllowSetBoundsInMaximized) { |
std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0)); |
WindowState* window_state = GetWindowState(window.get()); |