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

Side by Side Diff: components/exo/shell_surface_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: Rebased. Created 4 years, 3 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
« no previous file with comments | « components/exo/shell_surface.cc ('k') | components/exo/wayland/server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/aura/wm_window_aura.h" 5 #include "ash/aura/wm_window_aura.h"
6 #include "ash/common/shell_window_ids.h" 6 #include "ash/common/shell_window_ids.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/wm/window_state_aura.h" 10 #include "ash/wm/window_state_aura.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 shell_surface->GetWidget()->GetWindowBoundsInScreen().ToString()); 160 shell_surface->GetWidget()->GetWindowBoundsInScreen().ToString());
161 } 161 }
162 162
163 TEST_F(ShellSurfaceTest, SetPinned) { 163 TEST_F(ShellSurfaceTest, SetPinned) {
164 gfx::Size buffer_size(256, 256); 164 gfx::Size buffer_size(256, 256);
165 std::unique_ptr<Buffer> buffer( 165 std::unique_ptr<Buffer> buffer(
166 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); 166 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
167 std::unique_ptr<Surface> surface(new Surface); 167 std::unique_ptr<Surface> surface(new Surface);
168 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 168 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
169 169
170 shell_surface->SetPinned(true); 170 shell_surface->SetPinned(true, /* trusted */ true);
171 EXPECT_TRUE( 171 EXPECT_TRUE(
172 ash::wm::GetWindowState(shell_surface->GetWidget()->GetNativeWindow()) 172 ash::wm::GetWindowState(shell_surface->GetWidget()->GetNativeWindow())
173 ->IsPinned()); 173 ->IsPinned());
174 174
175 shell_surface->SetPinned(false); 175 shell_surface->SetPinned(false, /* trusted */ true);
176 EXPECT_FALSE( 176 EXPECT_FALSE(
177 ash::wm::GetWindowState(shell_surface->GetWidget()->GetNativeWindow()) 177 ash::wm::GetWindowState(shell_surface->GetWidget()->GetNativeWindow())
178 ->IsPinned()); 178 ->IsPinned());
179
180 shell_surface->SetPinned(true, /* trusted */ false);
181 EXPECT_TRUE(
182 ash::wm::GetWindowState(shell_surface->GetWidget()->GetNativeWindow())
183 ->IsPinned());
184
185 shell_surface->SetPinned(false, /* trusted */ false);
186 EXPECT_FALSE(
187 ash::wm::GetWindowState(shell_surface->GetWidget()->GetNativeWindow())
188 ->IsPinned());
179 } 189 }
180 190
181 TEST_F(ShellSurfaceTest, SetTitle) { 191 TEST_F(ShellSurfaceTest, SetTitle) {
182 std::unique_ptr<Surface> surface(new Surface); 192 std::unique_ptr<Surface> surface(new Surface);
183 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); 193 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get()));
184 194
185 shell_surface->SetTitle(base::string16(base::ASCIIToUTF16("test"))); 195 shell_surface->SetTitle(base::string16(base::ASCIIToUTF16("test")));
186 surface->Commit(); 196 surface->Commit();
187 } 197 }
188 198
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 shell_surface->shadow_underlay_for_test()->bounds()); 688 shell_surface->shadow_underlay_for_test()->bounds());
679 689
680 // Leave fullscreen mode. Shadow underlay is restored. 690 // Leave fullscreen mode. Shadow underlay is restored.
681 window->GetWindowState()->OnWMEvent(&event); 691 window->GetWindowState()->OnWMEvent(&event);
682 EXPECT_TRUE(shell_surface->shadow_underlay_for_test()->IsVisible()); 692 EXPECT_TRUE(shell_surface->shadow_underlay_for_test()->IsVisible());
683 EXPECT_EQ(shadow_bounds, shell_surface->shadow_underlay_for_test()->bounds()); 693 EXPECT_EQ(shadow_bounds, shell_surface->shadow_underlay_for_test()->bounds());
684 } 694 }
685 695
686 } // namespace 696 } // namespace
687 } // namespace exo 697 } // namespace exo
OLDNEW
« 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