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

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

Issue 10068027: ash: Fix launcher icon overlaps with status. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 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/ash.gyp ('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 "ui/views/view.h" 13 #include "ui/views/view.h"
13 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
14 15
15 typedef ash::test::AshTestBase LauncherTest; 16 typedef ash::test::AshTestBase LauncherTest;
16 using ash::internal::LauncherView; 17 using ash::internal::LauncherView;
17 using ash::internal::LauncherButton; 18 using ash::internal::LauncherButton;
18 19
19 namespace ash { 20 namespace ash {
20 21
21 // Makes sure invoking SetStatusWidth on the launcher changes the size of the 22 // Makes sure invoking SetStatusWidth on the launcher changes the size of the
22 // LauncherView. 23 // LauncherView.
23 TEST_F(LauncherTest, SetStatusWidth) { 24 TEST_F(LauncherTest, SetStatusWidth) {
24 Launcher* launcher = Shell::GetInstance()->launcher(); 25 Launcher* launcher = Shell::GetInstance()->launcher();
25 LauncherView* launcher_view = launcher->GetLauncherViewForTest(); 26 LauncherView* launcher_view = launcher->GetLauncherViewForTest();
26 27
27 int total_width = launcher->widget()->GetWindowScreenBounds().width(); 28 int total_width = launcher->widget()->GetWindowScreenBounds().width();
28 ASSERT_GT(total_width, 0); 29 ASSERT_GT(total_width, 0);
29 launcher->SetStatusWidth(total_width / 2); 30 launcher->SetStatusWidth(total_width / 2);
30 EXPECT_EQ(total_width - total_width / 2, launcher_view->width()); 31 EXPECT_EQ(total_width - total_width / 2, launcher_view->width());
31 } 32 }
32 33
33 // Confirm that launching a browser gets the appropriate state reflected in 34 // Confirm that launching a browser gets the appropriate state reflected in
34 // its button. 35 // its button.
35 TEST_F(LauncherTest, OpenBrowser) { 36 TEST_F(LauncherTest, OpenBrowser) {
36 Launcher* launcher = Shell::GetInstance()->launcher(); 37 Launcher* launcher = Shell::GetInstance()->launcher();
37 ASSERT_TRUE(launcher); 38 ASSERT_TRUE(launcher);
38 LauncherView* launcher_view = launcher->GetLauncherViewForTest(); 39 LauncherView* launcher_view = launcher->GetLauncherViewForTest();
39 LauncherView::TestAPI test(launcher_view); 40 test::LauncherViewTestAPI test(launcher_view);
40 LauncherModel* model = launcher->model(); 41 LauncherModel* model = launcher->model();
41 42
42 // Initially we have the app list and chrome icon. 43 // Initially we have the app list and chrome icon.
43 int button_count = test.GetButtonCount(); 44 int button_count = test.GetButtonCount();
44 45
45 // Add running tab. 46 // Add running tab.
46 LauncherItem item; 47 LauncherItem item;
47 item.type = TYPE_TABBED; 48 item.type = TYPE_TABBED;
48 item.status = STATUS_RUNNING; 49 item.status = STATUS_RUNNING;
49 int index = model->Add(item); 50 int index = model->Add(item);
50 ASSERT_EQ(++button_count, test.GetButtonCount()); 51 ASSERT_EQ(++button_count, test.GetButtonCount());
51 LauncherButton* button = test.GetButton(index); 52 LauncherButton* button = test.GetButton(index);
52 EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state()); 53 EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state());
53 54
54 // Remove it. 55 // Remove it.
55 model->RemoveItemAt(index); 56 model->RemoveItemAt(index);
56 ASSERT_EQ(--button_count, test.GetButtonCount()); 57 ASSERT_EQ(--button_count, test.GetButtonCount());
57 } 58 }
58 59
59 } // namespace ash 60 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ash.gyp ('k') | ash/launcher/launcher_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698