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

Unified Diff: ash/launcher/launcher_view_unittest.cc

Issue 10169038: ash: Fix missing launcher icon regression. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/launcher/launcher_view_unittest.cc
diff --git a/ash/launcher/launcher_view_unittest.cc b/ash/launcher/launcher_view_unittest.cc
index 14727dcd69f88fcd64ccbd362680f0650735da20..38162c5ec5e0b4440696c376c93ca5dfd2ef0cb4 100644
--- a/ash/launcher/launcher_view_unittest.cc
+++ b/ash/launcher/launcher_view_unittest.cc
@@ -132,19 +132,24 @@ class LauncherViewTest : public aura::test::AuraTestBase {
item.type = TYPE_APP_SHORTCUT;
item.status = STATUS_CLOSED;
- int id = model_->next_id();
+ LauncherID id = model_->next_id();
model_->Add(item);
test_api_->RunMessageLoopUntilAnimationsDone();
return id;
}
- LauncherID AddTabbedBrowser() {
+ LauncherID AddTabbedBrowserNoWait() {
LauncherItem item;
item.type = TYPE_TABBED;
item.status = STATUS_RUNNING;
- int id = model_->next_id();
+ LauncherID id = model_->next_id();
model_->Add(item);
+ return id;
+ }
+
+ LauncherID AddTabbedBrowser() {
+ LauncherID id = AddTabbedBrowserNoWait();
test_api_->RunMessageLoopUntilAnimationsDone();
return id;
}
@@ -255,5 +260,33 @@ TEST_F(LauncherViewTest, RemoveLastOverflowed) {
EXPECT_FALSE(test_api_->IsOverflowButtonVisible());
}
+// Adds browser button without waiting for animation to finish and verifies
+// that all added buttons are visible.
+TEST_F(LauncherViewTest, AddButtonQuickly) {
+ // All buttons should be visible.
+ ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1,
+ test_api_->GetButtonCount());
+
+ // Add a few tabbed browser quickly without wait for animation.
+ int added_count = 0;
+ while (!test_api_->IsOverflowButtonVisible()) {
+ AddTabbedBrowserNoWait();
+ ++added_count;
+ }
+
+ // LauncherView should be big enough to hold at least 3 new buttons.
+ ASSERT_GE(added_count, 3);
+
+ // Wait for the last animation to finish.
+ test_api_->RunMessageLoopUntilAnimationsDone();
+
+ // Verifies non-overflow buttons are visible.
+ for (int i = 0; i <= test_api_->GetLastVisibleIndex(); ++i) {
+ internal::LauncherButton* button = test_api_->GetButton(i);
+ EXPECT_TRUE(button->visible()) << "button index=" << i;
+ EXPECT_EQ(1.0f, button->layer()->opacity()) << "button index=" << i;
+ }
+}
+
} // namespace test
} // namespace ash
« no previous file with comments | « ash/launcher/launcher_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698