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

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

Issue 455543004: Use ShadowController instead of creating its own. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 unified diff | Download patch | Annotate | Revision Log
« 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 window2->SetBounds(gfx::Rect(11, 21, 301, 401)); 209 window2->SetBounds(gfx::Rect(11, 21, 301, 401));
210 AddTransientChild(window1.get(), window2.get()); 210 AddTransientChild(window1.get(), window2.get());
211 aura::client::SetHideOnDeactivate(window2.get(), true); 211 aura::client::SetHideOnDeactivate(window2.get(), true);
212 window2->Show(); 212 window2->Show();
213 ActivateWindow(window2.get()); 213 ActivateWindow(window2.get());
214 214
215 // window1 is now inactive, but its shadow should still appear active. 215 // window1 is now inactive, but its shadow should still appear active.
216 EXPECT_EQ(Shadow::STYLE_ACTIVE, shadow1->style()); 216 EXPECT_EQ(Shadow::STYLE_ACTIVE, shadow1->style());
217 } 217 }
218 218
219 TEST_F(ShadowControllerTest, AlwaysActive) {
220 ShadowController::TestApi api(shadow_controller());
221
222 scoped_ptr<aura::Window> window1(new aura::Window(NULL));
223 window1->SetType(ui::wm::WINDOW_TYPE_NORMAL);
224 window1->Init(aura::WINDOW_LAYER_TEXTURED);
225 ParentWindow(window1.get());
226 window1->SetBounds(gfx::Rect(10, 20, 300, 400));
227 SetShadowType(window1.get(), SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE);
228 window1->Show();
229
230 // Showing the window with SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE should
231 // have active shadow.
232 EXPECT_EQ(Shadow::STYLE_ACTIVE,
233 api.GetShadowForWindow(window1.get())->style());
234
235 scoped_ptr<aura::Window> window2(new aura::Window(NULL));
236 window2->SetType(ui::wm::WINDOW_TYPE_NORMAL);
237 window2->Init(aura::WINDOW_LAYER_TEXTURED);
238 ParentWindow(window2.get());
239 window2->SetBounds(gfx::Rect(11, 21, 301, 401));
240 window2->Show();
241
242 // Setting SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE to the visible window
243 // should set the active shadow.
244 EXPECT_EQ(Shadow::STYLE_INACTIVE,
245 api.GetShadowForWindow(window2.get())->style());
246 SetShadowType(window2.get(), SHADOW_TYPE_RECTANGULAR_ALWAYS_ACTIVE);
247 EXPECT_EQ(Shadow::STYLE_ACTIVE,
248 api.GetShadowForWindow(window2.get())->style());
249
250 // Activation should not change the shadow style.
251 ActivateWindow(window2.get());
252 EXPECT_EQ(Shadow::STYLE_ACTIVE,
253 api.GetShadowForWindow(window1.get())->style());
254 EXPECT_EQ(Shadow::STYLE_ACTIVE,
255 api.GetShadowForWindow(window2.get())->style());
256
257 ActivateWindow(window1.get());
258 EXPECT_EQ(Shadow::STYLE_ACTIVE,
259 api.GetShadowForWindow(window1.get())->style());
260 EXPECT_EQ(Shadow::STYLE_ACTIVE,
261 api.GetShadowForWindow(window2.get())->style());
262
263 // Restore the style to plain RECTANGULAR and make sure the inactive window
264 // gets the inactive shadow.
265 SetShadowType(window1.get(), SHADOW_TYPE_RECTANGULAR);
266 SetShadowType(window2.get(), SHADOW_TYPE_RECTANGULAR);
267 EXPECT_EQ(Shadow::STYLE_ACTIVE,
268 api.GetShadowForWindow(window1.get())->style());
269 EXPECT_EQ(Shadow::STYLE_INACTIVE,
270 api.GetShadowForWindow(window2.get())->style());
271 }
272
219 } // namespace wm 273 } // 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