Commit 7a1cf807 authored by Eric Willigers's avatar Eric Willigers Committed by Chromium LUCI CQ

Desktop PWAs: Test launch attempt after uninstall

Attempting to launch an app that has been uninstalled
results in nullptr WebContents being returned, with
no check failures.

Change-Id: I911904a068f9b03d92d5453cbbbdd243fbab2419
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2608102
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Reviewed-by: default avatarcalamity <calamity@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840074}
parent 9bd61f8b
......@@ -152,6 +152,7 @@ content::WebContents* WebAppLaunchManager::OpenApplication(
params.intent ? provider_->registrar().GetAppShareTarget(params.app_id)
: nullptr;
const GURL url = GetLaunchUrl(*provider_, params, share_target);
DCHECK(url.is_valid());
// Place new windows on the specified display.
display::ScopedDisplayForNewWindows scoped_display(params.display_id);
......
......@@ -4,6 +4,10 @@
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "chrome/browser/apps/app_service/app_launch_params.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/apps/app_service/browser_app_launcher.h"
#include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
......@@ -15,10 +19,12 @@
#include "chrome/browser/web_applications/components/install_finalizer.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
#include "chrome/browser/web_applications/components/web_app_provider_base.h"
#include "components/services/app_service/public/mojom/types.mojom.h"
#include "components/sessions/core/tab_restore_service.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "ui/base/window_open_disposition.h"
#include "url/gurl.h"
namespace web_app {
......@@ -119,4 +125,21 @@ IN_PROC_BROWSER_TEST_F(WebAppUninstallBrowserTest,
GetSecureAppURL());
}
IN_PROC_BROWSER_TEST_F(WebAppUninstallBrowserTest, CannotLaunchAfterUninstall) {
const GURL app_url = GetSecureAppURL();
const AppId app_id = InstallPWA(app_url);
apps::AppLaunchParams params(
app_id, apps::mojom::LaunchContainer::kLaunchContainerWindow,
WindowOpenDisposition::NEW_WINDOW,
apps::mojom::AppLaunchSource::kSourceTest);
UninstallWebApp(app_id);
content::WebContents* const web_contents =
apps::AppServiceProxyFactory::GetForProfile(profile())
->BrowserAppLauncher()
->LaunchAppWithParams(std::move(params));
EXPECT_EQ(web_contents, nullptr);
}
} // 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