Commit 25094850 authored by Nick Diego Yamane's avatar Nick Diego Yamane Committed by Commit Bot

Move x11 event translation tests into ozone_x11_unittests

Ozone/X11 unit tests are kept separately so that non-X11 tests don't depend on
X server to be performed. Having x11 event translation tests in
events_unittests currently depends on GN config ozone_platform_x11 being set
(more precisely after crrev.com/c/1895399), which breaks the aforementioned
rule, when running unit tests within a ssh session, where DISPLAY env var is
not set, among other scenarios.

This fixes such regression by keeping such tests in events_unittests binary
only for Aura/X11, while for ozone they are added to ozone_x11_unittests
instead. This must be cleaned up once X11 is fully migrated to Ozone/X11, by
moving x11 event translation impl and its tests into ozone/platform/x11 dir.

R=spang@chromium.org

        --gtest_filter=XEventTranslationTest.KeyEventDomKeyExtraction

Bug: 1029365
Test: DISPLAY= ./out/linux_ozone_rel/events_unittests \
Change-Id: I053d8dc9e2a1a26a844479c0fb503351053b12a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2036995
Commit-Queue: Nick Yamane <nickdiego@igalia.com>
Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Reviewed-by: default avatarSadrul Chowdhury <sadrul@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738467}
parent b9c2b859
......@@ -611,23 +611,11 @@ if (!is_ios) {
}
if (use_x11) {
sources += [
"devices/x11/device_data_manager_x11_unittest.cc",
"x/events_x_unittest.cc",
]
sources += [ "devices/x11/device_data_manager_x11_unittest.cc" ]
configs += [ "//build/config/linux:x11" ]
deps += [
"//ui/events/devices/x11",
"//ui/events/x",
"//ui/gfx/x",
]
}
if (use_x11 || ozone_platform_x11) {
sources += [ "x/x11_event_translation_unittest.cc" ]
deps += [
"//ui/events/x",
"//ui/gfx/x",
"//ui/events/x:unittests",
]
}
......
......@@ -2,6 +2,11 @@
# 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")
# X11-specific utility code which does not depend on //ui/events:events is kept
# in this separate component, so that //ui/events:events can depend directly on
# it without causing circular dep issues.
component("x") {
output_name = "events_x"
sources = [
......@@ -24,3 +29,32 @@ component("x") {
]
configs += [ "//build/config/linux:x11" ]
}
# XEvent translation tests are kept in a separate source_set so that both
# ozone_x11_unittests and aura/x11 events_unittests can depend on it.
# TODO(crbug.com/789065): Move this completely into ozone/x11 unit tests once
# X11 migration to Ozone is complete.
source_set("unittests") {
testonly = true
visibility = [
"//ui/events:events_unittests",
"//ui/ozone/platform/x11:x11_unittests",
]
sources = [ "x11_event_translation_unittest.cc" ]
configs += [ "//build/config/linux:x11" ]
deps = [
"//testing/gtest",
"//ui/events:test_support",
]
# TODO(nickdiego): Fix X unit tests in Ozone builds
if (use_x11) {
sources += [ "events_x_unittest.cc" ]
deps += [
"//base/test:test_support",
"//ui/events/devices/x11",
"//ui/events/x:x",
"//ui/gfx/x",
]
}
}
......@@ -12,6 +12,7 @@
#include "ui/events/test/events_test_utils_x11.h"
#include "ui/events/test/keyboard_layout.h"
#include "ui/events/types/event_type.h"
#include "ui/gfx/x/x11.h"
namespace ui {
......@@ -20,7 +21,6 @@ namespace ui {
// regressions such as crbug.com/1007389.
TEST(XEventTranslationTest, KeyEventDomKeyExtraction) {
ui::ScopedKeyboardLayout keyboard_layout(ui::KEYBOARD_LAYOUT_ENGLISH_US);
ScopedXI2Event xev;
xev.InitKeyEvent(ET_KEY_PRESSED, VKEY_RETURN, EF_NONE);
......
......@@ -97,6 +97,7 @@ source_set("x11_unittests") {
"//ui/events:test_support",
"//ui/events/devices/x11",
"//ui/events/platform/x11",
"//ui/events/x:unittests",
"//ui/ozone:platform",
"//ui/ozone:test_support",
"//ui/ozone/common",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment