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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 model->Add(item_count, item); | 91 model->Add(item_count, item); |
92 ASSERT_EQ(++button_count, test.GetButtonCount()); | 92 ASSERT_EQ(++button_count, test.GetButtonCount()); |
93 LauncherButton* button = test.GetButton(button_count - 1); | 93 LauncherButton* button = test.GetButton(button_count - 1); |
94 EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state()); | 94 EXPECT_EQ(LauncherButton::STATE_RUNNING, button->state()); |
95 | 95 |
96 // Remove it. | 96 // Remove it. |
97 model->RemoveItemAt(item_count); | 97 model->RemoveItemAt(item_count); |
98 ASSERT_EQ(--button_count, test.GetButtonCount()); | 98 ASSERT_EQ(--button_count, test.GetButtonCount()); |
99 } | 99 } |
100 | 100 |
101 TEST_F(LauncherTest, OpenTwoBrowsers) { | |
sky
2012/03/13 17:14:42
Add a description of what this is intended to test
DaveMoore
2012/03/13 23:33:56
Done.
| |
102 Launcher* launcher = Shell::GetInstance()->launcher(); | |
103 ASSERT_TRUE(launcher); | |
104 views::View* contents_view = launcher->widget()->GetContentsView(); | |
105 ASSERT_EQ(1, contents_view->child_count()); | |
106 LauncherView* launcher_view = | |
107 static_cast<LauncherView*>(contents_view->child_at(0)); | |
sky
2012/03/13 17:14:42
This is fragile, I would rather see Launcher get a
DaveMoore
2012/03/13 23:33:56
Done.
| |
108 LauncherView::TestAPI test(launcher_view); | |
109 LauncherModel* model = launcher->model(); | |
110 | |
111 // Initially we have the app list and chrome icon. | |
112 int button_count = test.GetButtonCount(); | |
113 int item_count = model->item_count(); | |
114 int button1 = button_count, button2 = button_count + 1; | |
115 int item1 = item_count; | |
116 | |
117 // Add active tab. | |
118 { | |
119 LauncherItem item(TYPE_TABBED); | |
120 item.status = STATUS_ACTIVE; | |
121 model->Add(item_count, item); | |
122 } | |
123 ASSERT_EQ(++button_count, test.GetButtonCount()); | |
124 EXPECT_EQ(LauncherButton::STATE_ACTIVE, test.GetButton(button1)->state()); | |
125 | |
126 // Add new active tab and deactivate other. | |
127 { | |
128 LauncherItem item(TYPE_TABBED); | |
129 item.status = STATUS_ACTIVE; | |
130 model->Add(item_count, item); | |
131 LauncherItem last_item = model->items()[item1]; | |
132 last_item.status = STATUS_RUNNING; | |
133 model->Set(item1, last_item); | |
134 } | |
135 | |
136 ASSERT_EQ(++button_count, test.GetButtonCount()); | |
137 EXPECT_EQ(LauncherButton::STATE_RUNNING, test.GetButton(button1)->state()); | |
138 EXPECT_EQ(LauncherButton::STATE_ACTIVE, test.GetButton(button2)->state()); | |
139 } | |
140 | |
101 } // namespace ash | 141 } // namespace ash |
OLD | NEW |