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/launcher/launcher.h" | 5 #include "ash/launcher/launcher.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/aura_shell_test_base.h" | 8 #include "ash/test/aura_shell_test_base.h" |
9 #include "ui/views/view.h" | 9 #include "ui/views/view.h" |
10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
11 | 11 |
12 typedef aura_shell::test::AuraShellTestBase LauncherTest; | 12 typedef ash::test::AuraShellTestBase LauncherTest; |
13 | 13 |
14 namespace aura_shell { | 14 namespace ash { |
15 | 15 |
16 // Makes sure invoking SetStatusWidth on the launcher changes the size of the | 16 // Makes sure invoking SetStatusWidth on the launcher changes the size of the |
17 // LauncherView. | 17 // LauncherView. |
18 TEST_F(LauncherTest, SetStatusWidth) { | 18 TEST_F(LauncherTest, SetStatusWidth) { |
19 Launcher* launcher = Shell::GetInstance()->launcher(); | 19 Launcher* launcher = Shell::GetInstance()->launcher(); |
20 ASSERT_TRUE(launcher); | 20 ASSERT_TRUE(launcher); |
21 views::View* launcher_view = launcher->widget()->GetContentsView(); | 21 views::View* launcher_view = launcher->widget()->GetContentsView(); |
22 ASSERT_EQ(1, launcher_view->child_count()); | 22 ASSERT_EQ(1, launcher_view->child_count()); |
23 launcher_view = launcher_view->child_at(0); | 23 launcher_view = launcher_view->child_at(0); |
24 | 24 |
25 int total_width = launcher->widget()->GetWindowScreenBounds().width(); | 25 int total_width = launcher->widget()->GetWindowScreenBounds().width(); |
26 ASSERT_GT(total_width, 0); | 26 ASSERT_GT(total_width, 0); |
27 launcher->SetStatusWidth(total_width / 2); | 27 launcher->SetStatusWidth(total_width / 2); |
28 EXPECT_EQ(total_width - total_width / 2, launcher_view->width()); | 28 EXPECT_EQ(total_width - total_width / 2, launcher_view->width()); |
29 } | 29 } |
30 | 30 |
31 } // namespace aura_shell | 31 } // namespace ash |
OLD | NEW |