OLD | NEW |
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/launcher/launcher.h" | 5 #include "ash/launcher/launcher.h" |
6 #include "ash/launcher/launcher_button.h" | 6 #include "ash/launcher/launcher_button.h" |
7 #include "ash/launcher/launcher_model.h" | 7 #include "ash/launcher/launcher_model.h" |
8 #include "ash/launcher/launcher_view.h" | 8 #include "ash/launcher/launcher_view.h" |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
12 #include "ash/test/launcher_view_test_api.h" | 12 #include "ash/test/launcher_view_test_api.h" |
13 #include "ui/views/view.h" | 13 #include "ui/views/view.h" |
14 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
15 | 15 |
16 typedef ash::test::AshTestBase LauncherTest; | 16 typedef ash::test::AshTestBase LauncherTest; |
17 using ash::internal::LauncherView; | 17 using ash::internal::LauncherView; |
18 using ash::internal::LauncherButton; | 18 using ash::internal::LauncherButton; |
19 | 19 |
20 namespace ash { | 20 namespace ash { |
21 | 21 |
22 // Makes sure invoking SetStatusSize on the launcher changes the size of the | 22 // Makes sure invoking SetStatusSize on the launcher changes the size of the |
23 // LauncherView. | 23 // LauncherView. |
24 TEST_F(LauncherTest, SetStatusSize) { | 24 TEST_F(LauncherTest, SetStatusSize) { |
25 Launcher* launcher = Shell::GetInstance()->launcher(); | 25 Launcher* launcher = Shell::GetInstance()->launcher(); |
26 LauncherView* launcher_view = launcher->GetLauncherViewForTest(); | 26 LauncherView* launcher_view = launcher->GetLauncherViewForTest(); |
27 | 27 |
28 gfx::Size launcher_size = launcher->widget()->GetWindowScreenBounds().size(); | 28 gfx::Size launcher_size = |
| 29 launcher->widget()->GetWindowBoundsInScreen().size(); |
29 int total_width = launcher_size.width(); | 30 int total_width = launcher_size.width(); |
30 ASSERT_GT(total_width, 0); | 31 ASSERT_GT(total_width, 0); |
31 launcher->SetStatusSize(gfx::Size(total_width / 2, launcher_size.height())); | 32 launcher->SetStatusSize(gfx::Size(total_width / 2, launcher_size.height())); |
32 EXPECT_EQ(total_width - total_width / 2, launcher_view->width()); | 33 EXPECT_EQ(total_width - total_width / 2, launcher_view->width()); |
33 } | 34 } |
34 | 35 |
35 // Confirm that launching a browser gets the appropriate state reflected in | 36 // Confirm that launching a browser gets the appropriate state reflected in |
36 // its button. | 37 // its button. |
37 TEST_F(LauncherTest, OpenBrowser) { | 38 TEST_F(LauncherTest, OpenBrowser) { |
38 Launcher* launcher = Shell::GetInstance()->launcher(); | 39 Launcher* launcher = Shell::GetInstance()->launcher(); |
(...skipping 13 matching lines...) Expand all Loading... |
52 ASSERT_EQ(++button_count, test.GetButtonCount()); | 53 ASSERT_EQ(++button_count, test.GetButtonCount()); |
53 LauncherButton* button = test.GetButton(index); | 54 LauncherButton* button = test.GetButton(index); |
54 EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state()); | 55 EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state()); |
55 | 56 |
56 // Remove it. | 57 // Remove it. |
57 model->RemoveItemAt(index); | 58 model->RemoveItemAt(index); |
58 ASSERT_EQ(--button_count, test.GetButtonCount()); | 59 ASSERT_EQ(--button_count, test.GetButtonCount()); |
59 } | 60 } |
60 | 61 |
61 } // namespace ash | 62 } // namespace ash |
OLD | NEW |