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" |
(...skipping 30 matching lines...) Expand all Loading... |
41 LauncherView* launcher_view = | 41 LauncherView* launcher_view = |
42 static_cast<LauncherView*>(contents_view->child_at(0)); | 42 static_cast<LauncherView*>(contents_view->child_at(0)); |
43 LauncherView::TestAPI test(launcher_view); | 43 LauncherView::TestAPI test(launcher_view); |
44 LauncherModel* model = launcher->model(); | 44 LauncherModel* model = launcher->model(); |
45 | 45 |
46 // Initially we have the app list and chrome icon. | 46 // Initially we have the app list and chrome icon. |
47 int button_count = test.GetButtonCount(); | 47 int button_count = test.GetButtonCount(); |
48 int item_count = model->item_count(); | 48 int item_count = model->item_count(); |
49 | 49 |
50 // Add closed app. | 50 // Add closed app. |
51 LauncherItem item; | 51 LauncherItem item(TYPE_APP); |
52 item.type = TYPE_APP; | |
53 model->Add(item_count, item); | 52 model->Add(item_count, item); |
54 ASSERT_EQ(++button_count, test.GetButtonCount()); | 53 ASSERT_EQ(++button_count, test.GetButtonCount()); |
55 LauncherButton* button = test.GetButton(button_count - 1); | 54 LauncherButton* button = test.GetButton(button_count - 1); |
56 EXPECT_EQ(LauncherButton::STATE_NORMAL, button->state()); | 55 EXPECT_EQ(LauncherButton::STATE_NORMAL, button->state()); |
57 | 56 |
58 // Open it. | 57 // Open it. |
59 item = model->items()[item_count]; | 58 item = model->items()[item_count]; |
60 item.status = STATUS_RUNNING; | 59 item.status = STATUS_RUNNING; |
61 model->Set(item_count, item); | 60 model->Set(item_count, item); |
62 EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state()); | 61 EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state()); |
(...skipping 17 matching lines...) Expand all Loading... |
80 LauncherView* launcher_view = | 79 LauncherView* launcher_view = |
81 static_cast<LauncherView*>(contents_view->child_at(0)); | 80 static_cast<LauncherView*>(contents_view->child_at(0)); |
82 LauncherView::TestAPI test(launcher_view); | 81 LauncherView::TestAPI test(launcher_view); |
83 LauncherModel* model = launcher->model(); | 82 LauncherModel* model = launcher->model(); |
84 | 83 |
85 // Initially we have the app list and chrome icon. | 84 // Initially we have the app list and chrome icon. |
86 int button_count = test.GetButtonCount(); | 85 int button_count = test.GetButtonCount(); |
87 int item_count = model->item_count(); | 86 int item_count = model->item_count(); |
88 | 87 |
89 // Add running tab. | 88 // Add running tab. |
90 LauncherItem item; | 89 LauncherItem item(TYPE_TABBED); |
91 item.type = TYPE_TABBED; | |
92 item.status = STATUS_RUNNING; | 90 item.status = STATUS_RUNNING; |
93 model->Add(item_count, item); | 91 model->Add(item_count, item); |
94 ASSERT_EQ(++button_count, test.GetButtonCount()); | 92 ASSERT_EQ(++button_count, test.GetButtonCount()); |
95 LauncherButton* button = test.GetButton(button_count - 1); | 93 LauncherButton* button = test.GetButton(button_count - 1); |
96 EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state()); | 94 EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state()); |
97 | 95 |
98 // Remove it. | 96 // Remove it. |
99 model->RemoveItemAt(item_count); | 97 model->RemoveItemAt(item_count); |
100 ASSERT_EQ(--button_count, test.GetButtonCount()); | 98 ASSERT_EQ(--button_count, test.GetButtonCount()); |
101 } | 99 } |
102 | 100 |
103 } // namespace ash | 101 } // namespace ash |
OLD | NEW |