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

Side by Side Diff: ui/wm/core/shadow_controller_unittest.cc

Issue 954123002: Remove wm::SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « ui/wm/core/shadow_controller.cc ('k') | ui/wm/core/shadow_types.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/wm/core/shadow_controller.h" 5 #include "ui/wm/core/shadow_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 window2->SetBounds(gfx::Rect(11, 21, 301, 401)); 234 window2->SetBounds(gfx::Rect(11, 21, 301, 401));
235 AddTransientChild(window1.get(), window2.get()); 235 AddTransientChild(window1.get(), window2.get());
236 aura::client::SetHideOnDeactivate(window2.get(), true); 236 aura::client::SetHideOnDeactivate(window2.get(), true);
237 window2->Show(); 237 window2->Show();
238 ActivateWindow(window2.get()); 238 ActivateWindow(window2.get());
239 239
240 // window1 is now inactive, but its shadow should still appear active. 240 // window1 is now inactive, but its shadow should still appear active.
241 EXPECT_EQ(Shadow::STYLE_ACTIVE, shadow1->style()); 241 EXPECT_EQ(Shadow::STYLE_ACTIVE, shadow1->style());
242 } 242 }
243 243
244 TEST_F(ShadowControllerTest, AlwaysActive) {
245 ShadowController::TestApi api(shadow_controller());
246
247 scoped_ptr<aura::Window> window1(new aura::Window(NULL));
248 window1->SetType(ui::wm::WINDOW_TYPE_NORMAL);
249 window1->Init(aura::WINDOW_LAYER_TEXTURED);
250 ParentWindow(window1.get());
251 window1->SetBounds(gfx::Rect(10, 20, 300, 400));
252 SetShadowType(window1.get(), SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE);
253 window1->Show();
254
255 // Showing the window with SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE should
256 // have active shadow.
257 EXPECT_EQ(Shadow::STYLE_ACTIVE,
258 api.GetShadowForWindow(window1.get())->style());
259
260 scoped_ptr<aura::Window> window2(new aura::Window(NULL));
261 window2->SetType(ui::wm::WINDOW_TYPE_NORMAL);
262 window2->Init(aura::WINDOW_LAYER_TEXTURED);
263 ParentWindow(window2.get());
264 window2->SetBounds(gfx::Rect(11, 21, 301, 401));
265 window2->Show();
266
267 // Setting SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE to the visible window
268 // should set the active shadow.
269 EXPECT_EQ(Shadow::STYLE_INACTIVE,
270 api.GetShadowForWindow(window2.get())->style());
271 SetShadowType(window2.get(), SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE);
272 EXPECT_EQ(Shadow::STYLE_ACTIVE,
273 api.GetShadowForWindow(window2.get())->style());
274
275 // Activation should not change the shadow style.
276 ActivateWindow(window2.get());
277 EXPECT_EQ(Shadow::STYLE_ACTIVE,
278 api.GetShadowForWindow(window1.get())->style());
279 EXPECT_EQ(Shadow::STYLE_ACTIVE,
280 api.GetShadowForWindow(window2.get())->style());
281
282 ActivateWindow(window1.get());
283 EXPECT_EQ(Shadow::STYLE_ACTIVE,
284 api.GetShadowForWindow(window1.get())->style());
285 EXPECT_EQ(Shadow::STYLE_ACTIVE,
286 api.GetShadowForWindow(window2.get())->style());
287
288 // Restore the style to plain RECTANGULAR and make sure the inactive window
289 // gets the inactive shadow.
290 SetShadowType(window1.get(), SHADOW_TYPE_RECTANGULAR);
291 SetShadowType(window2.get(), SHADOW_TYPE_RECTANGULAR);
292 EXPECT_EQ(Shadow::STYLE_ACTIVE,
293 api.GetShadowForWindow(window1.get())->style());
294 EXPECT_EQ(Shadow::STYLE_INACTIVE,
295 api.GetShadowForWindow(window2.get())->style());
296 }
297
298 } // namespace wm 244 } // namespace wm
OLDNEW
« no previous file with comments | « ui/wm/core/shadow_controller.cc ('k') | ui/wm/core/shadow_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698