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

Unified Diff: components/exo/shell_surface_unittest.cc

Issue 2778733004: Add WindowPinType property on arua::Window (Closed)
Patch Set: Address review issues. Created 3 years, 8 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
« no previous file with comments | « components/exo/shell_surface.cc ('k') | components/exo/wayland/server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/shell_surface_unittest.cc
diff --git a/components/exo/shell_surface_unittest.cc b/components/exo/shell_surface_unittest.cc
index 8d2543fb7e3075490c223bec090590c27a332890..8b9d742fb5502720e09c4224f5f698432af1a4e4 100644
--- a/components/exo/shell_surface_unittest.cc
+++ b/components/exo/shell_surface_unittest.cc
@@ -9,6 +9,8 @@
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window.h"
#include "ash/public/cpp/shell_window_ids.h"
+#include "ash/public/cpp/window_properties.h"
+#include "ash/public/interfaces/window_pin_type.mojom.h"
#include "ash/shell.h"
#include "ash/wm/window_state_aura.h"
#include "base/message_loop/message_loop.h"
@@ -52,6 +54,13 @@ wm::ShadowElevation GetShadowElevation(aura::Window* window) {
return window->GetProperty(wm::kShadowElevationKey);
}
+bool IsWidgetPinned(views::Widget* widget) {
+ ash::mojom::WindowPinType type =
+ widget->GetNativeWindow()->GetProperty(ash::kWindowPinTypeKey);
+ return type == ash::mojom::WindowPinType::PINNED ||
+ type == ash::mojom::WindowPinType::TRUSTED_PINNED;
+}
+
TEST_F(ShellSurfaceTest, AcknowledgeConfigure) {
gfx::Size buffer_size(32, 32);
std::unique_ptr<Buffer> buffer(
@@ -186,25 +195,17 @@ TEST_F(ShellSurfaceTest, SetPinned) {
std::unique_ptr<Surface> surface(new Surface);
std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
- shell_surface->SetPinned(true, /* trusted */ true);
- EXPECT_TRUE(
- ash::wm::GetWindowState(shell_surface->GetWidget()->GetNativeWindow())
- ->IsPinned());
+ shell_surface->SetPinned(ash::mojom::WindowPinType::TRUSTED_PINNED);
+ EXPECT_TRUE(IsWidgetPinned(shell_surface->GetWidget()));
- shell_surface->SetPinned(false, /* trusted */ true);
- EXPECT_FALSE(
- ash::wm::GetWindowState(shell_surface->GetWidget()->GetNativeWindow())
- ->IsPinned());
+ shell_surface->SetPinned(ash::mojom::WindowPinType::NONE);
+ EXPECT_FALSE(IsWidgetPinned(shell_surface->GetWidget()));
- shell_surface->SetPinned(true, /* trusted */ false);
- EXPECT_TRUE(
- ash::wm::GetWindowState(shell_surface->GetWidget()->GetNativeWindow())
- ->IsPinned());
+ shell_surface->SetPinned(ash::mojom::WindowPinType::PINNED);
+ EXPECT_TRUE(IsWidgetPinned(shell_surface->GetWidget()));
- shell_surface->SetPinned(false, /* trusted */ false);
- EXPECT_FALSE(
- ash::wm::GetWindowState(shell_surface->GetWidget()->GetNativeWindow())
- ->IsPinned());
+ shell_surface->SetPinned(ash::mojom::WindowPinType::NONE);
+ EXPECT_FALSE(IsWidgetPinned(shell_surface->GetWidget()));
}
TEST_F(ShellSurfaceTest, SetSystemUiVisibility) {
« no previous file with comments | « components/exo/shell_surface.cc ('k') | components/exo/wayland/server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698