Commit 78b247a6 authored by Devlin Cronin's avatar Devlin Cronin Committed by Commit Bot

[Web App Migration] Add a (failing) test for an uninstalled extension

We can migrate extension-apps to web-apps, but should do so only if
the user still has the extension-app installed (i.e., hasn't explicitly
chosen to remove it previously).

Unfortunately, this currently doesn't work - the preinstalled app will
still be installed. Add a test for this (with the expectations flipped)
so we have it for when it's fixed.

Bug: 1130619
Change-Id: Iba936e0311eb24b4d6b6c7460c1790d895df6d64
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2416946
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808968}
parent 8d8a5fc0
...@@ -368,4 +368,52 @@ IN_PROC_BROWSER_TEST_F(ExternalWebAppMigrationBrowserTest, MigratePreferences) { ...@@ -368,4 +368,52 @@ IN_PROC_BROWSER_TEST_F(ExternalWebAppMigrationBrowserTest, MigratePreferences) {
} }
} }
IN_PROC_BROWSER_TEST_F(ExternalWebAppMigrationBrowserTest,
UserUninstalledExtensionApp) {
// Set up pre-migration state.
{
ASSERT_FALSE(IsExternalAppInstallFeatureEnabled(kMigrationFlag));
SyncExternalExtensions();
SyncExternalWebApps(/*expect_install=*/false, /*expect_uninstall=*/false);
EXPECT_FALSE(IsWebAppInstalled());
EXPECT_TRUE(IsExtensionAppInstalled());
}
{
extensions::TestExtensionRegistryObserver uninstall_observer(
extensions::ExtensionRegistry::Get(profile()), kExtensionId);
extensions::ExtensionSystem::Get(profile())
->extension_service()
->UninstallExtension(kExtensionId,
extensions::UNINSTALL_REASON_FOR_TESTING, nullptr);
uninstall_observer.WaitForExtensionUninstalled();
EXPECT_FALSE(IsWebAppInstalled());
EXPECT_FALSE(IsExtensionAppInstalled());
}
// Migrate extension app to web app.
{
base::AutoReset<bool> testing_scope =
SetExternalAppInstallFeatureAlwaysEnabledForTesting();
ASSERT_TRUE(IsExternalAppInstallFeatureEnabled(kMigrationFlag));
SyncExternalExtensions();
EXPECT_FALSE(IsExtensionAppInstalled());
// The web app should *not* be installed, since the user chose to uninstall
// the extension app that it's replacing. Unfortunately, this doesn't
// currently work.
// TODO(alancutter): Fix this so that default web apps that are replacing
// extensions are only installed if the corresponding extension is still
// installed.
// SyncExternalWebApps(/*expect_install=*/false,
// /*expect_uninstall=*/false); EXPECT_FALSE(IsWebAppInstalled());
SyncExternalWebApps(/*expect_install=*/true, /*expect_uninstall=*/false);
EXPECT_TRUE(IsWebAppInstalled());
}
}
} // namespace web_app } // namespace web_app
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