Files
brave-core/browser/brave_resources_browsertest.cc
Claudio DeSouza 5c534844a8 PlatformBrowserTest in new header
This new header is supposed to simplify the inclusion of
`PlatformBrowserTest` for android/non-android tests.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/dbf91b261f7a99ae7937eecc7ce2871feeb20c0b

commit dbf91b261f7a99ae7937eecc7ce2871feeb20c0b
Author: Devlin Cronin <rdevlin.cronin@chromium.org>
Date:   Thu Aug 22 22:35:56 2024 +0000

    Move PlatformBrowserTest alias to platform_browser_test.h

    Currently, every test leveraging PlatformBrowserTest should include
    the following if-def block:

    ```
    #if BUILDFLAG(IS_ANDROID)
    #include "chrome/test/base/android/android_browser_test.h"
    #else
    #include "chrome/test/base/in_process_browser_test.h"
    #endif
    ```

    And, in turn, PlatformBrowserTest is an alias for either
    AndroidBrowserTest or InProcessBrowserTest, as defined in each of
    those files.

    This makes for a lot of boilerplate, and instead we can just move
    that if-def'd alias to a single file, platform_browser_test.h, that
    each class can include.

    This CL makes the following changes:
    - Updates any sites that previously included that if-def block to just
      include platform_browser_test.h
    - Fixes many IWYU cases where classes were not properly including any
      header file
    - `git cl format` (which fixes a few cases of improper header sorting)

    Bug: 361002665
2024-10-03 17:06:17 +01:00

33 lines
1.2 KiB
C++

/* Copyright (c) 2020 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 https://mozilla.org/MPL/2.0/. */
#include "brave/grit/brave_theme_resources.h"
#include "brave/grit/brave_unscaled_resources.h"
#include "build/build_config.h"
#include "chrome/test/base/platform_browser_test.h"
#include "content/public/test/browser_test.h"
#include "ui/base/resource/resource_bundle.h"
using BraveResourcesBrowserTest = PlatformBrowserTest;
// Check brave's theme resources pacakges are properly added.
IN_PROC_BROWSER_TEST_F(PlatformBrowserTest, ResourceExistanceTest) {
gfx::Image test_image =
ui::ResourceBundle::GetSharedInstance().GetImageNamed(
IDR_PRODUCT_LOGO_32_DEV);
EXPECT_FALSE(test_image.IsEmpty());
#if BUILDFLAG(IS_LINUX)
test_image =
ui::ResourceBundle::GetSharedInstance().GetImageNamed(
IDR_PRODUCT_LOGO_128_BETA);
EXPECT_FALSE(test_image.IsEmpty());
test_image =
ui::ResourceBundle::GetSharedInstance().GetImageNamed(
IDR_PRODUCT_LOGO_128_DEV);
EXPECT_FALSE(test_image.IsEmpty());
#endif
}