Flutter Engine
keyboard_win32_unittests.cc File Reference
#include "flutter/shell/platform/common/json_message_codec.h"
#include "flutter/shell/platform/embedder/embedder.h"
#include "flutter/shell/platform/embedder/test_utils/key_codes.g.h"
#include "flutter/shell/platform/windows/flutter_windows_engine.h"
#include "flutter/shell/platform/windows/flutter_windows_view.h"
#include "flutter/shell/platform/windows/keyboard_key_channel_handler.h"
#include "flutter/shell/platform/windows/keyboard_key_embedder_handler.h"
#include "flutter/shell/platform/windows/keyboard_key_handler.h"
#include "flutter/shell/platform/windows/keyboard_manager_win32.h"
#include "flutter/shell/platform/windows/testing/engine_modifier.h"
#include "flutter/shell/platform/windows/testing/mock_window_binding_handler.h"
#include "flutter/shell/platform/windows/testing/test_keyboard.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/writer.h"
#include <functional>
#include <list>
#include <vector>

Go to the source code of this file.

Namespaces

 flutter
 
 flutter::testing
 

Macros

#define EXPECT_CALL_IS_EVENT(_key_call, ...)
 
#define EXPECT_CALL_IS_TEXT(_key_call, u16_string)
 
#define EXPECT_CALL_IS_TEXT_METHOD_CALL(_key_call, json_string)
 

Functions

 flutter::testing::TEST (KeyboardTest, LowerCaseAHandled)
 
 flutter::testing::TEST (KeyboardTest, LowerCaseAUnhandled)
 
 flutter::testing::TEST (KeyboardTest, ArrowLeftHandled)
 
 flutter::testing::TEST (KeyboardTest, ArrowLeftUnhandled)
 
 flutter::testing::TEST (KeyboardTest, ShiftLeftUnhandled)
 
 flutter::testing::TEST (KeyboardTest, ShiftRightUnhandled)
 
 flutter::testing::TEST (KeyboardTest, CtrlLeftUnhandled)
 
 flutter::testing::TEST (KeyboardTest, CtrlRightUnhandled)
 
 flutter::testing::TEST (KeyboardTest, AltLeftUnhandled)
 
 flutter::testing::TEST (KeyboardTest, AltRightUnhandled)
 
 flutter::testing::TEST (KeyboardTest, MetaLeftUnhandled)
 
 flutter::testing::TEST (KeyboardTest, MetaRightUnhandled)
 
 flutter::testing::TEST (KeyboardTest, ShiftLeftKeyA)
 
 flutter::testing::TEST (KeyboardTest, CtrlLeftKeyA)
 
 flutter::testing::TEST (KeyboardTest, CtrlLeftDigit1)
 
 flutter::testing::TEST (KeyboardTest, Digit1OnFrenchLayout)
 
 flutter::testing::TEST (KeyboardTest, AltGrModifiedKey)
 
 flutter::testing::TEST (KeyboardTest, AltGrTwice)
 
 flutter::testing::TEST (KeyboardTest, DeadKeyThatCombines)
 
 flutter::testing::TEST (KeyboardTest, DeadKeyWithoutDeadMaskThatCombines)
 
 flutter::testing::TEST (KeyboardTest, DeadKeyThatDoesNotCombine)
 
 flutter::testing::TEST (KeyboardTest, DeadKeyTwiceThenLetter)
 
 flutter::testing::TEST (KeyboardTest, MultibyteCharacter)
 
 flutter::testing::TEST (KeyboardTest, SynthesizeModifiers)
 
 flutter::testing::TEST (KeyboardTest, ImeExtendedEventsAreIgnored)
 
 flutter::testing::TEST (KeyboardTest, UpOnlyImeEventsAreCorrectlyHandled)
 
 flutter::testing::TEST (KeyboardTest, DisorderlyRespondedEvents)
 
 flutter::testing::TEST (KeyboardTest, SlowFrameworkResponse)
 
 flutter::testing::TEST (KeyboardTest, SlowFrameworkResponseForIdenticalEvents)
 
 flutter::testing::TEST (KeyboardTest, TextInputSubmit)
 
 flutter::testing::TEST (KeyboardTest, VietnameseTelexAddDiacriticWithFastResponse)
 
void flutter::testing::VietnameseTelexAddDiacriticWithSlowResponse (bool backspace_response)
 
 flutter::testing::TEST (KeyboardTest, VietnameseTelexAddDiacriticWithSlowFalseResponse)
 
 flutter::testing::TEST (KeyboardTest, VietnameseTelexAddDiacriticWithSlowTrueResponse)
 

Macro Definition Documentation

◆ EXPECT_CALL_IS_EVENT

#define EXPECT_CALL_IS_EVENT (   _key_call,
  ... 
)
Value:
EXPECT_EQ(_key_call.type, KeyCall::kKeyCallOnKey); \
EXPECT_EVENT_EQUALS(_key_call.key_event, __VA_ARGS__);

Definition at line 546 of file keyboard_win32_unittests.cc.

Referenced by flutter::testing::TEST(), and flutter::testing::VietnameseTelexAddDiacriticWithSlowResponse().

◆ EXPECT_CALL_IS_TEXT

#define EXPECT_CALL_IS_TEXT (   _key_call,
  u16_string 
)
Value:
EXPECT_EQ(_key_call.type, KeyCall::kKeyCallOnText); \
EXPECT_EQ(_key_call.text, u16_string);

Definition at line 550 of file keyboard_win32_unittests.cc.

Referenced by flutter::testing::TEST(), and flutter::testing::VietnameseTelexAddDiacriticWithSlowResponse().

◆ EXPECT_CALL_IS_TEXT_METHOD_CALL

#define EXPECT_CALL_IS_TEXT_METHOD_CALL (   _key_call,
  json_string 
)
Value:
EXPECT_EQ(_key_call.type, KeyCall::kKeyCallTextMethodCall); \
EXPECT_STREQ(_key_call.text_method_call.c_str(), json_string);

Definition at line 554 of file keyboard_win32_unittests.cc.

Referenced by flutter::testing::TEST().

Variable Documentation

◆ content

◆ expected_forged_message

Win32Message expected_forged_message

Definition at line 161 of file keyboard_win32_unittests.cc.

◆ key

uint32_t key

Definition at line 119 of file keyboard_win32_unittests.cc.

◆ key_event

◆ key_state_change

KeyStateChange key_state_change

Definition at line 160 of file keyboard_win32_unittests.cc.

◆ message

Win32Message message

Definition at line 131 of file keyboard_win32_unittests.cc.

Referenced by flutter::AccessibilityBridge::AccessibilityBridge(), flutter::BM_PlatformMessageResponseDartComplete(), dart_utils::Check(), flutter::PlatformConfiguration::client(), FlutterStandardMethodCodec::codecWithReaderWriter:, FlutterStandardMessageCodec::codecWithReaderWriter:, ConvertToDesktopMessage(), flutter_runner::ComponentV1::Create(), flutter_runner::ComponentV2::Create(), decode_error_method_call(), decode_error_response(), decode_message(), decode_method_call(), decode_response_with_error(), decode_response_with_success(), flutter::MethodCodec< rapidjson::Document >::DecodeAndProcessResponseEnvelope(), flutter::JsonMethodCodec::DecodeAndProcessResponseEnvelopeInternal(), flutter::StandardMethodCodec::DecodeAndProcessResponseEnvelopeInternal(), flutter::DidFlagChange(), flutter::PlatformViewAndroid::DispatchEmptyPlatformMessage(), flutter::testing::MockMessageQueue::DispatchFront(), DispatchJSONPlatformMessage(), flutter::PlatformViewAndroid::DispatchPlatformMessage(), flutter::Engine::DispatchPlatformMessage(), flutter::RuntimeController::DispatchSemanticsAction(), echo_response_cb(), flutter::testing::EmbedderConfigBuilder::EmbedderConfigBuilder(), encode_error_envelope(), encode_message(), encode_message_error(), encode_method_call(), encode_success_envelope(), flutter::MessageCodec< rapidjson::Document >::EncodeMessage(), flutter::JsonMethodCodec::EncodeMethodCallInternal(), flutter_runner::Engine::Engine(), EngineOnFlutterPlatformMessage(), failure_response_cb(), fake_response_cb(), fl_basic_message_channel_send_finish(), fl_json_method_codec_encode_error_envelope(), fl_json_method_codec_encode_method_call(), fl_json_method_codec_encode_success_envelope(), fl_key_channel_responder_handle_event(), fl_method_channel_invoke_method(), fl_method_channel_respond(), FLTDefaultSettingsForBundle(), FlutterEngineInitialize(), FlutterEngineSendPlatformMessage(), G_DECLARE_DERIVABLE_TYPE(), flutter::Shell::GetDartVM(), fml::GetLastErrorMessage(), flutter::testing::EmbedderTestContext::GetLogMessageCallbackHook(), flutter::PlatformViewIOS::GetPlatformMessageHandler(), flutter::PlatformViewAndroid::GetPlatformMessageHandler(), flutter::FlutterMain::GetSettings(), handle_method_call(), handle_response(), flutter::WindowWin32::HandleMessage(), flutter::KeyboardManagerWin32::HandleMessage(), FlutterPlatformPlugin::handleMethodCall:result:, flutter::FlutterWindowsEngine::HandlePlatformMessage(), flutter::WindowWin32::InitializeChild(), FlutterEngineHandlerInfo::initWithConnection:handler:, FlutterEngine::initWithName:, FlutterBasicMessageChannel::initWithName:binaryMessenger:codec:, FlutterMethodChannel::initWithName:binaryMessenger:codec:, FlutterEventChannel::initWithName:binaryMessenger:codec:taskQueue:, FlutterBinaryMessengerRelay::initWithParent:, flutter::testing::MockWin32Window::InjectMessageList(), InternalSendPlatformMessage(), flutter::MethodChannel< T >::InvokeMethod(), FlutterTextInputPlugin::isFirstResponder, tonic::Log(), flutter::Logger_PrintString(), flutter::UIDartState::LogMessage(), main(), MATCHER_P2(), flutter::testing::MockEmbedderApiForKeyboard(), nullptr_response_cb(), flutter_runner::FlatlandPlatformView::OnChildViewStatus(), flutter::FlutterPlatformViewsController::OnMethodCall, flutter::UIDartState::platform_configuration(), flutter::PlatformViewIOS::PlatformViewIOS(), flutter::KeyboardManagerWin32::RedispatchEvent(), ResizeChannelBuffer(), FlutterBasicMessageChannel::resizeChannelBuffer:, FlutterEngine::run, flutter::BinaryMessengerImpl::Send(), send_message_cb(), FlutterViewControllerTest::sendMessage:reply:, flutter::internal::ReplyManager::SendResponseData(), FlutterViewController::setFlutterViewDidRenderCallback:, flutter::BasicMessageChannel< T >::SetMessageHandler(), flutter::MethodChannel< T >::SetMethodCallHandler(), flutter::EventChannel< T >::SetStreamHandler(), FlutterEngine::shutDownEngine, fml::testing::TEST(), flutter::TEST(), flutter::testing::TEST(), TEST(), flutter_runner::testing::TEST_F(), flutter_runner_test::TEST_F(), flutter::TEST_F(), flutter::testing::TEST_F(), ui::TEST_F(), FlutterInputPluginTestObjc::testClearClientDuringComposing, FlutterInputPluginTestObjc::testEmptyCompositionRange, FlutterViewControllerTestObjC::testFlagsChangedEventsArePropagatedIfNotHandled, FlutterViewControllerTestObjC::testKeyEventsAreNotPropagatedIfHandled, FlutterViewControllerTestObjC::testKeyEventsArePropagatedIfNotHandled, FlutterViewControllerTestObjC::testKeyEventsAreSentToFramework, flutter::DirectManipulationOwner::Update(), update_settings(), flutter::FlutterViewController::view(), flutter::FlutterWindowsEngine::window_proc_delegate_manager(), flutter::WindowWin32::WndProc(), and _FlutterTaskRunner::~_FlutterTaskRunner().

◆ pressed

bool pressed

Definition at line 120 of file keyboard_win32_unittests.cc.

◆ state_changes_afterwards

std::list<KeyStateChange> state_changes_afterwards

Definition at line 305 of file keyboard_win32_unittests.cc.

◆ text

std::u16string text

Definition at line 395 of file keyboard_win32_unittests.cc.

Referenced by flutter::TextInputManagerWin32::AbortComposing(), BENCHMARK_DEFINE_F(), txt::BENCHMARK_DEFINE_F(), BENCHMARK_F(), txt::BENCHMARK_F(), txt::BM_ParagraphBuilderAddTextChar(), txt::BM_ParagraphBuilderAddTextString(), txt::BM_ParagraphBuilderAddTextU16stringLong(), txt::BM_ParagraphBuilderAddTextU16stringShort(), txt::BM_ParagraphBuilderLongParagraphConstruct(), txt::BM_ParagraphBuilderShortParagraphConstruct(), flutter::TextInputPlugin::ComposeBeginHook(), flutter::TextInputPlugin::ComposeChangeHook(), flutter::TextInputPlugin::ComposeEndHook(), AXPlatformNodeCocoa::detach, flutter::testing::MockCanvas::didRestore(), echo_response_cb(), fake_message_cb(), fake_response_cb(), fl_json_message_codec_encode_message(), fl_standard_message_codec_write_value(), fl_string_codec_encode_message(), fl_test_codec_encode_error_envelope(), fl_test_codec_encode_method_call(), fl_test_codec_encode_success_envelope(), fl_text_input_plugin_filter_keypress_default(), ui::AXPlatformNode::GetAccessibilityMode(), flutter::FlutterPlatformNodeDelegateMac::GetLiveRegionText(), ui::AXNode::GetOrComputeLineStartOffsets(), ui::AXNodePosition::GetText(), flutter_runner::PlatformView::HandleAccessibilityChannelPlatformMessage(), flutter_runner::PlatformView::HandleFlutterTextInputChannelPlatformMessage(), FlutterTextInputPlugin::handleKeyEvent:, flutter::KeyboardManagerWin32::HandleMessage(), im_preedit_changed_cb(), im_retrieve_surrounding_cb(), FlutterTextInputPlugin::isFirstResponder, flutter::PerformanceOverlayLayer::MakeStatisticsText(), message_cb(), ui::AXPlatformNodeBase::NotifyAccessibilityEvent(), flutter::WindowWin32::OnImeComposition(), impeller::ArchiveStatement::ReadValue(), response_cb(), send_message_cb(), send_on_channel(), send_on_channel_finish(), send_response(), flutter::FlutterWindowsView::SendInitialBounds(), set_editing_state(), FlutterEngine::shutDownEngine, flutter::testing::TEST(), TEST(), txt::TEST_F(), flutter::TextInputPlugin::TextInputPlugin(), ui::AXPosition< AXNodePosition, AXNode >::ToString(), and flutter::TextInputModel::UpdateComposingText().

◆ text_method_call

std::string text_method_call

Definition at line 396 of file keyboard_win32_unittests.cc.

◆ toggled_on

bool toggled_on

Definition at line 121 of file keyboard_win32_unittests.cc.

◆ type

enum { ... } type

Referenced by base::internal::SaturateFastAsmOp< Dst, Src >::__attribute__(), flutter::TextInputManagerWin32::AbortComposing(), impeller::BlobWriter::AddBlob(), tonic::AllowedInLeafCall(), ui::AXPosition< AXNodePosition, AXNode >::AtEndOfParagraph(), ui::AXPosition< AXNodePosition, AXNode >::AtStartOfParagraph(), impeller::TextureGLES::Bind(), tonic::FfiDispatcher< void, Return(*)(Args...), function >::Call(), tonic::FfiDispatcher< C, Return(C::*)(Args...), method >::Call(), tonic::FfiDispatcher< C, Return(C::*)(Args...) const, method >::Call(), tonic::FfiDispatcher< void, void(*)(Args...), function >::Call(), tonic::FfiDispatcher< C, void(C::*)(Args...), method >::Call(), ui::AXTreeObserver::Change::Change(), base::internal::CheckedAddImpl(), base::internal::CheckedMulImpl(), base::internal::CheckedSubImpl(), flutter::ChooseCompatibleAlphaType(), DartVMInitializer::Cleanup(), base::internal::ConditionalNegate(), tonic::DartWrappable::CreateDartWrapper(), ui::AXPosition< AXNodePosition, AXNode >::CreateNextLeafTextPosition(), tonic::DartByteData::DartByteData(), FlutterEngine::destroyContext, flutter::DidFlagChange(), base::internal::CheckedAddOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >::Do(), base::internal::CheckedSubOp< T, U, typename std::enable_if< std::is_integral< T >::value &&std::is_integral< U >::value >::type >::Do(), fml::MessageLoopImpl::DoTerminate(), fl_key_channel_responder_handle_event(), fl_key_event_new_from_gdk_event(), fl_keyboard_manager_get_event_hash(), fl_standard_message_codec_read_value(), fl_standard_method_codec_decode_response(), fl_standard_method_codec_encode_error_envelope(), fl_standard_method_codec_encode_success_envelope(), fl_view_keyboard_delegate_iface_init(), FlutterEnginePostCallbackOnAllNativeThreads(), FlutterEngineSendKeyEvent(), impeller::Path::GetContourComponentAtIndex(), impeller::Path::GetCubicComponentAtIndex(), flutter::Shell::GetDartVM(), flutter::testing::EmbedderTest::GetEmbedderContext(), impeller::Path::GetLinearComponentAtIndex(), impeller::BlobLibrary::GetMapping(), impeller::Path::GetQuadraticComponentAtIndex(), impeller::compiler::GetReflectedStructSize(), impeller::compiler::Reflector::GetRuntimeStageData(), impeller::GLESShaderNameToShaderKeyName(), flutter_runner::PlatformView::HandleAccessibilityChannelPlatformMessage(), ui::AXPlatformRelationWin::Initialize(), FlutterChannelKeyResponder::initWithChannel:, FakeUIPressProxy::initWithData:key:type:timestamp:, FlutterUIPressProxy::initWithPress:withEvent:, minikin::HyphenEdit::isInsertion(), flutter::ThreadHost::ThreadHostConfig::isThreadNeeded(), flutter::KeyboardKeyEmbedderHandler::KeyboardHook(), tonic::LookupNonNullableType(), ui::AXPosition< AXNodePosition, AXNode >::MaxTextOffsetInParent(), base::internal::NegateWrapper(), flutter::normalizeScancode(), flutter_runner::PlatformView::OnKeyEvent(), flutter::CustomEncodableValue::operator const std::any &(), flutter::EmbedderEngine::PostTaskOnEngineManagedNativeThreads(), flutter::RasterCacheKey::RasterCacheKey(), flutter::Rasterize(), FlutterStandardReader::readAlignment:, flutter::StandardCodecSerializer::ReadValue(), flutter::StandardCodecSerializer::ReadValueOfType(), FlutterStandardReader::readValueOfType:, flutter::FlutterWindowsTextureRegistrar::RegisterTexture(), impeller::BufferBindingsGLES::RegisterVertexStageInput(), flutter::PlatformConfiguration::ReportTimings(), FlutterEngine::run, base::internal::SafeCompare(), base::internal::SafeUnsignedAbs(), flutter::ThreadHost::ThreadHostConfig::SetProfilerConfig(), flutter::testing::EmbedderConfigBuilder::SetRenderTargetType(), tonic::DartConverter< T, typename std::enable_if< std::is_enum< T >::value >::type >::SetReturnValue(), synchronize_lock_states_loop_body(), synthesize_simple_event(), system_sound_play(), flutter::testing::TEST(), flutter::testing::TEST_F(), tonic::DartConverter< TypedList< kTypeName, ElemType > >::ToDart(), tonic::DartConverter< T, typename std::enable_if< std::is_enum< T >::value >::type >::ToDart(), ui::AXTreeID::token(), ui::AXNodeData::ToString(), impeller::compiler::ToString(), FlutterStandardTypedData::typedDataWithFloat64:, tonic::TypedList< kTypeName, ElemType >::TypedList(), impeller::Path::UpdateContourComponentAtIndex(), impeller::Path::UpdateCubicComponentAtIndex(), impeller::Path::UpdateLinearComponentAtIndex(), impeller::Path::UpdateQuadraticComponentAtIndex(), flutter::AssetManager::UpdateResolverByType(), impeller::compiler::VertexTypeFromInputResource(), tonic::WriteDartArguments(), and tonic::WriteFfiArguments().