Commit ddd7af6f authored by Dana Fried's avatar Dana Fried Committed by Commit Bot

Use slide animation for butter-style chips.

Exactly what it says on the tin: icons (save credit card, save passord)
now slide out from under the profile icon instead of just appearing.

Updated a couple of browser tests to make sure we don't have flaky
behavior due to the new animations.

It looks pretty cool tbh.

Bug: 1037946
Change-Id: I70803e204e8ccb14273ce2e57f21f808e947d068
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1981334
Commit-Queue: Dana Fried <dfried@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728050}
parent 1a1b2ac8
...@@ -323,18 +323,7 @@ class LocalCardMigrationBrowserTest ...@@ -323,18 +323,7 @@ class LocalCardMigrationBrowserTest
DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE}); DialogEvent::RECEIVED_GET_UPLOAD_DETAILS_RESPONSE});
FillAndSubmitFormWithCard(card_number); FillAndSubmitFormWithCard(card_number);
WaitForObservedEvent(); WaitForObservedEvent();
if (base::FeatureList::IsEnabled( WaitForAnimationToComplete();
features::kAutofillEnableToolbarStatusChip)) {
// Wait for animations to finish.
base::RunLoop loop;
static_cast<views::AnimatingLayoutManager*>(
BrowserView::GetBrowserViewForBrowser(browser())
->toolbar()
->toolbar_account_icon_container()
->GetLayoutManager())
->PostOrQueueAction(loop.QuitClosure());
loop.Run();
}
} }
void ClickOnSaveButtonAndWaitForMigrationResults() { void ClickOnSaveButtonAndWaitForMigrationResults() {
...@@ -511,6 +500,21 @@ class LocalCardMigrationBrowserTest ...@@ -511,6 +500,21 @@ class LocalCardMigrationBrowserTest
void WaitForCardDeletion() { WaitForPersonalDataChange(browser()); } void WaitForCardDeletion() { WaitForPersonalDataChange(browser()); }
void WaitForAnimationToComplete() {
if (base::FeatureList::IsEnabled(
features::kAutofillEnableToolbarStatusChip)) {
// Wait for animations to finish.
base::RunLoop loop;
static_cast<views::AnimatingLayoutManager*>(
BrowserView::GetBrowserViewForBrowser(browser())
->toolbar()
->toolbar_account_icon_container()
->GetLayoutManager())
->PostOrQueueAction(loop.QuitClosure());
loop.Run();
}
}
std::unique_ptr< std::unique_ptr<
base::CallbackList<void(content::BrowserContext*)>::Subscription> base::CallbackList<void(content::BrowserContext*)>::Subscription>
will_create_browser_context_services_subscription_; will_create_browser_context_services_subscription_;
...@@ -1095,12 +1099,14 @@ IN_PROC_BROWSER_TEST_F(LocalCardMigrationBrowserTestForStatusChip, ...@@ -1095,12 +1099,14 @@ IN_PROC_BROWSER_TEST_F(LocalCardMigrationBrowserTestForStatusChip,
AddTabAtIndex(1, GURL("http://example.com/"), ui::PAGE_TRANSITION_TYPED); AddTabAtIndex(1, GURL("http://example.com/"), ui::PAGE_TRANSITION_TYPED);
TabStripModel* tab_model = browser()->tab_strip_model(); TabStripModel* tab_model = browser()->tab_strip_model();
tab_model->ActivateTabAt(1, {TabStripModel::GestureType::kOther}); tab_model->ActivateTabAt(1, {TabStripModel::GestureType::kOther});
WaitForAnimationToComplete();
// Ensures bubble and icon go away if user navigates to another tab. // Ensures bubble and icon go away if user navigates to another tab.
EXPECT_FALSE(GetLocalCardMigrationIconView()->GetVisible()); EXPECT_FALSE(GetLocalCardMigrationIconView()->GetVisible());
EXPECT_FALSE(GetLocalCardMigrationOfferBubbleViews()); EXPECT_FALSE(GetLocalCardMigrationOfferBubbleViews());
tab_model->ActivateTabAt(0, {TabStripModel::GestureType::kOther}); tab_model->ActivateTabAt(0, {TabStripModel::GestureType::kOther});
WaitForAnimationToComplete();
// If the user navigates back, shows only the icon not the bubble. // If the user navigates back, shows only the icon not the bubble.
EXPECT_TRUE(GetLocalCardMigrationIconView()->GetVisible()); EXPECT_TRUE(GetLocalCardMigrationIconView()->GetVisible());
......
...@@ -2458,12 +2458,14 @@ IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTestForStatusChip, ...@@ -2458,12 +2458,14 @@ IN_PROC_BROWSER_TEST_F(SaveCardBubbleViewsFullFormBrowserTestForStatusChip,
AddTabAtIndex(1, GURL("http://example.com/"), ui::PAGE_TRANSITION_TYPED); AddTabAtIndex(1, GURL("http://example.com/"), ui::PAGE_TRANSITION_TYPED);
TabStripModel* tab_model = browser()->tab_strip_model(); TabStripModel* tab_model = browser()->tab_strip_model();
tab_model->ActivateTabAt(1, {TabStripModel::GestureType::kOther}); tab_model->ActivateTabAt(1, {TabStripModel::GestureType::kOther});
WaitForAnimationToEnd();
// Ensures bubble and icon go away if user navigates to another tab. // Ensures bubble and icon go away if user navigates to another tab.
EXPECT_FALSE(GetSaveCardIconView()->GetVisible()); EXPECT_FALSE(GetSaveCardIconView()->GetVisible());
EXPECT_FALSE(GetSaveCardBubbleViews()); EXPECT_FALSE(GetSaveCardBubbleViews());
tab_model->ActivateTabAt(0, {TabStripModel::GestureType::kOther}); tab_model->ActivateTabAt(0, {TabStripModel::GestureType::kOther});
WaitForAnimationToEnd();
// If the user navigates back, shows only the icon not the bubble. // If the user navigates back, shows only the icon not the bubble.
EXPECT_TRUE(GetSaveCardIconView()->GetVisible()); EXPECT_TRUE(GetSaveCardIconView()->GetVisible());
......
...@@ -46,16 +46,20 @@ ToolbarAccountIconContainerView::ToolbarAccountIconContainerView( ...@@ -46,16 +46,20 @@ ToolbarAccountIconContainerView::ToolbarAccountIconContainerView(
params.page_action_icon_delegate = this; params.page_action_icon_delegate = this;
params.button_observer = this; params.button_observer = this;
params.view_observer = this; params.view_observer = this;
avatar_->SetProperty(views::kFlexBehaviorKey,
views::FlexSpecification::ForSizeRule(
views::MinimumFlexSizeRule::kScaleToMinimum,
views::MaximumFlexSizeRule::kPreferred));
AddMainButton(avatar_); AddMainButton(avatar_);
// Since the insertion point for icons before the avatar button, we don't // Since the insertion point for icons before the avatar button, we don't
// initialize until after the avatar button has been added. // initialize until after the avatar button has been added.
page_action_icon_controller_ = std::make_unique<PageActionIconController>(); page_action_icon_controller_ = std::make_unique<PageActionIconController>();
page_action_icon_controller_->Init(params, this); page_action_icon_controller_->Init(params, this);
avatar_->SetProperty(views::kFlexBehaviorKey,
views::FlexSpecification::ForSizeRule(
views::MinimumFlexSizeRule::kScaleToMinimum,
views::MaximumFlexSizeRule::kPreferred));
// TODO(crbug.com/1038571): move this into the base class.
animating_layout_manager()->SetDefaultFadeMode(
views::AnimatingLayoutManager::FadeInOutMode::kSlideFromTrailingEdge);
} }
ToolbarAccountIconContainerView::~ToolbarAccountIconContainerView() = default; ToolbarAccountIconContainerView::~ToolbarAccountIconContainerView() = default;
......
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