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

desktop-pwas: Support BMO in chrome/browser/ui/views tests

Bookmark apps are no longer created in views tests using
extensions-specific code.

Bug: 966290
Change-Id: I9596d498421d6d5d180861bad2969d369f159cf5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1865741Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707933}
parent 69041ca1
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
#include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/browser/ui/views/web_apps/web_app_frame_toolbar_view.h" #include "chrome/browser/ui/views/web_apps/web_app_frame_toolbar_view.h"
#include "chrome/browser/ui/views/web_apps/web_app_menu_button.h" #include "chrome/browser/ui/views/web_apps/web_app_menu_button.h"
#include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h"
#include "chrome/browser/web_applications/system_web_app_manager.h" #include "chrome/browser/web_applications/system_web_app_manager.h"
#include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/common/web_application_info.h" #include "chrome/common/web_application_info.h"
...@@ -801,17 +802,16 @@ class WebAppNonClientFrameViewAshTest ...@@ -801,17 +802,16 @@ class WebAppNonClientFrameViewAshTest
// |SetUpWebApp()| must be called after |SetUpOnMainThread()| to make sure // |SetUpWebApp()| must be called after |SetUpOnMainThread()| to make sure
// the Network Service process has been setup properly. // the Network Service process has been setup properly.
void SetUpWebApp() { void SetUpWebApp() {
WebApplicationInfo web_app_info; auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info.app_url = GetAppURL(); web_app_info->app_url = GetAppURL();
web_app_info.scope = GetAppURL().GetWithoutFilename(); web_app_info->scope = GetAppURL().GetWithoutFilename();
web_app_info.theme_color = GetThemeColor(); web_app_info->theme_color = GetThemeColor();
// TODO(alancutter): Use web_app::InstallManager instead of Extensions web_app::AppId app_id =
// specific install path. web_app::InstallWebApp(browser()->profile(), std::move(web_app_info));
const extensions::Extension* app = InstallBookmarkApp(web_app_info);
content::TestNavigationObserver navigation_observer(GetAppURL()); content::TestNavigationObserver navigation_observer(GetAppURL());
navigation_observer.StartWatchingNewWebContents(); navigation_observer.StartWatchingNewWebContents();
app_browser_ = LaunchAppBrowser(app); app_browser_ = web_app::LaunchWebAppBrowser(browser()->profile(), app_id);
navigation_observer.WaitForNavigationFinished(); navigation_observer.WaitForNavigationFinished();
browser_view_ = BrowserView::GetBrowserViewForBrowser(app_browser_); browser_view_ = BrowserView::GetBrowserViewForBrowser(app_browser_);
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/extensions/browsertest_util.h"
#include "chrome/browser/extensions/extension_browsertest.h" #include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/themes/theme_properties.h" #include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service.h"
...@@ -13,6 +12,7 @@ ...@@ -13,6 +12,7 @@
#include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/location_bar/custom_tab_bar_view.h" #include "chrome/browser/ui/views/location_bar/custom_tab_bar_view.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h"
#include "chrome/browser/web_applications/extensions/system_web_app_manager_browsertest.h" #include "chrome/browser/web_applications/extensions/system_web_app_manager_browsertest.h"
#include "chrome/browser/web_applications/system_web_app_manager.h" #include "chrome/browser/web_applications/system_web_app_manager.h"
#include "chrome/common/web_application_info.h" #include "chrome/common/web_application_info.h"
...@@ -43,21 +43,21 @@ class BrowserNonClientFrameViewBrowserTest ...@@ -43,21 +43,21 @@ class BrowserNonClientFrameViewBrowserTest
// Note: A "bookmark app" is a type of hosted app. All of these tests apply // Note: A "bookmark app" is a type of hosted app. All of these tests apply
// equally to hosted and bookmark apps, but it's easier to install a bookmark // equally to hosted and bookmark apps, but it's easier to install a bookmark
// app in a test. // app in a test.
// TODO: Add tests for non-bookmark hosted apps, as bookmark apps will no
// longer be hosted apps when BMO ships.
void InstallAndLaunchBookmarkApp( void InstallAndLaunchBookmarkApp(
base::Optional<GURL> app_url = base::nullopt) { base::Optional<GURL> app_url = base::nullopt) {
if (!app_url) if (!app_url)
app_url = GetAppURL(); app_url = GetAppURL();
WebApplicationInfo web_app_info; 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();
if (app_theme_color_) if (app_theme_color_)
web_app_info.theme_color = *app_theme_color_; web_app_info->theme_color = *app_theme_color_;
const extensions::Extension* app = web_app::AppId app_id =
extensions::browsertest_util::InstallBookmarkApp(browser()->profile(), web_app::InstallWebApp(profile(), std::move(web_app_info));
web_app_info); app_browser_ = web_app::LaunchWebAppBrowser(profile(), app_id);
app_browser_ = extensions::browsertest_util::LaunchAppBrowser(
browser()->profile(), app);
web_contents_ = app_browser_->tab_strip_model()->GetActiveWebContents(); web_contents_ = app_browser_->tab_strip_model()->GetActiveWebContents();
// Ensure the main page has loaded and is ready for ExecJs DOM manipulation. // Ensure the main page has loaded and is ready for ExecJs DOM manipulation.
ASSERT_TRUE(content::NavigateToURL(web_contents_, *app_url)); ASSERT_TRUE(content::NavigateToURL(web_contents_, *app_url));
......
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
#include "chrome/browser/ui/views/frame/glass_browser_frame_view.h" #include "chrome/browser/ui/views/frame/glass_browser_frame_view.h"
#include "chrome/browser/extensions/browsertest_util.h"
#include "chrome/browser/themes/theme_properties.h" #include "chrome/browser/themes/theme_properties.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"
#include "chrome/browser/ui/views/frame/app_menu_button.h" #include "chrome/browser/ui/views/frame/app_menu_button.h"
#include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/web_apps/web_app_frame_toolbar_view.h" #include "chrome/browser/ui/views/web_apps/web_app_frame_toolbar_view.h"
#include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h"
#include "chrome/common/web_application_info.h" #include "chrome/common/web_application_info.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
#include "content/public/test/test_navigation_observer.h" #include "content/public/test/test_navigation_observer.h"
...@@ -33,21 +33,17 @@ class WebAppGlassBrowserFrameViewTest : public InProcessBrowserTest { ...@@ -33,21 +33,17 @@ class WebAppGlassBrowserFrameViewTest : public InProcessBrowserTest {
// TODO(https://crbug.com/863278): Force Aero glass on Windows 7 for this // TODO(https://crbug.com/863278): Force Aero glass on Windows 7 for this
// test. // test.
bool InstallAndLaunchWebApp() { bool InstallAndLaunchWebApp() {
WebApplicationInfo web_app_info; auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info.app_url = GetAppURL(); web_app_info->app_url = GetAppURL();
web_app_info.scope = GetAppURL().GetWithoutFilename(); web_app_info->scope = GetAppURL().GetWithoutFilename();
if (theme_color_) if (theme_color_)
web_app_info.theme_color = *theme_color_; web_app_info->theme_color = *theme_color_;
// TODO(alancutter): Use web_app::InstallManager instead of Extensions web_app::AppId app_id =
// specific install path. web_app::InstallWebApp(browser()->profile(), std::move(web_app_info));
const extensions::Extension* app =
extensions::browsertest_util::InstallBookmarkApp(browser()->profile(),
web_app_info);
content::TestNavigationObserver navigation_observer(GetAppURL()); content::TestNavigationObserver navigation_observer(GetAppURL());
navigation_observer.StartWatchingNewWebContents(); navigation_observer.StartWatchingNewWebContents();
app_browser_ = extensions::browsertest_util::LaunchAppBrowser( app_browser_ = web_app::LaunchWebAppBrowser(browser()->profile(), app_id);
browser()->profile(), app);
navigation_observer.WaitForNavigationFinished(); navigation_observer.WaitForNavigationFinished();
browser_view_ = BrowserView::GetBrowserViewForBrowser(app_browser_); browser_view_ = BrowserView::GetBrowserViewForBrowser(app_browser_);
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "ash/public/cpp/test/shell_test_api.h" #include "ash/public/cpp/test/shell_test_api.h"
#include "base/macros.h" #include "base/macros.h"
#include "base/test/test_mock_time_task_runner.h" #include "base/test/test_mock_time_task_runner.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/profiles/profile_io_data.h" #include "chrome/browser/profiles/profile_io_data.h"
#include "chrome/browser/ui/ash/tablet_mode_page_behavior.h" #include "chrome/browser/ui/ash/tablet_mode_page_behavior.h"
#include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_commands.h"
...@@ -23,6 +22,7 @@ ...@@ -23,6 +22,7 @@
#include "chrome/browser/ui/views/toolbar/toolbar_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/browser/ui/views/web_apps/web_app_frame_toolbar_view.h" #include "chrome/browser/ui/views/web_apps/web_app_frame_toolbar_view.h"
#include "chrome/browser/ui/views/web_apps/web_app_menu_button.h" #include "chrome/browser/ui/views/web_apps/web_app_menu_button.h"
#include "chrome/browser/ui/web_applications/web_app_controller_browsertest.h"
#include "chrome/common/web_application_info.h" #include "chrome/common/web_application_info.h"
#include "chrome/test/base/ui_test_utils.h" #include "chrome/test/base/ui_test_utils.h"
#include "content/public/test/content_mock_cert_verifier.h" #include "content/public/test/content_mock_cert_verifier.h"
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "ui/views/window/frame_caption_button.h" #include "ui/views/window/frame_caption_button.h"
class ImmersiveModeControllerAshWebAppBrowserTest class ImmersiveModeControllerAshWebAppBrowserTest
: public extensions::ExtensionBrowserTest { : public web_app::WebAppControllerBrowserTest {
public: public:
ImmersiveModeControllerAshWebAppBrowserTest() ImmersiveModeControllerAshWebAppBrowserTest()
: https_server_(net::EmbeddedTestServer::TYPE_HTTPS) {} : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) {}
...@@ -45,11 +45,11 @@ class ImmersiveModeControllerAshWebAppBrowserTest ...@@ -45,11 +45,11 @@ class ImmersiveModeControllerAshWebAppBrowserTest
https_server_.AddDefaultHandlers(GetChromeTestDataDir()); https_server_.AddDefaultHandlers(GetChromeTestDataDir());
ASSERT_TRUE(https_server_.Start()); ASSERT_TRUE(https_server_.Start());
WebApplicationInfo web_app_info; auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info.app_url = GetAppUrl(); web_app_info->app_url = GetAppUrl();
web_app_info.theme_color = SK_ColorBLUE; web_app_info->theme_color = SK_ColorBLUE;
app_ = InstallBookmarkApp(web_app_info); app_id = InstallWebApp(std::move(web_app_info));
} }
GURL GetAppUrl() { return https_server_.GetURL("/simple.html"); } GURL GetAppUrl() { return https_server_.GetURL("/simple.html"); }
...@@ -57,7 +57,8 @@ class ImmersiveModeControllerAshWebAppBrowserTest ...@@ -57,7 +57,8 @@ class ImmersiveModeControllerAshWebAppBrowserTest
void LaunchAppBrowser(bool wait = true) { void LaunchAppBrowser(bool wait = true) {
ui_test_utils::UrlLoadObserver url_observer( ui_test_utils::UrlLoadObserver url_observer(
GetAppUrl(), content::NotificationService::AllSources()); GetAppUrl(), content::NotificationService::AllSources());
browser_ = ExtensionBrowserTest::LaunchAppBrowser(app_); browser_ = LaunchWebAppBrowser(app_id);
if (wait) { if (wait) {
// Wait for the URL to load so that the location bar end-state stabilizes. // Wait for the URL to load so that the location bar end-state stabilizes.
url_observer.Wait(); url_observer.Wait();
...@@ -131,8 +132,7 @@ class ImmersiveModeControllerAshWebAppBrowserTest ...@@ -131,8 +132,7 @@ class ImmersiveModeControllerAshWebAppBrowserTest
} }
private: private:
// Not owned. web_app::AppId app_id;
const extensions::Extension* app_ = nullptr;
Browser* browser_ = nullptr; Browser* browser_ = nullptr;
ImmersiveModeController* controller_ = nullptr; ImmersiveModeController* controller_ = nullptr;
...@@ -148,7 +148,7 @@ class ImmersiveModeControllerAshWebAppBrowserTest ...@@ -148,7 +148,7 @@ class ImmersiveModeControllerAshWebAppBrowserTest
// Test the layout and visibility of the TopContainerView and web contents when // Test the layout and visibility of the TopContainerView and web contents when
// a web app is put into immersive fullscreen. // a web app is put into immersive fullscreen.
IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest, Layout) { IN_PROC_BROWSER_TEST_P(ImmersiveModeControllerAshWebAppBrowserTest, Layout) {
LaunchAppBrowser(); LaunchAppBrowser();
TabStrip* tabstrip = browser_view()->tabstrip(); TabStrip* tabstrip = browser_view()->tabstrip();
ToolbarView* toolbar = browser_view()->toolbar(); ToolbarView* toolbar = browser_view()->toolbar();
...@@ -207,7 +207,7 @@ IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest, Layout) { ...@@ -207,7 +207,7 @@ IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest, Layout) {
// Verify the immersive mode status is as expected in tablet mode (titlebars are // Verify the immersive mode status is as expected in tablet mode (titlebars are
// autohidden in tablet mode). // autohidden in tablet mode).
IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest, IN_PROC_BROWSER_TEST_P(ImmersiveModeControllerAshWebAppBrowserTest,
ImmersiveModeStatusTabletMode) { ImmersiveModeStatusTabletMode) {
LaunchAppBrowser(); LaunchAppBrowser();
ASSERT_FALSE(controller()->IsEnabled()); ASSERT_FALSE(controller()->IsEnabled());
...@@ -258,7 +258,7 @@ IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest, ...@@ -258,7 +258,7 @@ IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest,
// Verify that the frame layout is as expected when using immersive mode in // Verify that the frame layout is as expected when using immersive mode in
// tablet mode. // tablet mode.
IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest, IN_PROC_BROWSER_TEST_P(ImmersiveModeControllerAshWebAppBrowserTest,
FrameLayoutToggleTabletMode) { FrameLayoutToggleTabletMode) {
LaunchAppBrowser(); LaunchAppBrowser();
ASSERT_FALSE(controller()->IsEnabled()); ASSERT_FALSE(controller()->IsEnabled());
...@@ -297,7 +297,7 @@ IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest, ...@@ -297,7 +297,7 @@ IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest,
// Verify that the frame layout for new windows is as expected when using // Verify that the frame layout for new windows is as expected when using
// immersive mode in tablet mode. // immersive mode in tablet mode.
IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest, IN_PROC_BROWSER_TEST_P(ImmersiveModeControllerAshWebAppBrowserTest,
FrameLayoutStartInTabletMode) { FrameLayoutStartInTabletMode) {
// Start in tablet mode // Start in tablet mode
ash::ShellTestApi().SetTabletModeEnabledForTest(true); ash::ShellTestApi().SetTabletModeEnabledForTest(true);
...@@ -324,3 +324,11 @@ IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest, ...@@ -324,3 +324,11 @@ IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest,
ash::ShellTestApi().SetTabletModeEnabledForTest(false); ash::ShellTestApi().SetTabletModeEnabledForTest(false);
VerifyButtonsInImmersiveMode(frame_view); VerifyButtonsInImmersiveMode(frame_view);
} }
INSTANTIATE_TEST_SUITE_P(
/* no prefix */,
ImmersiveModeControllerAshWebAppBrowserTest,
::testing::Values(
web_app::ControllerType::kHostedAppController,
web_app::ControllerType::kUnifiedControllerWithBookmarkApp,
web_app::ControllerType::kUnifiedControllerWithWebApp));
...@@ -6,13 +6,13 @@ ...@@ -6,13 +6,13 @@
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/extensions/browsertest_util.h"
#include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h" #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.h"
#include "chrome/browser/ui/views/web_apps/web_app_frame_toolbar_view.h" #include "chrome/browser/ui/views/web_apps/web_app_frame_toolbar_view.h"
#include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h"
#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_features.h"
#include "chrome/common/web_application_info.h" #include "chrome/common/web_application_info.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
...@@ -31,16 +31,15 @@ class WebAppOpaqueBrowserFrameViewTest : public InProcessBrowserTest { ...@@ -31,16 +31,15 @@ class WebAppOpaqueBrowserFrameViewTest : public InProcessBrowserTest {
bool InstallAndLaunchWebApp( bool InstallAndLaunchWebApp(
base::Optional<SkColor> theme_color = base::nullopt) { base::Optional<SkColor> theme_color = base::nullopt) {
WebApplicationInfo web_app_info; auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info.app_url = GetAppURL(); web_app_info->app_url = GetAppURL();
web_app_info.scope = GetAppURL().GetWithoutFilename(); web_app_info->scope = GetAppURL().GetWithoutFilename();
web_app_info.theme_color = theme_color; web_app_info->theme_color = theme_color;
const extensions::Extension* app = web_app::AppId app_id =
extensions::browsertest_util::InstallBookmarkApp(browser()->profile(), web_app::InstallWebApp(browser()->profile(), std::move(web_app_info));
web_app_info); Browser* app_browser =
Browser* app_browser = extensions::browsertest_util::LaunchAppBrowser( web_app::LaunchWebAppBrowser(browser()->profile(), app_id);
browser()->profile(), app);
views::NonClientFrameView* frame_view = views::NonClientFrameView* frame_view =
BrowserView::GetBrowserViewForBrowser(app_browser) BrowserView::GetBrowserViewForBrowser(app_browser)
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "ash/public/cpp/immersive/immersive_fullscreen_controller_test_api.h" #include "ash/public/cpp/immersive/immersive_fullscreen_controller_test_api.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h"
...@@ -12,23 +11,22 @@ ...@@ -12,23 +11,22 @@
#include "chrome/browser/ui/views/frame/top_container_view.h" #include "chrome/browser/ui/views/frame/top_container_view.h"
#include "chrome/browser/ui/views/web_apps/web_app_frame_toolbar_view.h" #include "chrome/browser/ui/views/web_apps/web_app_frame_toolbar_view.h"
#include "chrome/browser/ui/views/web_apps/web_app_menu_button.h" #include "chrome/browser/ui/views/web_apps/web_app_menu_button.h"
#include "chrome/browser/ui/web_applications/web_app_controller_browsertest.h"
#include "chrome/common/web_application_info.h" #include "chrome/common/web_application_info.h"
#include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/interactive_test_utils.h"
class WebAppAshInteractiveUITest : public extensions::ExtensionBrowserTest { class WebAppAshInteractiveUITest : public web_app::WebAppControllerBrowserTest {
public: public:
WebAppAshInteractiveUITest() = default; WebAppAshInteractiveUITest() = default;
~WebAppAshInteractiveUITest() override = default; ~WebAppAshInteractiveUITest() override = default;
// InProcessBrowserTest override: // InProcessBrowserTest override:
void SetUpOnMainThread() override { void SetUpOnMainThread() override {
WebApplicationInfo web_app_info; auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info.app_url = GURL("https://test.org"); web_app_info->app_url = GURL("https://test.org");
// TODO(alancutter): Use web_app::InstallManager instead of Extensions web_app::AppId app_id = InstallWebApp(std::move(web_app_info));
// specific install path.
const extensions::Extension* app = InstallBookmarkApp(web_app_info);
Browser* browser = ExtensionBrowserTest::LaunchAppBrowser(app); Browser* browser = LaunchWebAppBrowser(app_id);
browser_view_ = BrowserView::GetBrowserViewForBrowser(browser); browser_view_ = BrowserView::GetBrowserViewForBrowser(browser);
controller_ = browser_view_->immersive_mode_controller(); controller_ = browser_view_->immersive_mode_controller();
...@@ -67,12 +65,12 @@ class WebAppAshInteractiveUITest : public extensions::ExtensionBrowserTest { ...@@ -67,12 +65,12 @@ class WebAppAshInteractiveUITest : public extensions::ExtensionBrowserTest {
}; };
// Test that the web app menu button opens a menu on click. // Test that the web app menu button opens a menu on click.
IN_PROC_BROWSER_TEST_F(WebAppAshInteractiveUITest, MenuButtonClickable) { IN_PROC_BROWSER_TEST_P(WebAppAshInteractiveUITest, MenuButtonClickable) {
CheckWebAppMenuClickable(); CheckWebAppMenuClickable();
} }
// Test that the web app menu button opens a menu on click in immersive mode. // Test that the web app menu button opens a menu on click in immersive mode.
IN_PROC_BROWSER_TEST_F(WebAppAshInteractiveUITest, IN_PROC_BROWSER_TEST_P(WebAppAshInteractiveUITest,
ImmersiveMenuButtonClickable) { ImmersiveMenuButtonClickable) {
FullscreenNotificationObserver waiter(browser()); FullscreenNotificationObserver waiter(browser());
chrome::ToggleFullscreenMode(browser()); chrome::ToggleFullscreenMode(browser());
...@@ -84,3 +82,11 @@ IN_PROC_BROWSER_TEST_F(WebAppAshInteractiveUITest, ...@@ -84,3 +82,11 @@ IN_PROC_BROWSER_TEST_F(WebAppAshInteractiveUITest,
CheckWebAppMenuClickable(); CheckWebAppMenuClickable();
} }
INSTANTIATE_TEST_SUITE_P(
/* no prefix */,
WebAppAshInteractiveUITest,
::testing::Values(
web_app::ControllerType::kHostedAppController,
web_app::ControllerType::kUnifiedControllerWithBookmarkApp,
web_app::ControllerType::kUnifiedControllerWithWebApp));
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