Commit 9394364f authored by Alexander Dunaev's avatar Alexander Dunaev Committed by Commit Bot

Reland "[ozone/x11] Enabled user input monitor unit tests."

This is a reland of 30a60064

The difference to the original change is that here media_unittests
are added to the list of test suites that run with Wayland.

Original change's description:
> [ozone/x11] Enabled user input monitor unit tests.
>
> This CL adds Ozone platform initialisation to the user input monitor tests
> so they can now work with Ozone enabled.
>
> Bug: 1109112
> Change-Id: I31f9dabf2da9eed85cd05fe27017899b0247f4bc
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2521144
> Commit-Queue: Alexander Dunaev <adunaev@igalia.com>
> Reviewed-by: Scott Violet <sky@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#826638}

Bug: 1109112
Change-Id: Id9de3d5985b9fe13c4b073b4f2731fc1df2966f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532776Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
Commit-Queue: Alexander Dunaev <adunaev@igalia.com>
Cr-Commit-Position: refs/heads/master@{#828038}
parent a8fe1851
......@@ -83,6 +83,7 @@ _TARGETS_REQUIRE_ASH_CHROME = [
'content_unittests',
'dbus_unittests',
'extensions_unittests',
'media_unittests',
'message_center_unittests',
'snapshot_unittests',
'sync_integration_tests',
......
......@@ -19,19 +19,35 @@
#if defined(USE_OZONE)
#include "ui/base/ui_base_features.h" // nogncheck
#include "ui/ozone/public/ozone_platform.h" // nogncheck
#endif
namespace media {
TEST(UserInputMonitorTest, CreatePlatformSpecific) {
namespace {
class UserInputMonitorTest : public testing::Test {
protected:
// testing::Test.
void SetUp() override {
#if defined(USE_OZONE)
// TODO(crbug.com/1109112): enable those tests for Ozone.
// Here, the only issue why they don't work is that the Ozone platform is not
// initialised.
if (features::IsUsingOzonePlatform())
return;
if (features::IsUsingOzonePlatform()) {
if (ui::OzonePlatform::GetPlatformNameForTest() == "drm") {
// OzonePlatformDrm::InitializeUI hangs in tests on the DRM platform.
GTEST_SKIP();
}
// Initialise Ozone in single process mode, as all tests do.
ui::OzonePlatform::InitParams params;
params.single_process = true;
ui::OzonePlatform::InitializeForUI(params);
}
#endif
}
};
} // namespace
TEST_F(UserInputMonitorTest, CreatePlatformSpecific) {
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
base::test::TaskEnvironment task_environment(
base::test::TaskEnvironment::MainThreadType::IO);
......@@ -53,15 +69,7 @@ TEST(UserInputMonitorTest, CreatePlatformSpecific) {
base::RunLoop().RunUntilIdle();
}
TEST(UserInputMonitorTest, CreatePlatformSpecificWithMapping) {
#if defined(USE_OZONE)
// TODO(crbug.com/1109112): enable those tests for Ozone.
// Here, the only issue why they don't work is that the Ozone platform is not
// initialised.
if (features::IsUsingOzonePlatform())
return;
#endif
TEST_F(UserInputMonitorTest, CreatePlatformSpecificWithMapping) {
#if defined(OS_LINUX) || defined(OS_CHROMEOS)
base::test::TaskEnvironment task_environment(
base::test::TaskEnvironment::MainThreadType::IO);
......@@ -90,7 +98,7 @@ TEST(UserInputMonitorTest, CreatePlatformSpecificWithMapping) {
EXPECT_EQ(0u, ReadKeyPressMonitorCount(readonly_mapping));
}
TEST(UserInputMonitorTest, ReadWriteKeyPressMonitorCount) {
TEST_F(UserInputMonitorTest, ReadWriteKeyPressMonitorCount) {
std::unique_ptr<base::MappedReadOnlyRegion> shmem =
std::make_unique<base::MappedReadOnlyRegion>(
base::ReadOnlySharedMemoryRegion::Create(sizeof(uint32_t)));
......
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