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

Unified Diff: ash/wm/window_state_unittest.cc

Issue 2590123002: Prevent maximize/minimize/fullscreen-ize window in trusted pinned mode. (Closed)
Patch Set: Address comments Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/wm/window_state.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « ash/common/wm/window_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698