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 @@
#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_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/web_app_provider.h"
#include "chrome/common/web_application_info.h"
......@@ -801,17 +802,16 @@ class WebAppNonClientFrameViewAshTest
// |SetUpWebApp()| must be called after |SetUpOnMainThread()| to make sure
// the Network Service process has been setup properly.
void SetUpWebApp() {
WebApplicationInfo web_app_info;
web_app_info.app_url = GetAppURL();
web_app_info.scope = GetAppURL().GetWithoutFilename();
web_app_info.theme_color = GetThemeColor();
// TODO(alancutter): Use web_app::InstallManager instead of Extensions
// specific install path.
const extensions::Extension* app = InstallBookmarkApp(web_app_info);
auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info->app_url = GetAppURL();
web_app_info->scope = GetAppURL().GetWithoutFilename();
web_app_info->theme_color = GetThemeColor();
web_app::AppId app_id =
web_app::InstallWebApp(browser()->profile(), std::move(web_app_info));
content::TestNavigationObserver navigation_observer(GetAppURL());
navigation_observer.StartWatchingNewWebContents();
app_browser_ = LaunchAppBrowser(app);
app_browser_ = web_app::LaunchWebAppBrowser(browser()->profile(), app_id);
navigation_observer.WaitForNavigationFinished();
browser_view_ = BrowserView::GetBrowserViewForBrowser(app_browser_);
......
......@@ -5,7 +5,6 @@
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/browsertest_util.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/themes/theme_service.h"
......@@ -13,6 +12,7 @@
#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/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/system_web_app_manager.h"
#include "chrome/common/web_application_info.h"
......@@ -43,21 +43,21 @@ class BrowserNonClientFrameViewBrowserTest
// 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
// 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(
base::Optional<GURL> app_url = base::nullopt) {
if (!app_url)
app_url = GetAppURL();
WebApplicationInfo web_app_info;
web_app_info.app_url = *app_url;
web_app_info.scope = app_url->GetWithoutFilename();
auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info->app_url = *app_url;
web_app_info->scope = app_url->GetWithoutFilename();
if (app_theme_color_)
web_app_info.theme_color = *app_theme_color_;
web_app_info->theme_color = *app_theme_color_;
const extensions::Extension* app =
extensions::browsertest_util::InstallBookmarkApp(browser()->profile(),
web_app_info);
app_browser_ = extensions::browsertest_util::LaunchAppBrowser(
browser()->profile(), app);
web_app::AppId app_id =
web_app::InstallWebApp(profile(), std::move(web_app_info));
app_browser_ = web_app::LaunchWebAppBrowser(profile(), app_id);
web_contents_ = app_browser_->tab_strip_model()->GetActiveWebContents();
// Ensure the main page has loaded and is ready for ExecJs DOM manipulation.
ASSERT_TRUE(content::NavigateToURL(web_contents_, *app_url));
......
......@@ -4,13 +4,13 @@
#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/ui/browser.h"
#include "chrome/browser/ui/browser_commands.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/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/test/base/in_process_browser_test.h"
#include "content/public/test/test_navigation_observer.h"
......@@ -33,21 +33,17 @@ class WebAppGlassBrowserFrameViewTest : public InProcessBrowserTest {
// TODO(https://crbug.com/863278): Force Aero glass on Windows 7 for this
// test.
bool InstallAndLaunchWebApp() {
WebApplicationInfo web_app_info;
web_app_info.app_url = GetAppURL();
web_app_info.scope = GetAppURL().GetWithoutFilename();
auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info->app_url = GetAppURL();
web_app_info->scope = GetAppURL().GetWithoutFilename();
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
// specific install path.
const extensions::Extension* app =
extensions::browsertest_util::InstallBookmarkApp(browser()->profile(),
web_app_info);
web_app::AppId app_id =
web_app::InstallWebApp(browser()->profile(), std::move(web_app_info));
content::TestNavigationObserver navigation_observer(GetAppURL());
navigation_observer.StartWatchingNewWebContents();
app_browser_ = extensions::browsertest_util::LaunchAppBrowser(
browser()->profile(), app);
app_browser_ = web_app::LaunchWebAppBrowser(browser()->profile(), app_id);
navigation_observer.WaitForNavigationFinished();
browser_view_ = BrowserView::GetBrowserViewForBrowser(app_browser_);
......
......@@ -7,7 +7,6 @@
#include "ash/public/cpp/test/shell_test_api.h"
#include "base/macros.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/ui/ash/tablet_mode_page_behavior.h"
#include "chrome/browser/ui/browser_commands.h"
......@@ -23,6 +22,7 @@
#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_menu_button.h"
#include "chrome/browser/ui/web_applications/web_app_controller_browsertest.h"
#include "chrome/common/web_application_info.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/test/content_mock_cert_verifier.h"
......@@ -32,7 +32,7 @@
#include "ui/views/window/frame_caption_button.h"
class ImmersiveModeControllerAshWebAppBrowserTest
: public extensions::ExtensionBrowserTest {
: public web_app::WebAppControllerBrowserTest {
public:
ImmersiveModeControllerAshWebAppBrowserTest()
: https_server_(net::EmbeddedTestServer::TYPE_HTTPS) {}
......@@ -45,11 +45,11 @@ class ImmersiveModeControllerAshWebAppBrowserTest
https_server_.AddDefaultHandlers(GetChromeTestDataDir());
ASSERT_TRUE(https_server_.Start());
WebApplicationInfo web_app_info;
web_app_info.app_url = GetAppUrl();
web_app_info.theme_color = SK_ColorBLUE;
auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info->app_url = GetAppUrl();
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"); }
......@@ -57,7 +57,8 @@ class ImmersiveModeControllerAshWebAppBrowserTest
void LaunchAppBrowser(bool wait = true) {
ui_test_utils::UrlLoadObserver url_observer(
GetAppUrl(), content::NotificationService::AllSources());
browser_ = ExtensionBrowserTest::LaunchAppBrowser(app_);
browser_ = LaunchWebAppBrowser(app_id);
if (wait) {
// Wait for the URL to load so that the location bar end-state stabilizes.
url_observer.Wait();
......@@ -131,8 +132,7 @@ class ImmersiveModeControllerAshWebAppBrowserTest
}
private:
// Not owned.
const extensions::Extension* app_ = nullptr;
web_app::AppId app_id;
Browser* browser_ = nullptr;
ImmersiveModeController* controller_ = nullptr;
......@@ -148,7 +148,7 @@ class ImmersiveModeControllerAshWebAppBrowserTest
// Test the layout and visibility of the TopContainerView and web contents when
// a web app is put into immersive fullscreen.
IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest, Layout) {
IN_PROC_BROWSER_TEST_P(ImmersiveModeControllerAshWebAppBrowserTest, Layout) {
LaunchAppBrowser();
TabStrip* tabstrip = browser_view()->tabstrip();
ToolbarView* toolbar = browser_view()->toolbar();
......@@ -207,7 +207,7 @@ IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest, Layout) {
// Verify the immersive mode status is as expected in tablet mode (titlebars are
// autohidden in tablet mode).
IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest,
IN_PROC_BROWSER_TEST_P(ImmersiveModeControllerAshWebAppBrowserTest,
ImmersiveModeStatusTabletMode) {
LaunchAppBrowser();
ASSERT_FALSE(controller()->IsEnabled());
......@@ -258,7 +258,7 @@ IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest,
// Verify that the frame layout is as expected when using immersive mode in
// tablet mode.
IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest,
IN_PROC_BROWSER_TEST_P(ImmersiveModeControllerAshWebAppBrowserTest,
FrameLayoutToggleTabletMode) {
LaunchAppBrowser();
ASSERT_FALSE(controller()->IsEnabled());
......@@ -297,7 +297,7 @@ IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest,
// Verify that the frame layout for new windows is as expected when using
// immersive mode in tablet mode.
IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest,
IN_PROC_BROWSER_TEST_P(ImmersiveModeControllerAshWebAppBrowserTest,
FrameLayoutStartInTabletMode) {
// Start in tablet mode
ash::ShellTestApi().SetTabletModeEnabledForTest(true);
......@@ -324,3 +324,11 @@ IN_PROC_BROWSER_TEST_F(ImmersiveModeControllerAshWebAppBrowserTest,
ash::ShellTestApi().SetTabletModeEnabledForTest(false);
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 @@
#include "base/test/scoped_feature_list.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_factory.h"
#include "chrome/browser/ui/browser.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/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/web_application_info.h"
#include "chrome/test/base/in_process_browser_test.h"
......@@ -31,16 +31,15 @@ class WebAppOpaqueBrowserFrameViewTest : public InProcessBrowserTest {
bool InstallAndLaunchWebApp(
base::Optional<SkColor> theme_color = base::nullopt) {
WebApplicationInfo web_app_info;
web_app_info.app_url = GetAppURL();
web_app_info.scope = GetAppURL().GetWithoutFilename();
web_app_info.theme_color = theme_color;
const extensions::Extension* app =
extensions::browsertest_util::InstallBookmarkApp(browser()->profile(),
web_app_info);
Browser* app_browser = extensions::browsertest_util::LaunchAppBrowser(
browser()->profile(), app);
auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info->app_url = GetAppURL();
web_app_info->scope = GetAppURL().GetWithoutFilename();
web_app_info->theme_color = theme_color;
web_app::AppId app_id =
web_app::InstallWebApp(browser()->profile(), std::move(web_app_info));
Browser* app_browser =
web_app::LaunchWebAppBrowser(browser()->profile(), app_id);
views::NonClientFrameView* frame_view =
BrowserView::GetBrowserViewForBrowser(app_browser)
......
......@@ -3,13 +3,13 @@
// found in the LICENSE file.
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/renderer_context_menu/render_view_context_menu_test_util.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/browser/ui/web_applications/web_app_controller_browsertest.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/web_application_info.h"
#include "chrome/test/base/in_process_browser_test.h"
......@@ -163,7 +163,8 @@ class UrlHidingWebContentsObserver : public content::WebContentsObserver {
} // namespace
class CustomTabBarViewBrowserTest : public extensions::ExtensionBrowserTest {
class CustomTabBarViewBrowserTest
: public web_app::WebAppControllerBrowserTest {
public:
CustomTabBarViewBrowserTest()
: https_server_(net::EmbeddedTestServer::TYPE_HTTPS) {}
......@@ -171,17 +172,17 @@ class CustomTabBarViewBrowserTest : public extensions::ExtensionBrowserTest {
protected:
void SetUpInProcessBrowserTestFixture() override {
extensions::ExtensionBrowserTest::SetUpInProcessBrowserTestFixture();
web_app::WebAppControllerBrowserTest::SetUpInProcessBrowserTestFixture();
cert_verifier_.SetUpInProcessBrowserTestFixture();
}
void TearDownInProcessBrowserTestFixture() override {
extensions::ExtensionBrowserTest::TearDownInProcessBrowserTestFixture();
web_app::WebAppControllerBrowserTest::TearDownInProcessBrowserTestFixture();
cert_verifier_.TearDownInProcessBrowserTestFixture();
}
void SetUpCommandLine(base::CommandLine* command_line) override {
extensions::ExtensionBrowserTest::SetUpCommandLine(command_line);
web_app::WebAppControllerBrowserTest::SetUpCommandLine(command_line);
// Browser will both run and display insecure content.
command_line->AppendSwitch(switches::kAllowRunningInsecureContent);
cert_verifier_.SetUpCommandLine(command_line);
......@@ -202,18 +203,18 @@ class CustomTabBarViewBrowserTest : public extensions::ExtensionBrowserTest {
}
void InstallPWA(const GURL& app_url) {
WebApplicationInfo web_app_info;
web_app_info.app_url = app_url;
web_app_info.scope = app_url.GetWithoutFilename();
web_app_info.open_as_window = true;
Install(web_app_info);
auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info->app_url = app_url;
web_app_info->scope = app_url.GetWithoutFilename();
web_app_info->open_as_window = true;
Install(std::move(web_app_info));
}
void InstallBookmark(const GURL& app_url) {
WebApplicationInfo web_app_info;
web_app_info.app_url = app_url;
web_app_info.open_as_window = true;
Install(web_app_info);
auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info->app_url = app_url;
web_app_info->open_as_window = true;
Install(std::move(web_app_info));
}
Browser* app_browser_;
......@@ -225,12 +226,13 @@ class CustomTabBarViewBrowserTest : public extensions::ExtensionBrowserTest {
net::EmbeddedTestServer* https_server() { return &https_server_; }
private:
void Install(const WebApplicationInfo& web_app_info) {
auto* app = InstallBookmarkApp(web_app_info);
void Install(std::unique_ptr<WebApplicationInfo> web_app_info) {
const GURL app_url = web_app_info->app_url;
web_app::AppId app_id = InstallWebApp(std::move(web_app_info));
ui_test_utils::UrlLoadObserver url_observer(
web_app_info.app_url, content::NotificationService::AllSources());
app_browser_ = LaunchAppBrowser(app);
app_url, content::NotificationService::AllSources());
app_browser_ = LaunchWebAppBrowser(app_id);
url_observer.Wait();
DCHECK(app_browser_);
......@@ -249,14 +251,14 @@ class CustomTabBarViewBrowserTest : public extensions::ExtensionBrowserTest {
};
// Check the custom tab bar is not instantiated for a tabbed browser window.
IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
IsNotCreatedInTabbedBrowser) {
EXPECT_TRUE(browser_view_->IsBrowserTypeNormal());
EXPECT_FALSE(custom_tab_bar_);
}
// Check the custom tab bar is not instantiated for a popup window.
IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest, IsNotCreatedInPopup) {
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, IsNotCreatedInPopup) {
Browser* popup = OpenPopup(browser_view_->GetActiveWebContents(),
GURL("http://example.com"));
EXPECT_TRUE(popup);
......@@ -272,7 +274,7 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest, IsNotCreatedInPopup) {
EXPECT_FALSE(popup_view->toolbar()->custom_tab_bar());
}
IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
BackToAppButtonIsNotVisibleInOutOfScopePopups) {
ASSERT_TRUE(https_server()->Start());
......@@ -298,7 +300,7 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
}
// Check the custom tab will be used for a Desktop PWA.
IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest, IsUsedForDesktopPWA) {
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, IsUsedForDesktopPWA) {
ASSERT_TRUE(https_server()->Start());
ASSERT_TRUE(embedded_test_server()->Start());
......@@ -318,7 +320,7 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest, IsUsedForDesktopPWA) {
// The custom tab bar should update with the title and location of the current
// page.
IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest, TitleAndLocationUpdate) {
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, TitleAndLocationUpdate) {
ASSERT_TRUE(https_server()->Start());
const GURL& app_url = https_server()->GetURL("app.com", "/ssl/google.html");
......@@ -346,7 +348,7 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest, TitleAndLocationUpdate) {
}
// If the page doesn't specify a title, we should use the origin.
IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
UsesLocationInsteadOfEmptyTitles) {
ASSERT_TRUE(https_server()->Start());
......@@ -368,7 +370,7 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
}
// Closing the CCT should take you back to the last in scope url.
IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
OutOfScopeUrlShouldBeClosable) {
ASSERT_TRUE(https_server()->Start());
......@@ -407,7 +409,7 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
#else
#define MAYBE_RightClickMenuShowsCopyUrl RightClickMenuShowsCopyUrl
#endif
IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
MAYBE_RightClickMenuShowsCopyUrl) {
ASSERT_TRUE(https_server()->Start());
......@@ -440,7 +442,7 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
// Paths above the launch url should be out of scope and should be closable from
// the CustomTabBar.
IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
ScopeAboveLaunchURLShouldBeOutOfScopeAndClosable) {
ASSERT_TRUE(https_server()->Start());
......@@ -476,7 +478,7 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
// When there are no in scope urls to navigate back to, closing the custom tab
// bar should navigate to the app's launch url.
IN_PROC_BROWSER_TEST_F(
IN_PROC_BROWSER_TEST_P(
CustomTabBarViewBrowserTest,
WhenNoHistoryIsInScopeCloseShouldNavigateToAppLaunchURL) {
ASSERT_TRUE(https_server()->Start());
......@@ -509,7 +511,7 @@ IN_PROC_BROWSER_TEST_F(
EXPECT_EQ(app_url, web_contents->GetLastCommittedURL());
}
IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
OriginsWithEmojiArePunyCoded) {
ASSERT_TRUE(https_server()->Start());
......@@ -532,7 +534,7 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
app_view->toolbar()->custom_tab_bar()->title_for_testing());
}
IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
OriginsWithNonASCIICharactersDisplayNormally) {
ASSERT_TRUE(https_server()->Start());
......@@ -555,7 +557,7 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
app_view->toolbar()->custom_tab_bar()->title_for_testing());
}
IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
BackToAppButtonIsNotVisibleInScope) {
ASSERT_TRUE(embedded_test_server()->Start());
ASSERT_TRUE(https_server()->Start());
......@@ -607,7 +609,7 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
->GetVisible());
}
IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest,
BackToAppButtonIsNotVisibleInBookmarkAppOnOrigin) {
ASSERT_TRUE(embedded_test_server()->Start());
ASSERT_TRUE(https_server()->Start());
......@@ -641,7 +643,7 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest,
}
// Verify that interstitials that hide origin have their preference respected.
IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest, InterstitialCanHideOrigin) {
IN_PROC_BROWSER_TEST_P(CustomTabBarViewBrowserTest, InterstitialCanHideOrigin) {
ASSERT_TRUE(embedded_test_server()->Start());
ASSERT_TRUE(https_server()->Start());
......@@ -673,3 +675,9 @@ IN_PROC_BROWSER_TEST_F(CustomTabBarViewBrowserTest, InterstitialCanHideOrigin) {
EXPECT_TRUE(
app_view->toolbar()->custom_tab_bar()->IsShowingOriginForTesting());
}
// TODO(crbug.com/966290): Support kUnifiedControllerWithWebApp/BookmarkApp
INSTANTIATE_TEST_SUITE_P(
/* no prefix */,
CustomTabBarViewBrowserTest,
::testing::Values(web_app::ControllerType::kHostedAppController));
......@@ -3,7 +3,6 @@
// found in the LICENSE file.
#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/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h"
......@@ -12,23 +11,22 @@
#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_menu_button.h"
#include "chrome/browser/ui/web_applications/web_app_controller_browsertest.h"
#include "chrome/common/web_application_info.h"
#include "chrome/test/base/interactive_test_utils.h"
class WebAppAshInteractiveUITest : public extensions::ExtensionBrowserTest {
class WebAppAshInteractiveUITest : public web_app::WebAppControllerBrowserTest {
public:
WebAppAshInteractiveUITest() = default;
~WebAppAshInteractiveUITest() override = default;
// InProcessBrowserTest override:
void SetUpOnMainThread() override {
WebApplicationInfo web_app_info;
web_app_info.app_url = GURL("https://test.org");
// TODO(alancutter): Use web_app::InstallManager instead of Extensions
// specific install path.
const extensions::Extension* app = InstallBookmarkApp(web_app_info);
auto web_app_info = std::make_unique<WebApplicationInfo>();
web_app_info->app_url = GURL("https://test.org");
web_app::AppId app_id = InstallWebApp(std::move(web_app_info));
Browser* browser = ExtensionBrowserTest::LaunchAppBrowser(app);
Browser* browser = LaunchWebAppBrowser(app_id);
browser_view_ = BrowserView::GetBrowserViewForBrowser(browser);
controller_ = browser_view_->immersive_mode_controller();
......@@ -67,12 +65,12 @@ class WebAppAshInteractiveUITest : public extensions::ExtensionBrowserTest {
};
// 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();
}
// 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) {
FullscreenNotificationObserver waiter(browser());
chrome::ToggleFullscreenMode(browser());
......@@ -84,3 +82,11 @@ IN_PROC_BROWSER_TEST_F(WebAppAshInteractiveUITest,
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