Commit 8dc9b602 authored by Alan Cutter's avatar Alan Cutter Committed by Commit Bot

Fix PWA install icon not hiding after installation

The install promotability status was not being updated on app
installation. This meant that pages would still show the install plus
even after the user had installed the corresponding PWA.

Bug: 1049405
Change-Id: I23d0f2226271ad46cadc4059d7a1846ef385f423
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2040638
Auto-Submit: Alan Cutter <alancutter@chromium.org>
Reviewed-by: default avatarBen Wells <benwells@chromium.org>
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738882}
parent e46117cb
......@@ -305,6 +305,8 @@ class AppBannerManager : public content::WebContentsObserver,
State state() const { return state_; }
bool IsRunning() const;
void SetInstallableWebAppCheckResult(InstallableWebAppCheckResult result);
// The URL for which the banner check is being conducted.
GURL validated_url_;
......@@ -359,8 +361,6 @@ class AppBannerManager : public content::WebContentsObserver,
// Returns a status code based on the current state, to log when terminating.
InstallableStatusCode TerminationCode() const;
void SetInstallableWebAppCheckResult(InstallableWebAppCheckResult result);
// Fetches the data required to display a banner for the current page.
InstallableManager* manager_;
......
......@@ -192,6 +192,7 @@ void AppBannerManagerDesktop::OnWebAppInstalled(
registrar().GetAppUserDisplayMode(*app_id) ==
blink::mojom::DisplayMode::kStandalone) {
OnInstall(registrar().GetAppDisplayMode(*app_id));
SetInstallableWebAppCheckResult(InstallableWebAppCheckResult::kNo);
}
}
......
......@@ -245,7 +245,7 @@ IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
EXPECT_TRUE(pwa_install_view_->GetVisible());
}
// Tests that the plus icon updates its visibiliy when switching between
// Tests that the plus icon updates its visibility when switching between
// installable/non-installable tabs.
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
IconVisibilityAfterTabSwitching) {
......@@ -272,7 +272,7 @@ IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
EXPECT_FALSE(pwa_install_view_->GetVisible());
}
// Tests that the plus icon updates its visibiliy once the installability check
// Tests that the plus icon updates its visibility once the installability check
// completes.
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
IconVisibilityAfterInstallabilityCheck) {
......@@ -287,6 +287,23 @@ IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
EXPECT_FALSE(pwa_install_view_->GetVisible());
}
// Tests that the plus icon updates its visibility after installation.
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
IconVisibilityAfterInstallation) {
StartNavigateToUrl(GetInstallableAppURL());
content::WebContents* first_tab = GetCurrentTab();
EXPECT_FALSE(pwa_install_view_->GetVisible());
ASSERT_TRUE(app_banner_manager_->WaitForInstallableCheck());
EXPECT_TRUE(pwa_install_view_->GetVisible());
OpenTabResult result = OpenTab(GetInstallableAppURL());
EXPECT_TRUE(result.installable);
EXPECT_NE(first_tab, GetCurrentTab());
ExecutePwaInstallIcon();
EXPECT_EQ(first_tab, GetCurrentTab());
EXPECT_FALSE(pwa_install_view_->GetVisible());
}
// Tests that the plus icon animates its label when the installability check
// passes but doesn't animate more than once for the same installability check.
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest, LabelAnimation) {
......
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