#include "remoting/host/linux/x11_character_injector.h"
#include <unordered_map>
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "remoting/host/linux/x11_keyboard.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
constexpr base::TimeDelta kKeycodeReuseDuration = …;
}
namespace remoting {
class FakeX11Keyboard : public X11Keyboard { … };
FakeX11Keyboard::FakeX11Keyboard(
const std::vector<uint32_t>& available_keycodes) { … }
FakeX11Keyboard::~FakeX11Keyboard() { … }
std::vector<uint32_t> FakeX11Keyboard::GetUnusedKeycodes() { … }
void FakeX11Keyboard::PressKey(uint32_t keycode, uint32_t modifiers) { … }
bool FakeX11Keyboard::FindKeycode(uint32_t code_point,
uint32_t* keycode,
uint32_t* modifiers) { … }
bool FakeX11Keyboard::ChangeKeyMapping(uint32_t keycode, uint32_t code_point) { … }
void FakeX11Keyboard::Flush() { … }
void FakeX11Keyboard::Sync() { … }
void FakeX11Keyboard::ExpectEnterCodePoints(
const std::vector<uint32_t>& sequence) { … }
class X11CharacterInjectorTest : public testing::Test { … };
void X11CharacterInjectorTest::SetUp() { … }
void X11CharacterInjectorTest::TearDown() { … }
void X11CharacterInjectorTest::InjectAndRun(
const std::vector<uint32_t>& code_points) { … }
TEST_F(X11CharacterInjectorTest, TestNoMappingNoExpectation) { … }
TEST_F(X11CharacterInjectorTest, TestTypeOneCharacter) { … }
TEST_F(X11CharacterInjectorTest, TestMapCharactersUntilFull) { … }
TEST_F(X11CharacterInjectorTest, TestMapOneCharacterWhenFull) { … }
TEST_F(X11CharacterInjectorTest, TestReuseMappedCharacterOnce) { … }
TEST_F(X11CharacterInjectorTest, TestReuseAllMappedCharactersInChangedOrder) { … }
}