OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/shelf_layout_manager.h" | 5 #include "ash/wm/shelf_layout_manager.h" |
6 | 6 |
7 #include "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_window_ids.h" | 9 #include "ash/shell_window_ids.h" |
10 #include "ash/test/aura_shell_test_base.h" | 10 #include "ash/test/aura_shell_test_base.h" |
11 #include "ui/aura/root_window.h" | 11 #include "ui/aura/root_window.h" |
12 #include "ui/aura/screen_aura.h" | 12 #include "ui/aura/screen_aura.h" |
13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
14 #include "ui/base/animation/animation_container_element.h" | 14 #include "ui/base/animation/animation_container_element.h" |
15 #include "ui/gfx/compositor/layer_animator.h" | 15 #include "ui/gfx/compositor/layer_animator.h" |
16 #include "ui/gfx/compositor/layer.h" | 16 #include "ui/gfx/compositor/layer.h" |
17 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
18 | 18 |
19 namespace aura_shell { | 19 namespace ash { |
20 namespace internal { | 20 namespace internal { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 void StepWidgetLayerAnimatorToEnd(views::Widget* widget) { | 24 void StepWidgetLayerAnimatorToEnd(views::Widget* widget) { |
25 ui::AnimationContainerElement* element = | 25 ui::AnimationContainerElement* element = |
26 static_cast<ui::AnimationContainerElement*>( | 26 static_cast<ui::AnimationContainerElement*>( |
27 widget->GetNativeView()->layer()->GetAnimator()); | 27 widget->GetNativeView()->layer()->GetAnimator()); |
28 element->Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); | 28 element->Step(base::TimeTicks::Now() + base::TimeDelta::FromSeconds(1)); |
29 } | 29 } |
30 | 30 |
31 ShelfLayoutManager* GetShelfLayoutManager() { | 31 ShelfLayoutManager* GetShelfLayoutManager() { |
32 aura::Window* window = aura_shell::Shell::GetInstance()->GetContainer( | 32 aura::Window* window = ash::Shell::GetInstance()->GetContainer( |
33 aura_shell::internal::kShellWindowId_LauncherContainer); | 33 ash::internal::kShellWindowId_LauncherContainer); |
34 return static_cast<ShelfLayoutManager*>(window->layout_manager()); | 34 return static_cast<ShelfLayoutManager*>(window->layout_manager()); |
35 } | 35 } |
36 | 36 |
37 } // namespace | 37 } // namespace |
38 | 38 |
39 typedef aura_shell::test::AuraShellTestBase ShelfLayoutManagerTest; | 39 typedef ash::test::AuraShellTestBase ShelfLayoutManagerTest; |
40 | 40 |
41 // Makes sure SetVisible updates work area and widget appropriately. | 41 // Makes sure SetVisible updates work area and widget appropriately. |
42 TEST_F(ShelfLayoutManagerTest, SetVisible) { | 42 TEST_F(ShelfLayoutManagerTest, SetVisible) { |
43 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 43 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
44 // Force an initial layout. | 44 // Force an initial layout. |
45 shelf->LayoutShelf(); | 45 shelf->LayoutShelf(); |
46 ASSERT_TRUE(shelf->visible()); | 46 ASSERT_TRUE(shelf->visible()); |
47 | 47 |
48 aura::ScreenAura* screen = aura::RootWindow::GetInstance()->screen(); | 48 aura::ScreenAura* screen = aura::RootWindow::GetInstance()->screen(); |
49 ASSERT_TRUE(screen); | 49 ASSERT_TRUE(screen); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 Launcher* launcher = Shell::GetInstance()->launcher(); | 124 Launcher* launcher = Shell::GetInstance()->launcher(); |
125 ASSERT_TRUE(launcher); | 125 ASSERT_TRUE(launcher); |
126 ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); | 126 ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); |
127 ASSERT_TRUE(shelf_layout_manager); | 127 ASSERT_TRUE(shelf_layout_manager); |
128 ASSERT_TRUE(shelf_layout_manager->status()); | 128 ASSERT_TRUE(shelf_layout_manager->status()); |
129 shelf_layout_manager->status()->SetBounds(gfx::Rect(0, 0, 200, 200)); | 129 shelf_layout_manager->status()->SetBounds(gfx::Rect(0, 0, 200, 200)); |
130 EXPECT_EQ(200, launcher->GetStatusWidth()); | 130 EXPECT_EQ(200, launcher->GetStatusWidth()); |
131 } | 131 } |
132 | 132 |
133 } // namespace internal | 133 } // namespace internal |
134 } // namespace aura_shell | 134 } // namespace ash |
OLD | NEW |