Commit 1440d756 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

shelf: AppShortcutLauncherItemController supports web apps

A new AppMatcher class is introduced, and used by
AppShortcutLauncherItemController to match browser web
contents against app id.

No extensions APIs are used for bookmark apps.

Bug: 1048055
Change-Id: I16197a28d89140bd4c863fb4891878720ba378f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2087323
Commit-Queue: Nancy Wang <nancylingwang@chromium.org>
Reviewed-by: default avatarNancy Wang <nancylingwang@chromium.org>
Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Auto-Submit: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748066}
parent 86877b8c
......@@ -340,12 +340,21 @@ IN_PROC_BROWSER_TEST_F(AppServiceAppWindowBrowserTest,
EXPECT_EQ(0u, windows.size());
}
// TODO(crbug.com/2078377): Parameterize this test, retire
// AppServiceWebAndBookmarkAppBrowserTest.
class AppServiceAppWindowWebAppBrowserTest
: public AppServiceAppWindowBrowserTest {
: public AppServiceAppWindowBrowserTest,
public ::testing::WithParamInterface<web_app::ProviderType> {
protected:
AppServiceAppWindowWebAppBrowserTest() {
if (GetParam() == web_app::ProviderType::kWebApps) {
scoped_feature_list_.InitAndEnableFeature(
features::kDesktopPWAsWithoutExtensions);
} else {
scoped_feature_list_.InitAndDisableFeature(
features::kDesktopPWAsWithoutExtensions);
}
}
~AppServiceAppWindowWebAppBrowserTest() override = default;
// AppServiceAppWindowBrowserTest:
void SetUpOnMainThread() override {
AppServiceAppWindowBrowserTest::SetUpOnMainThread();
......@@ -376,12 +385,15 @@ class AppServiceAppWindowWebAppBrowserTest
return https_server_.GetURL("app.com", "/ssl/google.html");
}
private:
// For mocking a secure site.
net::EmbeddedTestServer https_server_;
base::test::ScopedFeatureList scoped_feature_list_;
};
// Test that we have the correct instance for Web apps.
IN_PROC_BROWSER_TEST_F(AppServiceAppWindowWebAppBrowserTest, WebAppsWindow) {
IN_PROC_BROWSER_TEST_P(AppServiceAppWindowWebAppBrowserTest, WebAppsWindow) {
std::string app_id = CreateWebApp();
auto windows = app_service_proxy_->InstanceRegistry().GetWindows(app_id);
......@@ -432,32 +444,6 @@ IN_PROC_BROWSER_TEST_F(AppServiceAppWindowWebAppBrowserTest, WebAppsWindow) {
EXPECT_EQ(0u, windows.size());
}
class AppServiceWebAndBookmarkAppBrowserTest
: public AppServiceAppWindowWebAppBrowserTest,
public ::testing::WithParamInterface<web_app::ProviderType> {
protected:
AppServiceWebAndBookmarkAppBrowserTest() {
if (GetParam() == web_app::ProviderType::kWebApps) {
scoped_feature_list_.InitAndEnableFeature(
features::kDesktopPWAsWithoutExtensions);
} else if (GetParam() == web_app::ProviderType::kBookmarkApps) {
scoped_feature_list_.InitAndDisableFeature(
features::kDesktopPWAsWithoutExtensions);
}
}
~AppServiceWebAndBookmarkAppBrowserTest() override = default;
private:
base::test::ScopedFeatureList scoped_feature_list_;
};
IN_PROC_BROWSER_TEST_P(AppServiceWebAndBookmarkAppBrowserTest, GetWindows) {
const std::string app_id = CreateWebApp();
auto windows = app_service_proxy_->InstanceRegistry().GetWindows(app_id);
EXPECT_EQ(1u, windows.size());
}
class AppServiceAppWindowArcAppBrowserTest
: public AppServiceAppWindowBrowserTest {
protected:
......@@ -643,7 +629,7 @@ IN_PROC_BROWSER_TEST_F(AppServiceAppWindowArcAppBrowserTest, ArcAppsWindow) {
}
INSTANTIATE_TEST_SUITE_P(All,
AppServiceWebAndBookmarkAppBrowserTest,
AppServiceAppWindowWebAppBrowserTest,
::testing::Values(web_app::ProviderType::kBookmarkApps,
web_app::ProviderType::kWebApps),
web_app::ProviderTypeParamToString);
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