Commit 3e2b2d9a authored by Alan Cutter's avatar Alan Cutter Committed by Commit Bot

Fix broken HostedAppOpaqueBrowserFrameViewTest tests

When https://chromium-review.googlesource.com/c/chromium/src/+/1307032
landed these tests started failing on developer machines because the
default was to use the GTK theme. This was not caught because on trybots
the default is not to use the GTK theme (see
GtkUi::GetDefaultUsesSystemTheme()).

This CL fixes the tests by explicitly enabling/disabling GTK as appropriate.

Bug: 896146
Change-Id: I75fe33105f0478dcd9d06164041b7b4f2b6e4de0
Reviewed-on: https://chromium-review.googlesource.com/c/1314017
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606296}
parent c438e991
......@@ -27,6 +27,8 @@ class HostedAppOpaqueBrowserFrameViewTest : public InProcessBrowserTest {
static GURL GetAppURL() { return GURL("https://test.org"); }
void SetUpOnMainThread() override { SetThemeMode(ThemeMode::kDefault); }
bool InstallAndLaunchHostedApp(
base::Optional<SkColor> theme_color = base::nullopt) {
WebApplicationInfo web_app_info;
......@@ -71,6 +73,22 @@ class HostedAppOpaqueBrowserFrameViewTest : public InProcessBrowserTest {
return opaque_browser_frame_view_->layout()->NonClientTopHeight(true);
}
enum class ThemeMode {
kSystem,
kDefault,
};
void SetThemeMode(ThemeMode theme_mode) {
ThemeService* theme_service =
ThemeServiceFactory::GetForProfile(browser()->profile());
if (theme_mode == ThemeMode::kSystem)
theme_service->UseSystemTheme();
else
theme_service->UseDefaultTheme();
ASSERT_EQ(theme_service->UsingDefaultTheme(),
theme_mode == ThemeMode::kDefault);
}
OpaqueBrowserFrameView* opaque_browser_frame_view_ = nullptr;
HostedAppButtonContainer* hosted_app_button_container_ = nullptr;
......@@ -87,10 +105,7 @@ IN_PROC_BROWSER_TEST_F(HostedAppOpaqueBrowserFrameViewTest, NoThemeColor) {
#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
IN_PROC_BROWSER_TEST_F(HostedAppOpaqueBrowserFrameViewTest, SystemThemeColor) {
ThemeService* theme_service =
ThemeServiceFactory::GetForProfile(browser()->profile());
theme_service->UseSystemTheme();
ASSERT_TRUE(theme_service->UsingSystemTheme());
SetThemeMode(ThemeMode::kSystem);
ASSERT_TRUE(InstallAndLaunchHostedApp(SK_ColorBLACK));
EXPECT_EQ(hosted_app_button_container_->active_color_for_testing(),
......
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