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
28 lines
1.0 KiB
C++
28 lines
1.0 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 http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "base/environment.h"
|
|
#include "build/build_config.h"
|
|
#include "chrome/common/channel_info.h"
|
|
#include "chrome/test/base/platform_browser_test.h"
|
|
#include "components/version_info/channel.h"
|
|
#include "content/public/test/browser_test.h"
|
|
|
|
using BraveChannelInfoBrowserTest = PlatformBrowserTest;
|
|
|
|
IN_PROC_BROWSER_TEST_F(BraveChannelInfoBrowserTest, DefaultChannelTest) {
|
|
#if defined(OFFICIAL_BUILD)
|
|
#if BUILDFLAG(IS_LINUX)
|
|
// Set channel info explicitly to test. Linux uses this env vars to determine
|
|
// which channel is used.
|
|
auto env = base::Environment::Create();
|
|
env->SetVar("CHROME_VERSION_EXTRA", "stable");
|
|
#endif
|
|
EXPECT_NE(version_info::Channel::UNKNOWN, chrome::GetChannel());
|
|
#else
|
|
EXPECT_EQ(version_info::Channel::UNKNOWN, chrome::GetChannel());
|
|
#endif
|
|
}
|