Skip to content

Commit

Permalink
Refactor OS_LINUX preprocessor directive for LaCrOS effort.
Browse files Browse the repository at this point in the history
Currently, ChromeOS defines the OS_LINUX directive as well as
OS_CHROMEOS.  We're working to separate these two, so we're
making the fact that OS_LINUX == OS_LINUX || OS_CHROMEOS
explicit.

Bug: 1110266
Change-Id: Ibf45218c1ba6a609714ba80ee2d7bae28e929f36
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352689
Reviewed-by: Yuri Wiitala <miu@chromium.org>
Reviewed-by: Michael Spang <spang@chromium.org>
Reviewed-by: Jonathan Backer <backer@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Trent Apted <tapted@chromium.org>
Reviewed-by: Ken Rockot <rockot@google.com>
Commit-Queue: Sean McAllister <smcallis@google.com>
Cr-Commit-Position: refs/heads/master@{#799767}
  • Loading branch information
smcallis authored and Commit Bot committed Aug 19, 2020
1 parent 57884e9 commit 8270041
Show file tree
Hide file tree
Showing 42 changed files with 102 additions and 95 deletions.
2 changes: 1 addition & 1 deletion apps/app_restore_service_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, FileAccessIsSavedToPrefs) {
}

// Flaky: crbug.com/269613
#if defined(OS_LINUX) || defined(OS_WIN)
#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_WIN)
#define MAYBE_FileAccessIsRestored DISABLED_FileAccessIsRestored
#else
#define MAYBE_FileAccessIsRestored FileAccessIsRestored
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/apps/platform_apps/app_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
}

// Failing on some Win and Linux buildbots. See crbug.com/354425.
#if defined(OS_WIN) || defined(OS_LINUX)
#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS)
#define MAYBE_Iframes DISABLED_Iframes
#else
#define MAYBE_Iframes Iframes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowAPITest, DISABLED_TestRestoreAfterClose) {
}

// These tests will be flaky in Linux as window bounds change asynchronously.
#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
#define MAYBE_TestDeprecatedBounds DISABLED_TestDeprecatedBounds
#define MAYBE_TestInitialBounds DISABLED_TestInitialBounds
#define MAYBE_TestInitialConstraints DISABLED_TestInitialConstraints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest,
// Those tests should be disabled on Linux GTK when they are enabled on the
// other platforms, see http://crbug.com/328829.
// Flaky failures on Windows; see https://crbug.com/788283.
#if (defined(OS_LINUX) && defined(USE_AURA)) || defined(OS_MAC) || \
defined(OS_WIN)
#if ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(USE_AURA)) || \
defined(OS_MAC) || defined(OS_WIN)
#define MAYBE_TestCreate DISABLED_TestCreate
#else
#define MAYBE_TestCreate TestCreate
Expand All @@ -361,8 +361,8 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, MAYBE_TestCreate) {
// ::Show() because of Cocoa conventions. See http://crbug.com/326987
// Those tests should be disabled on Linux GTK when they are enabled on the
// other platforms, see http://crbug.com/328829
#if (defined(OS_LINUX) && defined(USE_AURA)) || defined(OS_WIN) || \
defined(OS_MAC)
#if ((defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(USE_AURA)) || \
defined(OS_WIN) || defined(OS_MAC)
#define MAYBE_TestShow DISABLED_TestShow
#else
#define MAYBE_TestShow TestShow
Expand Down Expand Up @@ -423,7 +423,7 @@ IN_PROC_BROWSER_TEST_F(AppWindowInteractiveTest, MAYBE_TestFullscreen) {
}

// Only Linux and Windows use keep-alive to determine when to shut down.
#if defined(OS_LINUX) || defined(OS_WIN)
#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_WIN)

// In general, hidden windows should not keep Chrome alive. The exception is
// when windows are created hidden, we allow the app some time to show the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,8 @@ TEST_F(MediaNotificationServiceTest, DismissesMediaSession) {
}

// TODO(https://crbug.com/1034406) Flaky on Mac10.12, Linux and Win10.
#if defined(OS_MAC) || defined(OS_LINUX) || defined(OS_WIN)
#if defined(OS_MAC) || defined(OS_LINUX) || defined(OS_CHROMEOS) || \
defined(OS_WIN)
#define MAYBE_CountCastSessionsAsActive DISABLED_CountCastSessionsAsActive
#else
#define MAYBE_CountCastSessionsAsActive CountCastSessionsAsActive
Expand Down
3 changes: 2 additions & 1 deletion chrome/browser/ui/startup/startup_browser_creator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ bool IsSilentLaunchEnabled(const base::CommandLine& command_line,
// true, send a warning if guest mode is requested but not allowed by policy.
bool IsGuestModeEnforced(const base::CommandLine& command_line,
bool show_warning) {
#if defined(OS_LINUX) || defined(OS_WIN) || defined(OS_MAC)
#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_WIN) || \
defined(OS_MAC)
PrefService* service = g_browser_process->local_state();
DCHECK(service);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1336,13 +1336,15 @@ void StartupBrowserCreatorFirstRunTest::SetUpCommandLine(
}

void StartupBrowserCreatorFirstRunTest::SetUpInProcessBrowserTestFixture() {
#if defined(OS_LINUX) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && \
BUILDFLAG(GOOGLE_CHROME_BRANDING)
// Set a policy that prevents the first-run dialog from being shown.
policy_map_.Set(policy::key::kMetricsReportingEnabled,
policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
policy::POLICY_SOURCE_CLOUD, base::Value(false), nullptr);
provider_.UpdateChromePolicy(policy_map_);
#endif // defined(OS_LINUX) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
#endif // (defined(OS_LINUX) || defined(OS_CHROMEOS)) &&
// BUILDFLAG(GOOGLE_CHROME_BRANDING)

EXPECT_CALL(provider_, IsInitializationComplete(_))
.WillRepeatedly(Return(true));
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/views/accelerator_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ const AcceleratorMapping kAcceleratorMap[] = {
IDC_SHOW_AVATAR_MENU},

// Platform-specific key maps.
#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
{ui::VKEY_BROWSER_BACK, ui::EF_NONE, IDC_BACK},
{ui::VKEY_BROWSER_FORWARD, ui::EF_NONE, IDC_FORWARD},
{ui::VKEY_BROWSER_HOME, ui::EF_NONE, IDC_HOME},
{ui::VKEY_BROWSER_REFRESH, ui::EF_NONE, IDC_RELOAD},
{ui::VKEY_BROWSER_REFRESH, ui::EF_CONTROL_DOWN, IDC_RELOAD_BYPASSING_CACHE},
{ui::VKEY_BROWSER_REFRESH, ui::EF_SHIFT_DOWN, IDC_RELOAD_BYPASSING_CACHE},
#endif // defined(OS_LINUX)
#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)

#if defined(OS_CHROMEOS)
// On Chrome OS, VKEY_BROWSER_SEARCH is handled in Ash.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, DISABLED_PasteWithoutTextChange) {
}

// Slow flakiness on Linux. crbug.com/803743
#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
#define MAYBE_CtrlEnter DISABLED_CtrlEnter
#else
#define MAYBE_CtrlEnter CtrlEnter
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/views/first_run_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#if defined(OS_WIN)
#include "components/crash/content/app/breakpad_win.h"
#elif defined(OS_LINUX)
#elif defined(OS_LINUX) || defined(OS_CHROMEOS)
#include "components/crash/core/app/breakpad_linux.h"
#endif

Expand All @@ -41,7 +41,7 @@ void InitCrashReporterIfEnabled(bool enabled) {
#if defined(OS_WIN)
if (enabled)
breakpad::InitCrashReporter(std::string());
#elif defined(OS_LINUX)
#elif defined(OS_LINUX) || defined(OS_CHROMEOS)
if (!crash_reporter::IsCrashpadEnabled() && enabled)
breakpad::InitCrashReporter(std::string());
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ IN_PROC_BROWSER_TEST_F(MediaRouterUIBrowserTest, OpenDialogFromAppMenu) {
}

// TODO(crbug.com/1004635) Disabled due to flake on Windows and Linux
#if defined(OS_WIN) || defined(OS_LINUX)
#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS)
#define MAYBE_EphemeralToolbarIconForDialog EphemeralToolbarIconForDialog
#else
#define MAYBE_EphemeralToolbarIconForDialog \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void InlineLoginUIBrowserTest::SetAllowedUsernamePattern(
local_state->SetString(prefs::kGoogleServicesUsernamePattern, pattern);
}

#if defined(OS_LINUX) || defined(OS_WIN)
#if defined(OS_LINUX) || defined(OS_CHROMEOS) || defined(OS_WIN)
// crbug.com/422868
#define MAYBE_DifferentStorageId DISABLED_DifferentStorageId
#else
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/views/tabs/tab.cc
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ void Tab::MaybeUpdateHoverStatus(const ui::MouseEvent& event) {
if (mouse_hovered_ || !GetWidget()->IsMouseEventsEnabled())
return;

#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Move the hit test area for hovering up so that it is not overlapped by tab
// hover cards when they are shown.
// TODO(crbug/978134): Once Linux/CrOS widget transparency is solved, remove
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/views/tabs/tab_drag_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ void TabDragController::Init(TabDragContext* source_context,
// synchronous on desktop Linux, so use that.
// - Chrome OS
// Releasing capture on Ash cancels gestures so avoid it.
#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
can_release_capture_ = false;
#endif
start_point_in_screen_ = gfx::Point(source_view_offset, mouse_offset.y());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ IN_PROC_BROWSER_TEST_F(TabHoverCardBubbleViewBrowserTest,

// Verify hover card is visible when tab is focused.
// TODO(crbug.com/1050765): the test is flaky.
#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
#define MAYBE_WidgetVisibleOnTabFocus DISABLED_WidgetVisibleOnTabFocus
#else
#define MAYBE_WidgetVisibleOnTabFocus WidgetVisibleOnTabFocus
Expand All @@ -141,7 +141,7 @@ IN_PROC_BROWSER_TEST_F(TabHoverCardBubbleViewBrowserTest,
// Verify hover card is visible when focus moves from the tab to tab close
// button.
// TODO(crbug.com/1050765): the test is flaky.
#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
#define MAYBE_WidgetVisibleOnTabCloseButtonFocusAfterTabFocus \
DISABLED_WidgetVisibleOnTabCloseButtonFocusAfterTabFocus
#else
Expand Down Expand Up @@ -194,7 +194,7 @@ IN_PROC_BROWSER_TEST_F(TabHoverCardBubbleViewBrowserTest,
// Verify hover card is visible after navigating to the tab strip using keyboard
// accelerators.
// TODO(crbug.com/1050765): the test is flaky.
#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
#define MAYBE_WidgetVisibleOnTabFocusFromKeyboardAccelerator \
DISABLED_WidgetVisibleOnTabFocusFromKeyboardAccelerator
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void ToolbarViewInteractiveUITest::SetUpOnMainThread() {

// TODO(pkasting): https://crbug.com/939621 Fails on Mac.
// Also flaky on linux-chromeos-chrome crbug.com/1076875.
#if defined(OS_MAC) || defined(OS_LINUX)
#if defined(OS_MAC) || defined(OS_LINUX) || defined(OS_CHROMEOS)
#define MAYBE_TestAppMenuOpensOnDrag DISABLED_TestAppMenuOpensOnDrag
#else
#define MAYBE_TestAppMenuOpensOnDrag TestAppMenuOpensOnDrag
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ IN_PROC_BROWSER_TEST_F(PrintPreviewBrowserTest, PrintCommands) {
}

// Disable the test for mac, see http://crbug/367665.
#if defined(OS_MAC) || defined(OS_LINUX)
#if defined(OS_MAC) || defined(OS_LINUX) || defined(OS_CHROMEOS)
#define MAYBE_TaskManagerNewPrintPreview DISABLED_TaskManagerNewPrintPreview
#else
#define MAYBE_TaskManagerNewPrintPreview TaskManagerNewPrintPreview
Expand Down
27 changes: 14 additions & 13 deletions chromecast/app/cast_main_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@
#include "chromecast/app/android/cast_crash_reporter_client_android.h"
#include "chromecast/app/android/crash_handler.h"
#include "ui/base/resource/resource_bundle_android.h"
#elif defined(OS_LINUX)
#elif defined(OS_LINUX) || defined(OS_CHROMEOS)
#include "chromecast/app/linux/cast_crash_reporter_client.h"
#include "sandbox/policy/switches.h"
#endif // defined(OS_LINUX)
#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)

namespace {

#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
chromecast::CastCrashReporterClient* GetCastCrashReporter() {
static base::NoDestructor<chromecast::CastCrashReporterClient>
crash_reporter_client;
return crash_reporter_client.get();
}
#endif // defined(OS_LINUX)
#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)

#if defined(OS_ANDROID)
const int kMaxCrashFiles = 10;
Expand Down Expand Up @@ -135,7 +135,8 @@ bool CastMainDelegate::BasicStartupComplete(int* exit_code) {
}

void CastMainDelegate::PreSandboxStartup() {
#if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX))
#if defined(ARCH_CPU_ARM_FAMILY) && \
(defined(OS_ANDROID) || defined(OS_LINUX) || defined(OS_CHROMEOS))
// Create an instance of the CPU class to parse /proc/cpuinfo and cache the
// results. This data needs to be cached when file-reading is still allowed,
// since base::CPU expects to be callable later, when file-reading is no
Expand All @@ -155,13 +156,13 @@ void CastMainDelegate::PreSandboxStartup() {
base::FilePath log_file;
base::PathService::Get(FILE_CAST_ANDROID_LOG, &log_file);
chromecast::CrashHandler::Initialize(process_type, log_file);
#elif defined(OS_LINUX)
crash_reporter::SetCrashReporterClient(GetCastCrashReporter());
#elif defined(OS_LINUX) || defined(OS_CHROMEOS)
crash_reporter::SetCrashReporterClient(GetCastCrashReporter());

if (process_type != service_manager::switches::kZygoteProcess) {
CastCrashReporterClient::InitCrashReporter(process_type);
}
#endif // defined(OS_LINUX)
if (process_type != service_manager::switches::kZygoteProcess) {
CastCrashReporterClient::InitCrashReporter(process_type);
}
#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)

crash_reporter::InitializeCrashKeys();
}
Expand Down Expand Up @@ -191,7 +192,7 @@ int CastMainDelegate::RunProcess(
#endif // defined(OS_ANDROID)
}

#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
void CastMainDelegate::ZygoteForked() {
const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess());
bool enable_crash_reporter = !command_line->HasSwitch(
Expand All @@ -202,7 +203,7 @@ void CastMainDelegate::ZygoteForked() {
CastCrashReporterClient::InitCrashReporter(process_type);
}
}
#endif // defined(OS_LINUX)
#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)

bool CastMainDelegate::ShouldCreateFeatureList() {
return false;
Expand Down
4 changes: 2 additions & 2 deletions chromecast/app/cast_main_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class CastMainDelegate : public content::ContentMainDelegate {
int RunProcess(
const std::string& process_type,
const content::MainFunctionParams& main_function_params) override;
#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
void ZygoteForked() override;
#endif // defined(OS_LINUX)
#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
bool ShouldCreateFeatureList() override;
void PostEarlyInitialization(bool is_running_tests) override;
content::ContentClient* CreateContentClient() override;
Expand Down
2 changes: 1 addition & 1 deletion content/browser/media/midi_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class MidiBrowserTest : public ContentBrowserTest {
EXPECT_TRUE(NavigateToURL(shell(), https_test_server_->GetURL(path)));

const base::string16 result = watcher.WaitAndGetTitle();
#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
// Try does not allow accessing /dev/snd/seq, and it results in a platform
// specific initialization error. See http://crbug.com/371230.
// Also, Chromecast does not support the feature and results in
Expand Down
4 changes: 2 additions & 2 deletions content/renderer/render_process_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#if defined(OS_WIN)
#include "base/win/win_util.h"
#endif
#if defined(OS_LINUX) && defined(ARCH_CPU_X86_64)
#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_64)
#include "v8/include/v8-wasm-trap-handler-posix.h"
#endif
namespace {
Expand Down Expand Up @@ -161,7 +161,7 @@ RenderProcessImpl::RenderProcessImpl()

SetV8FlagIfNotFeature(features::kWebAssemblyTrapHandler,
"--no-wasm-trap-handler");
#if defined(OS_LINUX) && defined(ARCH_CPU_X86_64)
#if (defined(OS_LINUX) || defined(OS_CHROMEOS)) && defined(ARCH_CPU_X86_64)
if (base::FeatureList::IsEnabled(features::kWebAssemblyTrapHandler)) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(
Expand Down
7 changes: 4 additions & 3 deletions content/renderer/render_thread_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ void RenderThreadImpl::Init() {
DCHECK(parsed_num_raster_threads) << string_value;
DCHECK_GT(num_raster_threads, 0);

#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
categorized_worker_pool_->SetBackgroundingCallback(
main_thread_scheduler_->DefaultTaskRunner(),
base::BindOnce(
Expand All @@ -736,7 +736,7 @@ void RenderThreadImpl::Init() {
base::DiscardableMemoryAllocator::SetInstance(
discardable_memory_allocator_.get());

#if defined(OS_LINUX)
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
if (base::FeatureList::IsEnabled(
blink::features::kBlinkCompositorUseDisplayThreadPriority)) {
render_message_filter()->SetThreadPriority(
Expand Down Expand Up @@ -1121,7 +1121,8 @@ media::GpuVideoAcceleratorFactories* RenderThreadImpl::GetGpuFactories() {
!cmd_line->HasSwitch(switches::kDisableGpuMemoryBufferVideoFrames);
#else
cmd_line->HasSwitch(switches::kEnableGpuMemoryBufferVideoFrames);
#endif // defined(OS_MAC) || defined(OS_LINUX) || defined(OS_WIN)
#endif // defined(OS_MAC) || defined(OS_LINUX) || defined(OS_CHROMEOS) ||
// defined(OS_WIN)
const bool enable_media_stream_gpu_memory_buffers =
enable_gpu_memory_buffers &&
base::FeatureList::IsEnabled(
Expand Down
Loading

0 comments on commit 8270041

Please sign in to comment.