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

Unified Diff: ash/launcher/launcher_unittest.cc

Issue 9689047: Added notion of currently active app / browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove default args from State Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/wm/window_util.cc » ('j') | ash/wm/window_util.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/launcher/launcher_unittest.cc
diff --git a/ash/launcher/launcher_unittest.cc b/ash/launcher/launcher_unittest.cc
index b0b1be6960db73f430e321ba053271c88d16f35e..f5969d94b2fe69e4dbe0638a68d4b93ccb063aa0 100644
--- a/ash/launcher/launcher_unittest.cc
+++ b/ash/launcher/launcher_unittest.cc
@@ -98,4 +98,44 @@ TEST_F(LauncherTest, OpenBrowser) {
ASSERT_EQ(--button_count, test.GetButtonCount());
}
+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.
+ Launcher* launcher = Shell::GetInstance()->launcher();
+ ASSERT_TRUE(launcher);
+ views::View* contents_view = launcher->widget()->GetContentsView();
+ ASSERT_EQ(1, contents_view->child_count());
+ LauncherView* launcher_view =
+ 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.
+ LauncherView::TestAPI test(launcher_view);
+ LauncherModel* model = launcher->model();
+
+ // Initially we have the app list and chrome icon.
+ int button_count = test.GetButtonCount();
+ int item_count = model->item_count();
+ int button1 = button_count, button2 = button_count + 1;
+ int item1 = item_count;
+
+ // Add active tab.
+ {
+ LauncherItem item(TYPE_TABBED);
+ item.status = STATUS_ACTIVE;
+ model->Add(item_count, item);
+ }
+ ASSERT_EQ(++button_count, test.GetButtonCount());
+ EXPECT_EQ(LauncherButton::STATE_ACTIVE, test.GetButton(button1)->state());
+
+ // Add new active tab and deactivate other.
+ {
+ LauncherItem item(TYPE_TABBED);
+ item.status = STATUS_ACTIVE;
+ model->Add(item_count, item);
+ LauncherItem last_item = model->items()[item1];
+ last_item.status = STATUS_RUNNING;
+ model->Set(item1, last_item);
+ }
+
+ ASSERT_EQ(++button_count, test.GetButtonCount());
+ EXPECT_EQ(LauncherButton::STATE_RUNNING, test.GetButton(button1)->state());
+ EXPECT_EQ(LauncherButton::STATE_ACTIVE, test.GetButton(button2)->state());
+}
+
} // namespace ash
« no previous file with comments | « no previous file | ash/wm/window_util.cc » ('j') | ash/wm/window_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698