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