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

Unified Diff: ash/wm/screen_pinning_controller_unittest.cc

Issue 2285633002: Add WM_EVENT_TRUSTED_PIN and WINDOW_STATE_TYPE_TRUSTED_PINNED to Ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added trusted argument. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/screen_pinning_controller_unittest.cc
diff --git a/ash/wm/screen_pinning_controller_unittest.cc b/ash/wm/screen_pinning_controller_unittest.cc
index c5334a67e80a6a9b8859ae967498543f5374a6f8..955c4065089bf031fa2855b2c6f3c538d2e08308 100644
--- a/ash/wm/screen_pinning_controller_unittest.cc
+++ b/ash/wm/screen_pinning_controller_unittest.cc
@@ -7,6 +7,7 @@
#include <vector>
#include "ash/aura/wm_window_aura.h"
+#include "ash/common/accelerators/accelerator_controller.h"
#include "ash/common/wm/window_state.h"
#include "ash/common/wm/wm_event.h"
#include "ash/common/wm_shell.h"
@@ -33,7 +34,7 @@ TEST_F(ScreenPinningControllerTest, IsPinned) {
aura::Window* w1 = CreateTestWindowInShellWithId(0);
wm::ActivateWindow(w1);
- wm::PinWindow(w1);
+ wm::PinWindow(w1, /* trusted */ false);
EXPECT_TRUE(WmShell::Get()->IsPinned());
}
@@ -42,12 +43,12 @@ TEST_F(ScreenPinningControllerTest, OnlyOnePinnedWindow) {
aura::Window* w2 = CreateTestWindowInShellWithId(1);
wm::ActivateWindow(w1);
- wm::PinWindow(w1);
+ wm::PinWindow(w1, /* trusted */ false);
EXPECT_TRUE(WmWindowAura::Get(w1)->GetWindowState()->IsPinned());
EXPECT_FALSE(WmWindowAura::Get(w2)->GetWindowState()->IsPinned());
// Prohibit to pin two (or more) windows.
- wm::PinWindow(w2);
+ wm::PinWindow(w2, /* trusted */ false);
EXPECT_TRUE(WmWindowAura::Get(w1)->GetWindowState()->IsPinned());
EXPECT_FALSE(WmWindowAura::Get(w2)->GetWindowState()->IsPinned());
}
@@ -57,7 +58,7 @@ TEST_F(ScreenPinningControllerTest, FullscreenInPinnedMode) {
aura::Window* w2 = CreateTestWindowInShellWithId(1);
wm::ActivateWindow(w1);
- wm::PinWindow(w1);
+ wm::PinWindow(w1, /* trusted */ false);
{
// Window w1 should be in front of w2.
std::vector<aura::Window*> siblings = w1->parent()->children();
@@ -152,4 +153,15 @@ TEST_F(ScreenPinningControllerTest, FullscreenInPinnedMode) {
}
}
+TEST_F(ScreenPinningControllerTest, TrustedPinnedWithAccelerator) {
+ aura::Window* w1 = CreateTestWindowInShellWithId(0);
+ wm::ActivateWindow(w1);
+
+ wm::PinWindow(w1, /* trusted */ true);
+ EXPECT_TRUE(WmShell::Get()->IsPinned());
+
+ WmShell::Get()->accelerator_controller()->PerformActionIfEnabled(UNPIN);
+ EXPECT_TRUE(WmShell::Get()->IsPinned());
hidehiko 2016/08/29 14:31:39 Could you explicitly comment that the "no-unpin" i
hirono 2016/08/30 07:16:08 Done.
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698