Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit cc96f0c

Browse files
committed
Define a constant for text input client id
1 parent fdad6d4 commit cc96f0c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

shell/platform/windows/text_input_plugin_unittest.cc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ static constexpr char kScanCodeKey[] = "scanCode";
2323
static constexpr int kHandledScanCode = 20;
2424
static constexpr int kUnhandledScanCode = 21;
2525
static constexpr char kTextPlainFormat[] = "text/plain";
26+
static constexpr int kDefaultClientId = 42;
2627
// Should be identical to constants in text_input_plugin.cc.
2728
static constexpr char kChannelName[] = "flutter/textinput";
2829
static constexpr char kEnableDeltaModel[] = "enableDeltaModel";
@@ -49,7 +50,7 @@ static std::unique_ptr<rapidjson::Document> EncodedClientConfig(
4950
std::string input_action) {
5051
auto arguments = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
5152
auto& allocator = arguments->GetAllocator();
52-
arguments->PushBack(42, allocator);
53+
arguments->PushBack(kDefaultClientId, allocator);
5354

5455
rapidjson::Value config(rapidjson::kObjectType);
5556
config.AddMember("inputAction", input_action, allocator);
@@ -71,7 +72,7 @@ static std::unique_ptr<rapidjson::Document> EncodedEditingState(
7172

7273
auto arguments = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
7374
auto& allocator = arguments->GetAllocator();
74-
arguments->PushBack(42, allocator);
75+
arguments->PushBack(kDefaultClientId, allocator);
7576

7677
rapidjson::Value editing_state(rapidjson::kObjectType);
7778
editing_state.AddMember(kSelectionAffinityKey, kAffinityDownstream,
@@ -167,7 +168,7 @@ TEST(TextInputPluginTest, VerifyComposingSendStateUpdate) {
167168
// Call TextInput.setClient to initialize the TextInputModel.
168169
auto arguments = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
169170
auto& allocator = arguments->GetAllocator();
170-
arguments->PushBack(42, allocator);
171+
arguments->PushBack(kDefaultClientId, allocator);
171172
rapidjson::Value config(rapidjson::kObjectType);
172173
config.AddMember("inputAction", "done", allocator);
173174
config.AddMember("inputType", "text", allocator);
@@ -251,7 +252,7 @@ TEST(TextInputPluginTest, VerifyInputActionNewlineInsertNewLine) {
251252
// TextInputClient.performAction should have been called.
252253
auto arguments = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
253254
auto& allocator = arguments->GetAllocator();
254-
arguments->PushBack(42, allocator);
255+
arguments->PushBack(kDefaultClientId, allocator);
255256
arguments->PushBack(
256257
rapidjson::Value("TextInputAction.newline", allocator).Move(), allocator);
257258
auto invoke_action_message = codec.EncodeMethodCall(
@@ -298,7 +299,7 @@ TEST(TextInputPluginTest, VerifyInputActionSendDoesNotInsertNewLine) {
298299
// TextInputClient.performAction should have been called.
299300
auto arguments = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
300301
auto& allocator = arguments->GetAllocator();
301-
arguments->PushBack(42, allocator);
302+
arguments->PushBack(kDefaultClientId, allocator);
302303
arguments->PushBack(
303304
rapidjson::Value("TextInputAction.send", allocator).Move(), allocator);
304305
auto invoke_action_message = codec.EncodeMethodCall(

0 commit comments

Comments
 (0)