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 "ui/aura_shell/shelf_layout_manager.h" | 5 #include "ui/aura_shell/shelf_layout_manager.h" |
6 | 6 |
7 #include "ui/aura/root_window.h" | 7 #include "ui/aura/root_window.h" |
8 #include "ui/aura/screen_aura.h" | 8 #include "ui/aura/screen_aura.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/aura_shell/launcher/launcher.h" |
10 #include "ui/aura_shell/shell.h" | 11 #include "ui/aura_shell/shell.h" |
11 #include "ui/aura_shell/shell_window_ids.h" | 12 #include "ui/aura_shell/shell_window_ids.h" |
12 #include "ui/aura_shell/test/aura_shell_test_base.h" | 13 #include "ui/aura_shell/test/aura_shell_test_base.h" |
13 #include "ui/base/animation/animation_container_element.h" | 14 #include "ui/base/animation/animation_container_element.h" |
14 #include "ui/gfx/compositor/layer_animator.h" | 15 #include "ui/gfx/compositor/layer_animator.h" |
15 #include "ui/gfx/compositor/layer.h" | 16 #include "ui/gfx/compositor/layer.h" |
16 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
17 | 18 |
18 namespace aura_shell { | 19 namespace aura_shell { |
19 namespace internal { | 20 namespace internal { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 EXPECT_FALSE(shelf->visible()); | 98 EXPECT_FALSE(shelf->visible()); |
98 EXPECT_FALSE(shelf->visible()); | 99 EXPECT_FALSE(shelf->visible()); |
99 EXPECT_EQ(0, screen->work_area_insets().bottom()); | 100 EXPECT_EQ(0, screen->work_area_insets().bottom()); |
100 // Make sure the bounds of the two widgets changed. | 101 // Make sure the bounds of the two widgets changed. |
101 EXPECT_GE(shelf->launcher()->GetNativeView()->bounds().y(), | 102 EXPECT_GE(shelf->launcher()->GetNativeView()->bounds().y(), |
102 gfx::Screen::GetPrimaryMonitorBounds().bottom()); | 103 gfx::Screen::GetPrimaryMonitorBounds().bottom()); |
103 EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(), | 104 EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(), |
104 gfx::Screen::GetPrimaryMonitorBounds().bottom()); | 105 gfx::Screen::GetPrimaryMonitorBounds().bottom()); |
105 } | 106 } |
106 | 107 |
| 108 // Makes sure the launcher is initially sized correctly. |
| 109 TEST_F(ShelfLayoutManagerTest, LauncherInitiallySized) { |
| 110 Launcher* launcher = Shell::GetInstance()->launcher(); |
| 111 ASSERT_TRUE(launcher); |
| 112 ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); |
| 113 ASSERT_TRUE(shelf_layout_manager); |
| 114 ASSERT_TRUE(shelf_layout_manager->status()); |
| 115 int status_width = |
| 116 shelf_layout_manager->status()->GetWindowScreenBounds().width(); |
| 117 // Test only makes sense if the status is > 0, which is better be. |
| 118 EXPECT_GT(status_width, 0); |
| 119 EXPECT_EQ(status_width, launcher->GetStatusWidth()); |
| 120 } |
| 121 |
| 122 // Makes sure the launcher is sized when the status area changes size. |
| 123 TEST_F(ShelfLayoutManagerTest, LauncherUpdatedWhenStatusAreaChangesSize) { |
| 124 Launcher* launcher = Shell::GetInstance()->launcher(); |
| 125 ASSERT_TRUE(launcher); |
| 126 ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); |
| 127 ASSERT_TRUE(shelf_layout_manager); |
| 128 ASSERT_TRUE(shelf_layout_manager->status()); |
| 129 shelf_layout_manager->status()->SetBounds(gfx::Rect(0, 0, 200, 200)); |
| 130 EXPECT_EQ(200, launcher->GetStatusWidth()); |
| 131 } |
| 132 |
107 } // namespace internal | 133 } // namespace internal |
108 } // namespace aura_shell | 134 } // namespace aura_shell |
OLD | NEW |