Skip to content

Commit

Permalink
Add xvfb logic to all windowed test launcher targets.
Browse files Browse the repository at this point in the history
The "generic_wrapper" scripts now being generated during the build
need to know whether or not to use Xvfb when running a test; this
CL adds that logic.

Bug: 816629
Change-Id: Ic2cae1295d7edf583236d6d2640c220c883324ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2370507
Commit-Queue: Dirk Pranke <dpranke@google.com>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Yuke Liao <liaoyuke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802875}
  • Loading branch information
dpranke authored and Commit Bot committed Aug 29, 2020
1 parent d8f65ed commit 79d065d
Show file tree
Hide file tree
Showing 41 changed files with 107 additions and 57 deletions.
2 changes: 2 additions & 0 deletions ash/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -1777,6 +1777,8 @@ action("dbus_service_files") {
}

test("ash_unittests") {
use_xvfb = use_xvfb_in_this_config

sources = [
"accelerators/accelerator_commands_unittest.cc",
"accelerators/accelerator_controller_unittest.cc",
Expand Down
2 changes: 2 additions & 0 deletions ash/app_list/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ executable("app_list_demo") {
}

test("app_list_unittests") {
use_xvfb = use_xvfb_in_this_config

sources = [
"folder_image_unittest.cc",
"test/run_all_unittests.cc",
Expand Down
2 changes: 2 additions & 0 deletions ash/keyboard/ui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ build_closure("inputview") {
}

test("keyboard_unittests") {
use_xvfb = use_xvfb_in_this_config

sources = [
"container_floating_behavior_unittest.cc",
"container_full_width_behavior_unittest.cc",
Expand Down
6 changes: 6 additions & 0 deletions build/config/ui.gni
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# of //build/config/BUILDCONFIG.gn.

import("//build/config/chromecast_build.gni")
import("//build/config/chromeos/ui_mode.gni")

declare_args() {
# Indicates if Ozone is enabled. Ozone is a low-level library layer for Linux
Expand Down Expand Up @@ -49,6 +50,11 @@ assert(!use_glib || (is_linux && !is_chromeos && !is_chromecast))

# Whether to use atk, the Accessibility ToolKit library
use_atk = is_desktop_linux && !is_chromecast && use_glib

# Whether using Xvfb to provide a display server for a test might be
# necessary.
use_xvfb_in_this_config = (is_linux && !is_chromeos) || chromeos_is_browser_only
#
# =============================================
# PLEASE DO NOT ADD MORE FLAGS TO THIS FILE
# =============================================
Expand Down
2 changes: 2 additions & 0 deletions cc/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,8 @@ cc_test_static_library("test_support") {
}

cc_test("cc_unittests") {
use_xvfb = use_xvfb_in_this_config

sources = [
"base/delayed_unique_notifier_unittest.cc",
"base/float_quad_unittest.cc",
Expand Down
5 changes: 4 additions & 1 deletion chrome/elevation_service/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# found in the LICENSE file.

import("//build/config/chrome_build.gni")
import("//build/config/ui.gni")
import("//build/toolchain/win/midl.gni")
import("//chrome/process_version_rc_template.gni")
import("//testing/test.gni")
Expand Down Expand Up @@ -63,8 +64,8 @@ source_set("lib") {
"elevated_recovery_impl.h",
"elevator.cc",
"elevator.h",
"service_main.h",
"service_main.cc",
"service_main.h",
]

configs += [ ":no-missing-braces" ]
Expand Down Expand Up @@ -95,6 +96,8 @@ copy("elevation_service_unittests_files") {
}

test("elevation_service_unittests") {
use_xvfb = use_xvfb_in_this_config

sources = [
"elevated_recovery_unittest.cc",
"run_all_unittests.cc",
Expand Down
3 changes: 3 additions & 0 deletions chrome/notification_helper/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# found in the LICENSE file.

import("//build/config/chrome_build.gni")
import("//build/config/ui.gni")
import("//chrome/process_version_rc_template.gni")
import("//testing/test.gni")

Expand Down Expand Up @@ -66,6 +67,8 @@ process_version_rc_template("version_resources") {
}

test("notification_helper_unittests") {
use_xvfb = use_xvfb_in_this_config

sources = [
"com_server_module_unittest.cc",
"notification_helper_process_unittest.cc",
Expand Down
18 changes: 6 additions & 12 deletions chrome/test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,7 @@ static_library("browser_tests_runner") {

if (!is_android) {
test("browser_tests") {
if ((is_linux && !is_chromeos) || chromeos_is_browser_only) {
use_xvfb = true
}
use_xvfb = use_xvfb_in_this_config

configs += [ "//build/config:precompiled_headers" ]
defines = [
Expand Down Expand Up @@ -3133,9 +3131,7 @@ if (is_mac) {
}

test("unit_tests") {
if ((is_linux && !is_chromeos) || chromeos_is_browser_only) {
use_xvfb = true
}
use_xvfb = use_xvfb_in_this_config

inputs = [
# enums.xml is analyzed by AboutFlagsHistogramTest, so this
Expand Down Expand Up @@ -5975,9 +5971,7 @@ if (!is_android) {
}

test("interactive_ui_tests") {
if ((is_linux && !is_chromeos) || chromeos_is_browser_only) {
use_xvfb = true
}
use_xvfb = use_xvfb_in_this_config

sources = [
"../browser/about_flags_browsertest.cc",
Expand Down Expand Up @@ -6617,9 +6611,7 @@ if (!is_fuchsia) {

if (!is_fuchsia && !is_android) {
test("sync_integration_tests") {
if ((is_linux && !is_chromeos) || chromeos_is_browser_only) {
use_xvfb = true
}
use_xvfb = use_xvfb_in_this_config

sources = [
"../browser/sync/test/integration/enable_disable_test.cc",
Expand Down Expand Up @@ -6862,6 +6854,8 @@ if (!is_fuchsia && !is_android) {

# Tests autofill on captured websites
test("captured_sites_interactive_tests") {
use_xvfb = use_xvfb_in_this_config

sources = [
"../browser/autofill/autofill_captured_sites_interactive_uitest.cc",
"../browser/autofill/autofill_uitest.cc",
Expand Down
8 changes: 2 additions & 6 deletions components/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ if (is_ios) {
# no tests will run) and add a reference here. You can add more than one unit
# test target if convenient.
test("components_unittests") {
if ((is_linux && !is_chromeos) || chromeos_is_browser_only) {
use_xvfb = true
}
use_xvfb = use_xvfb_in_this_config

if (is_android || is_linux || is_chromeos || is_mac || is_win) {
data = [ "test/data/" ]
Expand Down Expand Up @@ -545,9 +543,7 @@ if (is_android) {
# no-op under Fuchsia.
if (!is_ios && !is_fuchsia) {
test("components_browsertests") {
if ((is_linux && !is_chromeos) || chromeos_is_browser_only) {
use_xvfb = true
}
use_xvfb = use_xvfb_in_this_config

defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]

Expand Down
2 changes: 2 additions & 0 deletions components/exo/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,8 @@ source_set("unit_tests") {
}

test("exo_unittests") {
use_xvfb = use_xvfb_in_this_config

sources = [ "test/run_all_unittests.cc" ]

deps = [
Expand Down
2 changes: 2 additions & 0 deletions components/exo/wayland/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,8 @@ source_set("wayland_client_test_helper") {
}

test("wayland_client_perftests") {
use_xvfb = use_xvfb_in_this_config

sources = [
"clients/perftests.cc",
"clients/test/run_all_client_perftests.cc",
Expand Down
3 changes: 3 additions & 0 deletions components/viz/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/ui.gni")
import("//components/viz/viz.gni")
import("//testing/test.gni")

viz_test("viz_unittests") {
use_xvfb = use_xvfb_in_this_config

sources = [ "test/run_all_unittests.cc" ]
deps = [
"//base",
Expand Down
8 changes: 2 additions & 6 deletions content/test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -878,9 +878,7 @@ if (is_android) {
}

test("content_browsertests") {
if ((is_linux && !is_chromeos) || chromeos_is_browser_only) {
use_xvfb = true
}
use_xvfb = use_xvfb_in_this_config

# See comment at the top of //content/BUILD.gn for why this is disabled in
# component builds.
Expand Down Expand Up @@ -1618,9 +1616,7 @@ static_library("run_all_unittests") {
}

test("content_unittests") {
if ((is_linux && !is_chromeos) || chromeos_is_browser_only) {
use_xvfb = true
}
use_xvfb = use_xvfb_in_this_config

# See comment at the top of //content/BUILD.gn for why this is disabled in
# component builds.
Expand Down
5 changes: 2 additions & 3 deletions dbus/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# found in the LICENSE file.

import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//testing/test.gni")
import("//third_party/protobuf/proto_library.gni")

Expand Down Expand Up @@ -69,9 +70,7 @@ static_library("test_support") {
}

test("dbus_unittests") {
if ((is_linux && !is_chromeos) || chromeos_is_browser_only) {
use_xvfb = true
}
use_xvfb = use_xvfb_in_this_config

sources = [
"bus_unittest.cc",
Expand Down
8 changes: 2 additions & 6 deletions extensions/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ repack("shell_and_test_pak") {
}

test("extensions_unittests") {
if ((is_linux && !is_chromeos) || chromeos_is_browser_only) {
use_xvfb = true
}
use_xvfb = use_xvfb_in_this_config

sources = [
"test/extensions_unittests_main.cc",
Expand Down Expand Up @@ -245,9 +243,7 @@ test("extensions_unittests") {
}

test("extensions_browsertests") {
if ((is_linux && !is_chromeos) || chromeos_is_browser_only) {
use_xvfb = true
}
use_xvfb = use_xvfb_in_this_config

data = [
"//extensions/test/data/",
Expand Down
4 changes: 1 addition & 3 deletions extensions/shell/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,7 @@ executable("app_shell") {
}

test("app_shell_unittests") {
if ((is_linux && !is_chromeos) || chromeos_is_browser_only) {
use_xvfb = true
}
use_xvfb = use_xvfb_in_this_config

sources = [
"../test/extensions_unittests_main.cc",
Expand Down
4 changes: 4 additions & 0 deletions gpu/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ if (!is_android && !is_fuchsia && !is_chromeos) {
}

test("gl_tests") {
use_xvfb = use_xvfb_in_this_config

sources = [
"command_buffer/service/shared_image_backing_factory_gl_texture_unittest.cc",
"command_buffer/service/shared_image_factory_unittest.cc",
Expand Down Expand Up @@ -433,6 +435,8 @@ test("gl_tests") {
}

test("gpu_unittests") {
use_xvfb = use_xvfb_in_this_config

sources = [
"command_buffer/client/buffer_tracker_unittest.cc",
"command_buffer/client/client_discardable_manager_unittest.cc",
Expand Down
2 changes: 2 additions & 0 deletions gpu/vulkan/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ if (enable_vulkan) {
# https://crbug.com/1065499
if (is_android || use_x11 || is_win || use_ozone) {
test("vulkan_tests") {
use_xvfb = use_xvfb_in_this_config

sources = [
"tests/basic_vulkan_test.cc",
"tests/basic_vulkan_test.h",
Expand Down
2 changes: 2 additions & 0 deletions media/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ source_set("test_support") {
# Contains tests for all targets in the "media" folder.
# TODO(xhwang): Move mojo/capture/remoting tests here where applicable.
test("media_unittests") {
use_xvfb = use_xvfb_in_this_config

deps = [
"//media/audio:unit_tests",
"//media/base:unit_tests",
Expand Down
3 changes: 3 additions & 0 deletions media/blink/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/ui.gni")
import("//media/media_options.gni")
import("//testing/test.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
Expand Down Expand Up @@ -105,6 +106,8 @@ component("blink") {
}

test("media_blink_unittests") {
use_xvfb = use_xvfb_in_this_config

deps = [
":blink",
"//base",
Expand Down
3 changes: 3 additions & 0 deletions media/capture/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# found in the LICENSE file.

import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//media/media_options.gni")
import("//testing/test.gni")

Expand Down Expand Up @@ -353,6 +354,8 @@ source_set("test_support") {
}

test("capture_unittests") {
use_xvfb = use_xvfb_in_this_config

sources = [
"content/animated_content_sampler_unittest.cc",
"content/capture_resolution_chooser_unittest.cc",
Expand Down
2 changes: 2 additions & 0 deletions media/cast/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ static_library("test_support") {
}

test("cast_unittests") {
use_xvfb = use_xvfb_in_this_config

sources = [
"common/expanded_value_base_unittest.cc",
"common/rtp_time_unittest.cc",
Expand Down
2 changes: 2 additions & 0 deletions media/midi/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ mojom("mojo") {
}

test("midi_unittests") {
use_xvfb = use_xvfb_in_this_config

sources = [
"message_util_unittest.cc",
"midi_manager_unittest.cc",
Expand Down
2 changes: 2 additions & 0 deletions services/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
# To add tests for a new service, please define a "tests" source_set in the
# service subdirectory and add it as a dependency here.
test("services_unittests") {
use_xvfb = use_xvfb_in_this_config

# The tracing unittests require this for testing unwinding. See
# stack_unwinder_android_unittest.cc.
if (is_android && can_unwind_with_cfi_table && is_official_build) {
Expand Down
Loading

0 comments on commit 79d065d

Please sign in to comment.