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

Side by Side Diff: ash/launcher/launcher_unittest.cc

Issue 10388036: Adds the option of aligning the launcher to the left or right. There (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile Created 8 years, 7 months 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 | « ash/launcher/launcher_types.cc ('k') | ash/launcher/launcher_view.h » ('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/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 SetStatusWidth 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, SetStatusWidth) { 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 int total_width = launcher->widget()->GetWindowScreenBounds().width(); 28 gfx::Size launcher_size = launcher->widget()->GetWindowScreenBounds().size();
29 int total_width = launcher_size.width();
29 ASSERT_GT(total_width, 0); 30 ASSERT_GT(total_width, 0);
30 launcher->SetStatusWidth(total_width / 2); 31 launcher->SetStatusSize(gfx::Size(total_width / 2, launcher_size.height()));
31 EXPECT_EQ(total_width - total_width / 2, launcher_view->width()); 32 EXPECT_EQ(total_width - total_width / 2, launcher_view->width());
32 } 33 }
33 34
34 // Confirm that launching a browser gets the appropriate state reflected in 35 // Confirm that launching a browser gets the appropriate state reflected in
35 // its button. 36 // its button.
36 TEST_F(LauncherTest, OpenBrowser) { 37 TEST_F(LauncherTest, OpenBrowser) {
37 Launcher* launcher = Shell::GetInstance()->launcher(); 38 Launcher* launcher = Shell::GetInstance()->launcher();
38 ASSERT_TRUE(launcher); 39 ASSERT_TRUE(launcher);
39 LauncherView* launcher_view = launcher->GetLauncherViewForTest(); 40 LauncherView* launcher_view = launcher->GetLauncherViewForTest();
40 test::LauncherViewTestAPI test(launcher_view); 41 test::LauncherViewTestAPI test(launcher_view);
(...skipping 10 matching lines...) Expand all
51 ASSERT_EQ(++button_count, test.GetButtonCount()); 52 ASSERT_EQ(++button_count, test.GetButtonCount());
52 LauncherButton* button = test.GetButton(index); 53 LauncherButton* button = test.GetButton(index);
53 EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state()); 54 EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state());
54 55
55 // Remove it. 56 // Remove it.
56 model->RemoveItemAt(index); 57 model->RemoveItemAt(index);
57 ASSERT_EQ(--button_count, test.GetButtonCount()); 58 ASSERT_EQ(--button_count, test.GetButtonCount());
58 } 59 }
59 60
60 } // namespace ash 61 } // namespace ash
OLDNEW
« no previous file with comments | « ash/launcher/launcher_types.cc ('k') | ash/launcher/launcher_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698