Commit 1d212cd0 authored by xiyuan@chromium.org's avatar xiyuan@chromium.org

ash: Fix missing launcher icon regression.

The regression is introduced in r133603 where we use opacity to hide
newly added view but did not restore it properly on animation cancellation,
which happens when adding launcher item before animation finishes.

BUG=124855
TEST=Verify fix for issue 124855.


Review URL: http://codereview.chromium.org/10169038

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133853 0039d316-1c4b-4281-b951-d872f2087c98
parent c4340bc0
...@@ -230,7 +230,7 @@ class LauncherView::StartFadeAnimationDelegate : ...@@ -230,7 +230,7 @@ class LauncherView::StartFadeAnimationDelegate :
launcher_view_->FadeIn(view_); launcher_view_->FadeIn(view_);
} }
virtual void AnimationCanceled(const Animation* animation) OVERRIDE { virtual void AnimationCanceled(const Animation* animation) OVERRIDE {
view_->SetVisible(true); view_->layer()->SetOpacity(1.0f);
} }
private: private:
......
...@@ -132,19 +132,24 @@ class LauncherViewTest : public aura::test::AuraTestBase { ...@@ -132,19 +132,24 @@ class LauncherViewTest : public aura::test::AuraTestBase {
item.type = TYPE_APP_SHORTCUT; item.type = TYPE_APP_SHORTCUT;
item.status = STATUS_CLOSED; item.status = STATUS_CLOSED;
int id = model_->next_id(); LauncherID id = model_->next_id();
model_->Add(item); model_->Add(item);
test_api_->RunMessageLoopUntilAnimationsDone(); test_api_->RunMessageLoopUntilAnimationsDone();
return id; return id;
} }
LauncherID AddTabbedBrowser() { LauncherID AddTabbedBrowserNoWait() {
LauncherItem item; LauncherItem item;
item.type = TYPE_TABBED; item.type = TYPE_TABBED;
item.status = STATUS_RUNNING; item.status = STATUS_RUNNING;
int id = model_->next_id(); LauncherID id = model_->next_id();
model_->Add(item); model_->Add(item);
return id;
}
LauncherID AddTabbedBrowser() {
LauncherID id = AddTabbedBrowserNoWait();
test_api_->RunMessageLoopUntilAnimationsDone(); test_api_->RunMessageLoopUntilAnimationsDone();
return id; return id;
} }
...@@ -255,5 +260,33 @@ TEST_F(LauncherViewTest, RemoveLastOverflowed) { ...@@ -255,5 +260,33 @@ TEST_F(LauncherViewTest, RemoveLastOverflowed) {
EXPECT_FALSE(test_api_->IsOverflowButtonVisible()); 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 test
} // namespace ash } // namespace ash
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment