Commit 78b5a541 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

desktop-pwas: Support BMO in TabDragControllerTest

The test DetachToBrowserTabDragControllerTest no longer
relies on extensions to launch a web app.

Bug: 1865741
Change-Id: Iee6850e33c06639e6b6bf4efa533c3cba85c4df3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1866223
Auto-Submit: Eric Willigers <ericwilligers@chromium.org>
Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707362}
parent 0c000c79
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/location.h" #include "base/location.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/optional.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/stl_util.h" #include "base/stl_util.h"
...@@ -27,7 +28,6 @@ ...@@ -27,7 +28,6 @@
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/browsertest_util.h"
#include "chrome/browser/installable/installable_metrics.h" #include "chrome/browser/installable/installable_metrics.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_commands.h"
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "chrome/browser/ui/views/tabs/tab_strip.h" #include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/browser/ui/views/tabs/window_finder.h" #include "chrome/browser/ui/views/tabs/window_finder.h"
#include "chrome/browser/ui/web_applications/system_web_app_ui_utils.h" #include "chrome/browser/ui/web_applications/system_web_app_ui_utils.h"
#include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h"
#include "chrome/browser/web_applications/components/externally_installed_web_app_prefs.h" #include "chrome/browser/web_applications/components/externally_installed_web_app_prefs.h"
#include "chrome/browser/web_applications/components/web_app_constants.h" #include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/components/web_app_install_utils.h" #include "chrome/browser/web_applications/components/web_app_install_utils.h"
...@@ -627,29 +628,25 @@ class DetachToBrowserTabDragControllerTest ...@@ -627,29 +628,25 @@ class DetachToBrowserTabDragControllerTest
Browser* GetTerminalAppBrowser() { Browser* GetTerminalAppBrowser() {
// Install the app (but only once per session). // Install the app (but only once per session).
if (!terminal_app_extension_) { if (!terminal_app_id_) {
GURL app_url = embedded_test_server()->GetURL("app.com", "/simple.html"); GURL app_url = embedded_test_server()->GetURL("app.com", "/simple.html");
auto web_app_info = std::make_unique<WebApplicationInfo>(); auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info->app_url = app_url; web_app_info->app_url = app_url;
web_app_info->scope = app_url.GetWithoutFilename(); web_app_info->scope = app_url.GetWithoutFilename();
web_app_info->open_as_window = true; web_app_info->open_as_window = true;
web_app::AppId app_id = InstallWebApp(std::move(web_app_info)); terminal_app_id_ = InstallWebApp(std::move(web_app_info));
auto* provider = web_app::WebAppProvider::Get(browser()->profile()); auto* provider = web_app::WebAppProvider::Get(browser()->profile());
provider->system_web_app_manager().SetSystemAppsForTesting( provider->system_web_app_manager().SetSystemAppsForTesting(
{{web_app::SystemAppType::TERMINAL, {{web_app::SystemAppType::TERMINAL,
web_app::SystemAppInfo(app_url)}}); web_app::SystemAppInfo(app_url)}});
web_app::ExternallyInstalledWebAppPrefs(browser()->profile()->GetPrefs()) web_app::ExternallyInstalledWebAppPrefs(browser()->profile()->GetPrefs())
.Insert(app_url, app_id, .Insert(app_url, *terminal_app_id_,
web_app::ExternalInstallSource::kInternalDefault); web_app::ExternalInstallSource::kInternalDefault);
terminal_app_extension_ =
extensions::ExtensionRegistry::Get(browser()->profile())
->GetInstalledExtension(app_id);
} }
return extensions::browsertest_util::LaunchAppBrowser( return web_app::LaunchWebAppBrowser(browser()->profile(),
browser()->profile(), terminal_app_extension_); *terminal_app_id_);
} }
Browser* browser() const { return InProcessBrowserTest::browser(); } Browser* browser() const { return InProcessBrowserTest::browser(); }
...@@ -659,7 +656,7 @@ class DetachToBrowserTabDragControllerTest ...@@ -659,7 +656,7 @@ class DetachToBrowserTabDragControllerTest
// The root window for the event generator. // The root window for the event generator.
aura::Window* root_ = nullptr; aura::Window* root_ = nullptr;
#endif #endif
const extensions::Extension* terminal_app_extension_ = nullptr; base::Optional<web_app::AppId> terminal_app_id_;
DISALLOW_COPY_AND_ASSIGN(DetachToBrowserTabDragControllerTest); DISALLOW_COPY_AND_ASSIGN(DetachToBrowserTabDragControllerTest);
}; };
......
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