diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 02:50:05 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 02:50:05 +0000 |
commit | 1d212cd0ed055ce7851510c5e750402838053d87 (patch) | |
tree | 6c4a2f816891cfab493c065a7c1553ae9f418e1a /ash | |
parent | c4340bc0a16df37171acbd99738aa49e3f35cc64 (diff) | |
download | chromium_src-1d212cd0ed055ce7851510c5e750402838053d87.zip chromium_src-1d212cd0ed055ce7851510c5e750402838053d87.tar.gz chromium_src-1d212cd0ed055ce7851510c5e750402838053d87.tar.bz2 |
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
Diffstat (limited to 'ash')
-rw-r--r-- | ash/launcher/launcher_view.cc | 2 | ||||
-rw-r--r-- | ash/launcher/launcher_view_unittest.cc | 39 |
2 files changed, 37 insertions, 4 deletions
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc index 3f581d4..f5833ba 100644 --- a/ash/launcher/launcher_view.cc +++ b/ash/launcher/launcher_view.cc @@ -230,7 +230,7 @@ class LauncherView::StartFadeAnimationDelegate : launcher_view_->FadeIn(view_); } virtual void AnimationCanceled(const Animation* animation) OVERRIDE { - view_->SetVisible(true); + view_->layer()->SetOpacity(1.0f); } private: diff --git a/ash/launcher/launcher_view_unittest.cc b/ash/launcher/launcher_view_unittest.cc index 14727dc..38162c5 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 |