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

Unified Diff: ash/launcher/launcher_unittest.cc

Issue 9702054: Revert 126764 - Added notion of currently active app / browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 | « ash/launcher/launcher.cc ('k') | ash/wm/activation_controller_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/launcher/launcher_unittest.cc
===================================================================
--- ash/launcher/launcher_unittest.cc (revision 126791)
+++ ash/launcher/launcher_unittest.cc (working copy)
@@ -22,7 +22,10 @@
// LauncherView.
TEST_F(LauncherTest, SetStatusWidth) {
Launcher* launcher = Shell::GetInstance()->launcher();
- LauncherView* launcher_view = launcher->GetLauncherViewForTest();
+ ASSERT_TRUE(launcher);
+ views::View* launcher_view = launcher->widget()->GetContentsView();
+ ASSERT_EQ(1, launcher_view->child_count());
+ launcher_view = launcher_view->child_at(0);
int total_width = launcher->widget()->GetWindowScreenBounds().width();
ASSERT_GT(total_width, 0);
@@ -30,12 +33,13 @@
EXPECT_EQ(total_width - total_width / 2, launcher_view->width());
}
-// Confirm that launching an app gets the appropriate state reflected in
-// its button.
TEST_F(LauncherTest, LaunchApp) {
Launcher* launcher = Shell::GetInstance()->launcher();
ASSERT_TRUE(launcher);
- LauncherView* launcher_view = launcher->GetLauncherViewForTest();
+ 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));
LauncherView::TestAPI test(launcher_view);
LauncherModel* model = launcher->model();
@@ -68,12 +72,13 @@
ASSERT_EQ(--button_count, test.GetButtonCount());
}
-// Confirm that launching a browser gets the appropriate state reflected in
-// its button.
TEST_F(LauncherTest, OpenBrowser) {
Launcher* launcher = Shell::GetInstance()->launcher();
ASSERT_TRUE(launcher);
- LauncherView* launcher_view = launcher->GetLauncherViewForTest();
+ 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));
LauncherView::TestAPI test(launcher_view);
LauncherModel* model = launcher->model();
@@ -95,44 +100,4 @@
ASSERT_EQ(--button_count, test.GetButtonCount());
}
-// Confirm that opening two different browsers and changing their activation
-// causes the appropriate state changes in the launcher buttons.
-TEST_F(LauncherTest, OpenTwoBrowsers) {
- Launcher* launcher = Shell::GetInstance()->launcher();
- ASSERT_TRUE(launcher);
- LauncherView* launcher_view = launcher->GetLauncherViewForTest();
- 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;
- item.type = 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;
- item.type = TYPE_TABBED;
- 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 | « ash/launcher/launcher.cc ('k') | ash/wm/activation_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698