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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/exo/shell_surface.h" 5 #include "components/exo/shell_surface.h"
6 #include "ash/common/accessibility_delegate.h" 6 #include "ash/common/accessibility_delegate.h"
7 #include "ash/common/wm/window_state.h" 7 #include "ash/common/wm/window_state.h"
8 #include "ash/common/wm/wm_event.h" 8 #include "ash/common/wm/wm_event.h"
9 #include "ash/common/wm_shell.h" 9 #include "ash/common/wm_shell.h"
10 #include "ash/common/wm_window.h" 10 #include "ash/common/wm_window.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 bool activated, 45 bool activated,
46 const gfx::Vector2d& origin_offset) { 46 const gfx::Vector2d& origin_offset) {
47 EXPECT_EQ(ash::wm::WINDOW_STATE_TYPE_FULLSCREEN, state_type); 47 EXPECT_EQ(ash::wm::WINDOW_STATE_TYPE_FULLSCREEN, state_type);
48 return serial; 48 return serial;
49 } 49 }
50 50
51 wm::ShadowElevation GetShadowElevation(aura::Window* window) { 51 wm::ShadowElevation GetShadowElevation(aura::Window* window) {
52 return window->GetProperty(wm::kShadowElevationKey); 52 return window->GetProperty(wm::kShadowElevationKey);
53 } 53 }
54 54
55 bool WidgetIsPinned(views::Widget* widget) {
56 aura::client::WindowPinType type =
57 widget->GetNativeWindow()->GetProperty(aura::client::kWindowPinTypeKey);
58 return type == aura::client::WindowPinType::PINNED ||
59 type == aura::client::WindowPinType::TRUSTED_PINNED;
60 }
61
55 TEST_F(ShellSurfaceTest, AcknowledgeConfigure) { 62 TEST_F(ShellSurfaceTest, AcknowledgeConfigure) {
56 gfx::Size buffer_size(32, 32); 63 gfx::Size buffer_size(32, 32);
57 std::unique_ptr<Buffer> buffer( 64 std::unique_ptr<Buffer> buffer(
58 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 65 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
59 std::unique_ptr<Surface> surface(new Surface); 66 std::unique_ptr<Surface> surface(new Surface);
60 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 67 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
61 68
62 surface->Attach(buffer.get()); 69 surface->Attach(buffer.get());
63 surface->Commit(); 70 surface->Commit();
64 71
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 187 }
181 188
182 TEST_F(ShellSurfaceTest, SetPinned) { 189 TEST_F(ShellSurfaceTest, SetPinned) {
183 gfx::Size buffer_size(256, 256); 190 gfx::Size buffer_size(256, 256);
184 std::unique_ptr<Buffer> buffer( 191 std::unique_ptr<Buffer> buffer(
185 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 192 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
186 std::unique_ptr<Surface> surface(new Surface); 193 std::unique_ptr<Surface> surface(new Surface);
187 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 194 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
188 195
189 shell_surface->SetPinned(true, /* trusted */ true); 196 shell_surface->SetPinned(true, /* trusted */ true);
190 EXPECT_TRUE( 197 EXPECT_TRUE(WidgetIsPinned(shell_surface->GetWidget()));
191 ash::wm::GetWindowState(shell_surface->GetWidget()->GetNativeWindow())
192 ->IsPinned());
193 198
194 shell_surface->SetPinned(false, /* trusted */ true); 199 shell_surface->SetPinned(false, /* trusted */ true);
195 EXPECT_FALSE( 200 EXPECT_FALSE(WidgetIsPinned(shell_surface->GetWidget()));
196 ash::wm::GetWindowState(shell_surface->GetWidget()->GetNativeWindow())
197 ->IsPinned());
198 201
199 shell_surface->SetPinned(true, /* trusted */ false); 202 shell_surface->SetPinned(true, /* trusted */ false);
200 EXPECT_TRUE( 203 EXPECT_TRUE(WidgetIsPinned(shell_surface->GetWidget()));
201 ash::wm::GetWindowState(shell_surface->GetWidget()->GetNativeWindow())
202 ->IsPinned());
203 204
204 shell_surface->SetPinned(false, /* trusted */ false); 205 shell_surface->SetPinned(false, /* trusted */ false);
205 EXPECT_FALSE( 206 EXPECT_FALSE(WidgetIsPinned(shell_surface->GetWidget()));
206 ash::wm::GetWindowState(shell_surface->GetWidget()->GetNativeWindow())
207 ->IsPinned());
208 } 207 }
209 208
210 TEST_F(ShellSurfaceTest, SetTitle) { 209 TEST_F(ShellSurfaceTest, SetTitle) {
211 std::unique_ptr<Surface> surface(new Surface); 210 std::unique_ptr<Surface> surface(new Surface);
212 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 211 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
213 212
214 shell_surface->SetTitle(base::string16(base::ASCIIToUTF16("test"))); 213 shell_surface->SetTitle(base::string16(base::ASCIIToUTF16("test")));
215 surface->Commit(); 214 surface->Commit();
216 } 215 }
217 216
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 shell_surface.OnAccessibilityModeChanged(); 986 shell_surface.OnAccessibilityModeChanged();
988 shell_surface2.OnAccessibilityModeChanged(); 987 shell_surface2.OnAccessibilityModeChanged();
989 988
990 EXPECT_TRUE(shell_surface.shadow_underlay()->IsVisible()); 989 EXPECT_TRUE(shell_surface.shadow_underlay()->IsVisible());
991 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds()); 990 EXPECT_EQ(shadow_bounds, shell_surface.shadow_underlay()->bounds());
992 EXPECT_EQ(shadow_bounds, shell_surface2.shadow_underlay()->bounds()); 991 EXPECT_EQ(shadow_bounds, shell_surface2.shadow_underlay()->bounds());
993 } 992 }
994 993
995 } // namespace 994 } // namespace
996 } // namespace exo 995 } // namespace exo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698