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

Side by Side Diff: ui/views/corewm/visibility_controller_unittest.cc

Issue 11316245: Move VisibilityController to corewm. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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/views/corewm/visibility_controller.cc ('k') | ui/views/views.gyp » ('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 "ash/wm/visibility_controller.h" 5 #include "ui/views/corewm/visibility_controller.h"
6 6
7 #include "ash/test/ash_test_base.h" 7 #include "ui/aura/root_window.h"
8 #include "ui/aura/test/aura_test_base.h"
8 #include "ui/aura/test/test_window_delegate.h" 9 #include "ui/aura/test/test_window_delegate.h"
9 #include "ui/aura/test/test_windows.h" 10 #include "ui/aura/test/test_windows.h"
10 #include "ui/aura/window.h" 11 #include "ui/aura/window.h"
11 #include "ui/compositor/layer.h" 12 #include "ui/compositor/layer.h"
12 #include "ui/compositor/layer_animator.h" 13 #include "ui/compositor/layer_animator.h"
13 14
14 namespace ash { 15 namespace views {
15 namespace internal { 16 namespace corewm {
16 17
17 typedef test::AshTestBase VisibilityControllerTest; 18 typedef aura::test::AuraTestBase VisibilityControllerTest;
18 19
19 // Hiding a window in an animatable container should not hide the window's layer 20 // Hiding a window in an animatable container should not hide the window's layer
20 // immediately. 21 // immediately.
21 TEST_F(VisibilityControllerTest, AnimateHideDoesntHideWindowLayer) { 22 TEST_F(VisibilityControllerTest, AnimateHideDoesntHideWindowLayer) {
22 // We cannot disable animations for this test. 23 // We cannot disable animations for this test.
23 ui::LayerAnimator::set_disable_animations_for_test(false); 24 ui::LayerAnimator::set_disable_animations_for_test(false);
24 25
25 scoped_ptr<aura::Window> container(CreateTestWindowInShellWithId(-1)); 26 VisibilityController controller;
26 SetChildWindowVisibilityChangesAnimated(container.get()); 27 aura::client::SetVisibilityClient(root_window(), &controller);
28
29 SetChildWindowVisibilityChangesAnimated(root_window());
27 30
28 aura::test::TestWindowDelegate d; 31 aura::test::TestWindowDelegate d;
29 scoped_ptr<aura::Window> animatable( 32 scoped_ptr<aura::Window> animatable(
30 aura::test::CreateTestWindowWithDelegate( 33 aura::test::CreateTestWindowWithDelegate(
31 &d, -2, gfx::Rect(0, 0, 50, 50), container.get())); 34 &d, -2, gfx::Rect(0, 0, 50, 50), root_window()));
32 scoped_ptr<aura::Window> non_animatable( 35 scoped_ptr<aura::Window> non_animatable(
33 aura::test::CreateTestWindowWithDelegateAndType( 36 aura::test::CreateTestWindowWithDelegateAndType(
34 &d, aura::client::WINDOW_TYPE_CONTROL, -3, gfx::Rect(51, 51, 50, 50), 37 &d, aura::client::WINDOW_TYPE_CONTROL, -3, gfx::Rect(51, 51, 50, 50),
35 container.get())); 38 root_window()));
36 EXPECT_TRUE(animatable->IsVisible()); 39 EXPECT_TRUE(animatable->IsVisible());
37 EXPECT_TRUE(animatable->layer()->visible()); 40 EXPECT_TRUE(animatable->layer()->visible());
38 animatable->Hide(); 41 animatable->Hide();
39 EXPECT_FALSE(animatable->IsVisible()); 42 EXPECT_FALSE(animatable->IsVisible());
40 EXPECT_TRUE(animatable->layer()->visible()); 43 EXPECT_TRUE(animatable->layer()->visible());
41 44
42 EXPECT_TRUE(non_animatable->IsVisible()); 45 EXPECT_TRUE(non_animatable->IsVisible());
43 EXPECT_TRUE(non_animatable->layer()->visible()); 46 EXPECT_TRUE(non_animatable->layer()->visible());
44 non_animatable->Hide(); 47 non_animatable->Hide();
45 EXPECT_FALSE(non_animatable->IsVisible()); 48 EXPECT_FALSE(non_animatable->IsVisible());
46 EXPECT_FALSE(non_animatable->layer()->visible()); 49 EXPECT_FALSE(non_animatable->layer()->visible());
50
51 aura::client::SetVisibilityClient(root_window(), NULL);
47 } 52 }
48 53
49 } // namespace internal 54 } // namespace corewm
50 } // namespace ash 55 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/corewm/visibility_controller.cc ('k') | ui/views/views.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698