Commit f56ca6b5 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

Desktop PWAs: ShelfAppBrowserTest enabled for BMO

GetAppIdForTab() for BMO now returns nullopt if a web app is configured
to open in a window, and a browser tab has a URL in the app's scope
open. This matches existing behavior for bookmark apps.

ShelfWebAppBrowserTest.WindowedHostedAndWebApps/WebApps was previously
failing.
(The test installs a web app configured to open in a tab by default.
It navigates to launch the app URL in a tab and asserts the shelf
status indicates the app is closed. This assert previously failed
for BMO. The test then calls ActivateAppAndFlushMojoCallsForAppService
and asserts there is an extra browser and the app is running. That
assert also previously failed for BMO.)

Bug: 1054116
Change-Id: I2a5cbb64b193874442deb093ecbbb1f2c7d6ead3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2428293Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Reviewed-by: default avatarNancy Wang <nancylingwang@chromium.org>
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810486}
parent d15bc724
......@@ -2858,11 +2858,10 @@ IN_PROC_BROWSER_TEST_P(PerDeskShelfAppBrowserTest, AppMenus) {
}
}
// TODO(crbug.com/1054116): Also test with kWebApps.
INSTANTIATE_TEST_SUITE_P(
All,
ShelfWebAppBrowserTest,
::testing::Values(web_app::ProviderType::kBookmarkApps),
web_app::ProviderTypeParamToString);
INSTANTIATE_TEST_SUITE_P(All,
ShelfWebAppBrowserTest,
::testing::Values(web_app::ProviderType::kBookmarkApps,
web_app::ProviderType::kWebApps),
web_app::ProviderTypeParamToString);
INSTANTIATE_TEST_SUITE_P(All, PerDeskShelfAppBrowserTest, ::testing::Bool());
......@@ -91,8 +91,10 @@ base::Optional<std::string> GetAppIdForTab(Profile* profile,
base::Optional<web_app::AppId> app_id =
provider->registrar().FindAppWithUrlInScope(tab->GetURL());
if (app_id)
if (app_id && provider->registrar().GetAppUserDisplayMode(*app_id) ==
web_app::DisplayMode::kBrowser) {
return app_id;
}
}
}
......
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