Commit 1b8269f3 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

WebAppInstallForceListPolicyTest.StartUpInstallation no longer

relies on Extensions methods to wait for the web app to be installed,
or to check the web app launch url.

Not yet addressed: InstallBookmarkApp calls in ExtensionPolicyTest.
https://crbug.com/1055183

Bug: 1052722
Change-Id: I5b7f81b8fe3c778ce5adbe46d28da40e7a070986
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2067784Reviewed-by: default avatarAlexey Baskakov <loyso@chromium.org>
Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Commit-Queue: Maksim Ivanov <emaxx@chromium.org>
Auto-Submit: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#743909}
parent 7d52b1d5
......@@ -24,8 +24,10 @@
#include "chrome/browser/policy/profile_policy_connector_builder.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/web_applications/components/app_registrar.h"
#include "chrome/browser/web_applications/components/app_shortcut_manager.h"
#include "chrome/browser/web_applications/components/web_app_provider_base.h"
#include "chrome/browser/web_applications/test/web_app_install_observer.h"
#include "chrome/common/extensions/extension_test_util.h"
#include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
#include "chrome/common/web_application_info.h"
......@@ -1493,14 +1495,15 @@ class WebAppInstallForceListPolicyTest : public ExtensionPolicyTest {
};
IN_PROC_BROWSER_TEST_F(WebAppInstallForceListPolicyTest, StartUpInstallation) {
extensions::TestExtensionRegistryObserver observer(extension_registry());
const extensions::Extension* installed_extension =
observer.WaitForExtensionWillBeInstalled();
ASSERT_TRUE(installed_extension);
const GURL installed_app_url =
extensions::AppLaunchInfo::GetFullLaunchURL(installed_extension);
EXPECT_EQ(policy_app_url_, installed_app_url);
const web_app::AppRegistrar& registrar =
web_app::WebAppProviderBase::GetProviderBase(browser()->profile())
->registrar();
web_app::WebAppInstallObserver install_observer(browser()->profile());
base::Optional<web_app::AppId> app_id =
registrar.FindAppWithUrlInScope(policy_app_url_);
if (!app_id)
app_id = install_observer.AwaitNextInstall();
EXPECT_EQ(policy_app_url_, registrar.GetAppLaunchURL(*app_id));
}
// Fixture for tests that have two profiles with a different policy for each.
......
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