Commit 30a60064 authored by Alexander Dunaev's avatar Alexander Dunaev Committed by Commit Bot

[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: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826638}
parent 5b5759d0
...@@ -19,19 +19,35 @@ ...@@ -19,19 +19,35 @@
#if defined(USE_OZONE) #if defined(USE_OZONE)
#include "ui/base/ui_base_features.h" // nogncheck #include "ui/base/ui_base_features.h" // nogncheck
#include "ui/ozone/public/ozone_platform.h" // nogncheck
#endif #endif
namespace media { namespace media {
TEST(UserInputMonitorTest, CreatePlatformSpecific) { namespace {
class UserInputMonitorTest : public testing::Test {
protected:
// testing::Test.
void SetUp() override {
#if defined(USE_OZONE) #if defined(USE_OZONE)
// TODO(crbug.com/1109112): enable those tests for Ozone. if (features::IsUsingOzonePlatform()) {
// Here, the only issue why they don't work is that the Ozone platform is not if (std::strcmp(ui::OzonePlatform::GetPlatformName(), "drm") == 0) {
// initialised. // OzonePlatformDrm::InitializeUI hangs in tests.
if (features::IsUsingOzonePlatform()) GTEST_SKIP();
return; }
// Initialise Ozone in single process mode, as all tests do.
ui::OzonePlatform::InitParams params;
params.single_process = true;
ui::OzonePlatform::InitializeForUI(params);
}
#endif #endif
}
};
} // namespace
TEST_F(UserInputMonitorTest, CreatePlatformSpecific) {
#if defined(OS_LINUX) || defined(OS_CHROMEOS) #if defined(OS_LINUX) || defined(OS_CHROMEOS)
base::test::TaskEnvironment task_environment( base::test::TaskEnvironment task_environment(
base::test::TaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
...@@ -53,15 +69,7 @@ TEST(UserInputMonitorTest, CreatePlatformSpecific) { ...@@ -53,15 +69,7 @@ TEST(UserInputMonitorTest, CreatePlatformSpecific) {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
} }
TEST(UserInputMonitorTest, CreatePlatformSpecificWithMapping) { TEST_F(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
#if defined(OS_LINUX) || defined(OS_CHROMEOS) #if defined(OS_LINUX) || defined(OS_CHROMEOS)
base::test::TaskEnvironment task_environment( base::test::TaskEnvironment task_environment(
base::test::TaskEnvironment::MainThreadType::IO); base::test::TaskEnvironment::MainThreadType::IO);
...@@ -90,7 +98,7 @@ TEST(UserInputMonitorTest, CreatePlatformSpecificWithMapping) { ...@@ -90,7 +98,7 @@ TEST(UserInputMonitorTest, CreatePlatformSpecificWithMapping) {
EXPECT_EQ(0u, ReadKeyPressMonitorCount(readonly_mapping)); EXPECT_EQ(0u, ReadKeyPressMonitorCount(readonly_mapping));
} }
TEST(UserInputMonitorTest, ReadWriteKeyPressMonitorCount) { TEST_F(UserInputMonitorTest, ReadWriteKeyPressMonitorCount) {
std::unique_ptr<base::MappedReadOnlyRegion> shmem = std::unique_ptr<base::MappedReadOnlyRegion> shmem =
std::make_unique<base::MappedReadOnlyRegion>( std::make_unique<base::MappedReadOnlyRegion>(
base::ReadOnlySharedMemoryRegion::Create(sizeof(uint32_t))); 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