Commit e70899f7 authored by Alan Cutter's avatar Alan Cutter Committed by Commit Bot

Allow web app manifests to update display to any value

This CL removes the restriction that a web app's manifest display mode
must be one of "standalone", "fullscreen" or "minimal-ui" in order to
participate in manifest updating.

Bug: 1095860
Change-Id: I48241e339c442f8fba341adb85012231b53391f1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352457Reviewed-by: default avatarDaniel Murphy <dmurph@chromium.org>
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797972}
parent 2835fbc8
...@@ -775,7 +775,7 @@ IN_PROC_BROWSER_TEST_P(ManifestUpdateManagerBrowserTest, ...@@ -775,7 +775,7 @@ IN_PROC_BROWSER_TEST_P(ManifestUpdateManagerBrowserTest,
} }
IN_PROC_BROWSER_TEST_P(ManifestUpdateManagerBrowserTest, IN_PROC_BROWSER_TEST_P(ManifestUpdateManagerBrowserTest,
CheckIgnoresDisplayBrowserChange) { CheckFindsDisplayBrowserChange) {
constexpr char kManifestTemplate[] = R"( constexpr char kManifestTemplate[] = R"(
{ {
"name": "Test app name", "name": "Test app name",
...@@ -787,14 +787,23 @@ IN_PROC_BROWSER_TEST_P(ManifestUpdateManagerBrowserTest, ...@@ -787,14 +787,23 @@ IN_PROC_BROWSER_TEST_P(ManifestUpdateManagerBrowserTest,
)"; )";
OverrideManifest(kManifestTemplate, {"standalone", kInstallableIconList}); OverrideManifest(kManifestTemplate, {"standalone", kInstallableIconList});
AppId app_id = InstallWebApp(); AppId app_id = InstallWebApp();
GetProvider().registry_controller().SetAppUserDisplayMode(
app_id, DisplayMode::kStandalone);
OverrideManifest(kManifestTemplate, {"browser", kInstallableIconList}); OverrideManifest(kManifestTemplate, {"browser", kInstallableIconList});
EXPECT_EQ(GetResultAfterPageLoad(GetAppURL(), &app_id), EXPECT_EQ(GetResultAfterPageLoad(GetAppURL(), &app_id),
ManifestUpdateResult::kAppNotEligible); ManifestUpdateResult::kAppUpdated);
histogram_tester_.ExpectBucketCount(kUpdateHistogramName, histogram_tester_.ExpectBucketCount(kUpdateHistogramName,
ManifestUpdateResult::kAppNotEligible, 1); ManifestUpdateResult::kAppUpdated, 1);
EXPECT_EQ(GetProvider().registrar().GetAppDisplayMode(app_id), EXPECT_EQ(GetProvider().registrar().GetAppDisplayMode(app_id),
DisplayMode::kBrowser);
// We don't touch the user's launch preference even if the app display mode
// changes. Instead the effective display mode changes.
EXPECT_EQ(GetProvider().registrar().GetAppUserDisplayMode(app_id),
DisplayMode::kStandalone); DisplayMode::kStandalone);
EXPECT_EQ(GetProvider().registrar().GetAppEffectiveDisplayMode(app_id),
DisplayMode::kMinimalUi);
} }
// A dedicated test fixture for DisplayOverride, which is supported // A dedicated test fixture for DisplayOverride, which is supported
......
...@@ -98,6 +98,7 @@ void ManifestUpdateTask::DidFinishLoad( ...@@ -98,6 +98,7 @@ void ManifestUpdateTask::DidFinishLoad(
InstallableParams params; InstallableParams params;
params.valid_primary_icon = true; params.valid_primary_icon = true;
params.valid_manifest = true; params.valid_manifest = true;
params.check_webapp_manifest_display = false;
InstallableManager::FromWebContents(web_contents()) InstallableManager::FromWebContents(web_contents())
->GetData(params, ->GetData(params,
base::BindOnce(&ManifestUpdateTask::OnDidGetInstallableData, base::BindOnce(&ManifestUpdateTask::OnDidGetInstallableData,
......
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