diff --git a/browser/ui/views/brave_views_delegate_linux_browsertest.cc b/browser/ui/views/brave_views_delegate_linux_browsertest.cc index 499675257933..dfd86d48f8a0 100644 --- a/browser/ui/views/brave_views_delegate_linux_browsertest.cc +++ b/browser/ui/views/brave_views_delegate_linux_browsertest.cc @@ -11,15 +11,8 @@ using BraveViewsDelegateViewLinuxBrowserTest = InProcessBrowserTest; -IN_PROC_BROWSER_TEST_F(BraveViewsDelegateViewLinuxBrowserTest, GetDefaultWindowIconTest) { - // In test, our BraveViewsDelegateLinux isn't set because ChromeViewsDelegate is set - // at the very early state by AccessibilityChecker(subclass of ChromeViewsDelegate) - // in ctor of InProcessBrowserTest. Introduced in v68. - // To have a test, explicitly set views delegate by initializing here. - // This is only effective in release mode because initializing views delegate twice isn't - // allowed by dcheck. - BraveViewsDelegateLinux brave_views_delegate; - +IN_PROC_BROWSER_TEST_F(BraveViewsDelegateViewLinuxBrowserTest, + GetDefaultWindowIconTest) { auto env = base::Environment::Create(); views::ViewsDelegate* views_delegate = views::ViewsDelegate::GetInstance(); auto& rb = ui::ResourceBundle::GetSharedInstance(); @@ -41,9 +34,7 @@ IN_PROC_BROWSER_TEST_F(BraveViewsDelegateViewLinuxBrowserTest, GetDefaultWindowI EXPECT_EQ(rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_128_NIGHTLY)->bitmap(), views_delegate->GetDefaultWindowIcon()->bitmap()); #else // OFFICIAL_BUILD - // TODO(simonhong): Enable this test in debug mode. EXPECT_EQ(rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_128_DEVELOPMENT)->bitmap(), views_delegate->GetDefaultWindowIcon()->bitmap()); #endif } - diff --git a/chromium_src/chrome/test/views/accessibility_checker.h b/chromium_src/chrome/test/views/accessibility_checker.h new file mode 100644 index 000000000000..3846069b2d90 --- /dev/null +++ b/chromium_src/chrome/test/views/accessibility_checker.h @@ -0,0 +1,20 @@ +/* Copyright (c) 2019 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_CHROMIUM_SRC_CHROME_TEST_VIEWS_ACCESSIBILITY_CHECKER_H_ +#define BRAVE_CHROMIUM_SRC_CHROME_TEST_VIEWS_ACCESSIBILITY_CHECKER_H_ + +#include "chrome/browser/ui/views/chrome_views_delegate.h" + +#if defined(OS_LINUX) +#include "brave/browser/ui/views/brave_views_delegate_linux.h" +#define ChromeViewsDelegate BraveViewsDelegateLinux +#endif +#include "../../../../../chrome/test/views/accessibility_checker.h" +#if defined(OS_LINUX) +#undef ChromeViewsDelegate +#endif + +#endif // BRAVE_CHROMIUM_SRC_CHROME_TEST_VIEWS_ACCESSIBILITY_CHECKER_H_ diff --git a/test/BUILD.gn b/test/BUILD.gn index 84b5868682c1..c86b7ca4b5db 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -442,9 +442,8 @@ test("brave_browser_tests") { "//chrome/browser/extensions/extension_apitest.h", ] - if (is_linux && is_official_build) { + if (is_linux) { sources += [ - # BraveViewsDelegateLinuxBrowserTest only works in release(official) build. "//brave/browser/ui/views/brave_views_delegate_linux_browsertest.cc", ] configs += [