Commit 098904ec authored by Sergey Poromov's avatar Sergey Poromov Committed by Chromium LUCI CQ

Revert "Add dark mode focus ring browsertests"

This reverts commit 78eb032e.

Reason for revert: 
The test is consistently failing on Mac 10.15 and 10.14.
First failures:
https://ci.chromium.org/ui/p/chromium/builders/ci/Mac10.15%20Tests/6926/overview
https://ci.chromium.org/ui/p/chromium/builders/ci/Mac10.14%20Tests/11879/overview

Original change's description:
> Add dark mode focus ring browsertests
>
> Focus rings are rendered differently in dark mode, so we need additional
> pixel tests for dark mode.
>
> Fixed: 1067517
> Change-Id: I94ba8b86a03943b7d30cddd44a30ac2cc380e0ff
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2596019
> Reviewed-by: Avi Drissman <avi@chromium.org>
> Reviewed-by: Yu Han <yuzhehan@chromium.org>
> Reviewed-by: Mason Freed <masonfreed@chromium.org>
> Commit-Queue: Joey Arhar <jarhar@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#839189}

TBR=avi@chromium.org,masonfreed@chromium.org,jarhar@chromium.org,chromium-scoped@luci-project-accounts.iam.gserviceaccount.com,yuzhehan@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I18cd9fbab4531d6811ad095f7938bbf8158d1f01
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2603569Reviewed-by: default avatarSergey Poromov <poromov@chromium.org>
Commit-Queue: Sergey Poromov <poromov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#839445}
parent 5878a9bf
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "build/chromeos_buildflags.h" #include "build/chromeos_buildflags.h"
#include "cc/test/pixel_comparator.h" #include "cc/test/pixel_comparator.h"
#include "chrome/browser/focus_ring_browsertest_mac.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
...@@ -18,7 +17,6 @@ ...@@ -18,7 +17,6 @@
#include "content/public/test/browser_test.h" #include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h" #include "content/public/test/browser_test_utils.h"
#include "ui/base/ui_base_features.h" #include "ui/base/ui_base_features.h"
#include "ui/base/ui_base_switches.h"
// TODO(crbug.com/958242): Move the baselines to skia gold for easier // TODO(crbug.com/958242): Move the baselines to skia gold for easier
// rebaselining when all platforms are supported // rebaselining when all platforms are supported
...@@ -55,9 +53,7 @@ const cc::FuzzyPixelComparator mac_loose_comparator( ...@@ -55,9 +53,7 @@ const cc::FuzzyPixelComparator mac_loose_comparator(
class FocusRingBrowserTest : public InProcessBrowserTest { class FocusRingBrowserTest : public InProcessBrowserTest {
public: public:
FocusRingBrowserTest() { FocusRingBrowserTest() {
feature_list_.InitWithFeatures( feature_list_.InitWithFeatures({features::kFormControlsRefresh}, {});
{features::kFormControlsRefresh, features::kCSSColorSchemeUARendering},
{});
} }
void SetUp() override { void SetUp() override {
...@@ -71,9 +67,6 @@ class FocusRingBrowserTest : public InProcessBrowserTest { ...@@ -71,9 +67,6 @@ class FocusRingBrowserTest : public InProcessBrowserTest {
// The --disable-lcd-text flag helps text render more similarly on // The --disable-lcd-text flag helps text render more similarly on
// different bots and platform. // different bots and platform.
command_line->AppendSwitch(switches::kDisableLCDText); command_line->AppendSwitch(switches::kDisableLCDText);
// This is required to allow dark mode to be used on some platforms.
command_line->AppendSwitch(switches::kForceDarkMode);
} }
void RunTest(const std::string& screenshot_filename, void RunTest(const std::string& screenshot_filename,
...@@ -84,7 +77,6 @@ class FocusRingBrowserTest : public InProcessBrowserTest { ...@@ -84,7 +77,6 @@ class FocusRingBrowserTest : public InProcessBrowserTest {
base::ScopedAllowBlockingForTesting allow_blocking; base::ScopedAllowBlockingForTesting allow_blocking;
ASSERT_TRUE(features::IsFormControlsRefreshEnabled()); ASSERT_TRUE(features::IsFormControlsRefreshEnabled());
ASSERT_TRUE(features::IsCSSColorSchemeUARenderingEnabled());
base::FilePath dir_test_data; base::FilePath dir_test_data;
ASSERT_TRUE(base::PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data)); ASSERT_TRUE(base::PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data));
...@@ -111,7 +103,8 @@ class FocusRingBrowserTest : public InProcessBrowserTest { ...@@ -111,7 +103,8 @@ class FocusRingBrowserTest : public InProcessBrowserTest {
content::WebContents* web_contents = content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents(); browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(content::NavigateToURL( ASSERT_TRUE(content::NavigateToURL(
web_contents, GURL("data:text/html,<!DOCTYPE html>" + body_html))); web_contents,
GURL("data:text/html,<!DOCTYPE html><body>" + body_html + "</body>")));
ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
EXPECT_TRUE(CompareWebContentsOutputToReference( EXPECT_TRUE(CompareWebContentsOutputToReference(
...@@ -181,21 +174,3 @@ IN_PROC_BROWSER_TEST_F(FocusRingBrowserTest, Anchor) { ...@@ -181,21 +174,3 @@ IN_PROC_BROWSER_TEST_F(FocusRingBrowserTest, Anchor) {
/* screenshot_width */ 90, /* screenshot_width */ 90,
/* screenshot_height */ 130, comparator); /* screenshot_height */ 130, comparator);
} }
IN_PROC_BROWSER_TEST_F(FocusRingBrowserTest, DarkModeButton) {
#if defined(OS_MAC)
if (!MacOSVersionSupportsDarkMode())
return;
cc::FuzzyPixelComparator comparator = mac_strict_comparator;
#else
cc::ExactPixelComparator comparator(/*discard_alpha=*/true);
#endif
RunTest("focus_ring_browsertest_dark_mode_button",
"<meta name=\"color-scheme\" content=\"light dark\">"
"<button autofocus style=\"width:40px;height:20px;\"></button>"
"<br>"
"<br>"
"<button style=\"width:40px;height:20px;\"></button>",
/* screenshot_width */ 80,
/* screenshot_height */ 80, comparator);
}
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_FOCUS_RING_BROWSERTEST_MAC_H_
#define CHROME_BROWSER_FOCUS_RING_BROWSERTEST_MAC_H_
bool MacOSVersionSupportsDarkMode();
#endif // CHROME_BROWSER_FOCUS_RING_BROWSERTEST_MAC_H_
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/focus_ring_browsertest_mac.h"
bool MacOSVersionSupportsDarkMode() {
if (@available(macOS 10.14, *))
return true;
return false;
}
...@@ -6795,8 +6795,6 @@ if (!is_android) { ...@@ -6795,8 +6795,6 @@ if (!is_android) {
sources += [ sources += [
"../browser/apps/platform_apps/app_shim_interactive_uitest_mac.mm", "../browser/apps/platform_apps/app_shim_interactive_uitest_mac.mm",
"../browser/apps/platform_apps/app_shim_quit_interactive_uitest_mac.mm", "../browser/apps/platform_apps/app_shim_quit_interactive_uitest_mac.mm",
"../browser/focus_ring_browsertest_mac.h",
"../browser/focus_ring_browsertest_mac.mm",
"../browser/global_keyboard_shortcuts_mac_browsertest.mm", "../browser/global_keyboard_shortcuts_mac_browsertest.mm",
"../browser/notifications/notification_interactive_uitest_mac.mm", "../browser/notifications/notification_interactive_uitest_mac.mm",
"../browser/spellchecker/spellcheck_mac_view_interactive_uitest.mm", "../browser/spellchecker/spellcheck_mac_view_interactive_uitest.mm",
......
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