6#include <rapidjson/document.h>
19#include "gmock/gmock.h"
20#include "gtest/gtest.h"
27 : text_input_plugin(text_input_plugin) {}
30 text_input_plugin->view_id_ =
view_id;
35 bool HasActiveModel() {
return text_input_plugin->active_model_ !=
nullptr; }
46using ::testing::Return;
49static constexpr int kHandledScanCode = 20;
50static constexpr int kUnhandledScanCode = 21;
52static constexpr int kDefaultClientId = 42;
54static constexpr char kChannelName[] =
"flutter/textinput";
56static constexpr char kViewId[] =
"viewId";
59static constexpr char kTextKey[] =
"text";
67 "TextInputClient.updateEditingState";
69static std::unique_ptr<std::vector<uint8_t>> CreateResponse(
bool handled) {
71 std::make_unique<rapidjson::Document>(rapidjson::kObjectType);
72 auto&
allocator = response_doc->GetAllocator();
73 response_doc->AddMember(
"handled", handled,
allocator);
77static std::unique_ptr<rapidjson::Document> EncodedClientConfig(
79 std::string input_action) {
80 auto arguments = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
81 auto&
allocator = arguments->GetAllocator();
82 arguments->PushBack(kDefaultClientId,
allocator);
84 rapidjson::Value config(rapidjson::kObjectType);
85 config.AddMember(
"inputAction", input_action,
allocator);
88 rapidjson::Value type_info(rapidjson::kObjectType);
90 config.AddMember(
"inputType", type_info,
allocator);
96static std::unique_ptr<rapidjson::Document> EncodedEditingState(
98 TextRange selection) {
99 auto model = std::make_unique<TextInputModel>();
100 model->SetText(
text);
101 model->SetSelection(selection);
103 auto arguments = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
104 auto&
allocator = arguments->GetAllocator();
105 arguments->PushBack(kDefaultClientId,
allocator);
107 rapidjson::Value editing_state(rapidjson::kObjectType);
115 model->composing() ? model->composing_range().base() : -1;
116 int composing_extent =
117 model->composing() ? model->composing_range().extent() : -1;
121 rapidjson::Value(model->GetText(),
allocator).Move(),
123 arguments->PushBack(editing_state,
allocator);
128class MockFlutterWindowsView :
public FlutterWindowsView {
131 std::unique_ptr<WindowBindingHandler>
window)
139 MOCK_METHOD(
void, OnCursorRectUpdated, (
const Rect&), (
override));
140 MOCK_METHOD(
void, OnResetImeComposing, (), (
override));
148class TextInputPluginTest :
public WindowsTest {
150 TextInputPluginTest() =
default;
151 virtual ~TextInputPluginTest() =
default;
154 FlutterWindowsEngine*
engine() {
return engine_.get(); }
155 MockFlutterWindowsView*
view() {
return view_.get(); }
156 MockWindowBindingHandler*
window() {
return window_; }
158 void UseHeadlessEngine() {
159 FlutterWindowsEngineBuilder builder{
GetContext()};
161 engine_ = builder.Build();
164 void UseEngineWithView() {
165 FlutterWindowsEngineBuilder builder{
GetContext()};
167 auto window = std::make_unique<MockWindowBindingHandler>();
170 EXPECT_CALL(*window_, SetView).Times(1);
171 EXPECT_CALL(*window, GetWindowHandle).WillRepeatedly(Return(
nullptr));
173 engine_ = builder.Build();
174 view_ = std::make_unique<MockFlutterWindowsView>(engine_.get(),
177 EngineModifier modifier{engine_.get()};
178 modifier.SetViewById(view_.get(), 456);
181 std::unique_ptr<MockFlutterWindowsView> AddViewWithId(
int view_id) {
182 EXPECT_NE(engine_,
nullptr);
183 auto window = std::make_unique<MockWindowBindingHandler>();
184 EXPECT_CALL(*window, SetView).Times(1);
185 EXPECT_CALL(*window, GetWindowHandle).WillRepeatedly(Return(
nullptr));
186 auto view = std::make_unique<MockFlutterWindowsView>(engine_.get(),
189 EngineModifier modifier{engine_.get()};
190 modifier.SetViewById(view_.get(),
view_id);
195 std::unique_ptr<FlutterWindowsEngine> engine_;
196 std::unique_ptr<MockFlutterWindowsView> view_;
197 MockWindowBindingHandler* window_;
202TEST_F(TextInputPluginTest, TextMethodsWorksWithEmptyModel) {
205 auto handled_message = CreateResponse(
true);
206 auto unhandled_message = CreateResponse(
false);
207 int received_scancode = 0;
209 TestBinaryMessenger messenger(
210 [&received_scancode, &handled_message, &unhandled_message](
214 int redispatch_scancode = 0;
217 handler.KeyboardHook(VK_RETURN, 100, WM_KEYDOWN,
'\n',
false,
false);
220 text.push_back(
'\n');
227TEST_F(TextInputPluginTest, ClearClientResetsComposing) {
230 TestBinaryMessenger messenger([](
const std::string&
channel,
231 const uint8_t*
message,
size_t message_size,
233 BinaryReply reply_handler = [](
const uint8_t* reply,
size_t reply_size) {};
236 TextInputPluginModifier modifier(&
handler);
237 modifier.SetViewId(456);
239 EXPECT_CALL(*
view(), OnResetImeComposing());
242 auto message = codec.EncodeMethodCall({
"TextInput.clearClient",
nullptr});
244 message->size(), reply_handler);
248TEST_F(TextInputPluginTest, ClearClientRequiresView) {
251 TestBinaryMessenger messenger([](
const std::string&
channel,
252 const uint8_t*
message,
size_t message_size,
256 BinaryReply reply_handler = [&reply](
const uint8_t* reply_bytes,
258 reply = std::string(
reinterpret_cast<const char*
>(reply_bytes), reply_size);
264 auto message = codec.EncodeMethodCall({
"TextInput.clearClient",
nullptr});
266 message->size(), reply_handler);
270 "[\"Internal Consistency Error\",\"Text input is not available because "
271 "view with view_id=0 cannot be found\",null]");
276TEST_F(TextInputPluginTest, VerifyComposingSendStateUpdate) {
279 bool sent_message =
false;
280 TestBinaryMessenger messenger(
281 [&sent_message](
const std::string&
channel,
const uint8_t*
message,
284 BinaryReply reply_handler = [](
const uint8_t* reply,
size_t reply_size) {};
291 auto arguments = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
292 auto&
allocator = arguments->GetAllocator();
293 arguments->PushBack(kDefaultClientId,
allocator);
294 rapidjson::Value config(rapidjson::kObjectType);
295 config.AddMember(
"inputAction",
"done",
allocator);
296 config.AddMember(
"inputType",
"text",
allocator);
301 codec.EncodeMethodCall({
"TextInput.setClient", std::move(arguments)});
302 messenger.SimulateEngineMessage(
"flutter/textinput",
message->data(),
303 message->size(), reply_handler);
306 sent_message =
false;
308 EXPECT_TRUE(sent_message);
311 sent_message =
false;
312 handler.ComposeChangeHook(u
"4", 1);
313 EXPECT_TRUE(sent_message);
323 sent_message =
false;
325 EXPECT_FALSE(sent_message);
328 sent_message =
false;
330 EXPECT_TRUE(sent_message);
333TEST_F(TextInputPluginTest, VerifyInputActionNewlineInsertNewLine) {
337 std::vector<std::string> messages;
339 TestBinaryMessenger messenger(
342 std::string last_message(
reinterpret_cast<const char*
>(
message),
344 messages.push_back(last_message);
346 BinaryReply reply_handler = [](
const uint8_t* reply,
size_t reply_size) {};
353 auto set_client_arguments =
354 EncodedClientConfig(
"TextInputType.multiline",
"TextInputAction.newline");
355 auto message = codec.EncodeMethodCall(
356 {
"TextInput.setClient", std::move(set_client_arguments)});
357 messenger.SimulateEngineMessage(
"flutter/textinput",
message->data(),
358 message->size(), reply_handler);
361 handler.KeyboardHook(VK_RETURN, 100, WM_KEYDOWN,
'\n',
false,
false);
365 EXPECT_EQ(messages.size(), 2);
368 auto encoded_arguments = EncodedEditingState(
"\n", TextRange(1));
369 auto update_state_message = codec.EncodeMethodCall(
372 EXPECT_TRUE(std::equal(update_state_message->begin(),
373 update_state_message->end(),
374 messages.front().begin()));
377 auto arguments = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
378 auto&
allocator = arguments->GetAllocator();
379 arguments->PushBack(kDefaultClientId,
allocator);
382 auto invoke_action_message = codec.EncodeMethodCall(
383 {
"TextInputClient.performAction", std::move(arguments)});
385 EXPECT_TRUE(std::equal(invoke_action_message->begin(),
386 invoke_action_message->end(),
387 messages.back().begin()));
391TEST_F(TextInputPluginTest, VerifyInputActionSendDoesNotInsertNewLine) {
394 std::vector<std::vector<uint8_t>> messages;
396 TestBinaryMessenger messenger(
399 int length =
static_cast<int>(message_size);
400 std::vector<uint8_t> last_message(
length);
401 memcpy(&last_message[0], &
message[0],
length *
sizeof(uint8_t));
402 messages.push_back(last_message);
404 BinaryReply reply_handler = [](
const uint8_t* reply,
size_t reply_size) {};
411 auto set_client_arguments =
412 EncodedClientConfig(
"TextInputType.multiline",
"TextInputAction.send");
413 auto message = codec.EncodeMethodCall(
414 {
"TextInput.setClient", std::move(set_client_arguments)});
415 messenger.SimulateEngineMessage(
"flutter/textinput",
message->data(),
416 message->size(), reply_handler);
419 handler.KeyboardHook(VK_RETURN, 100, WM_KEYDOWN,
'\n',
false,
false);
422 EXPECT_EQ(messages.size(), 1);
425 auto arguments = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
426 auto&
allocator = arguments->GetAllocator();
427 arguments->PushBack(kDefaultClientId,
allocator);
430 auto invoke_action_message = codec.EncodeMethodCall(
431 {
"TextInputClient.performAction", std::move(arguments)});
433 EXPECT_TRUE(std::equal(invoke_action_message->begin(),
434 invoke_action_message->end(),
435 messages.front().begin()));
438TEST_F(TextInputPluginTest, SetClientRequiresViewId) {
441 TestBinaryMessenger messenger([](
const std::string&
channel,
442 const uint8_t*
message,
size_t message_size,
447 auto args = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
451 rapidjson::Value client_config(rapidjson::kObjectType);
458 BinaryReply reply_handler = [&reply](
const uint8_t* reply_bytes,
460 reply = std::string(
reinterpret_cast<const char*
>(reply_bytes), reply_size);
463 EXPECT_TRUE(messenger.SimulateEngineMessage(
kChannelName, encoded->data(),
464 encoded->size(), reply_handler));
467 "[\"Bad Arguments\",\"Could not set client, view ID is null.\",null]");
470TEST_F(TextInputPluginTest, SetClientRequiresViewIdToBeInteger) {
473 TestBinaryMessenger messenger([](
const std::string&
channel,
474 const uint8_t*
message,
size_t message_size,
479 auto args = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
483 rapidjson::Value client_config(rapidjson::kObjectType);
491 BinaryReply reply_handler = [&reply](
const uint8_t* reply_bytes,
493 reply = std::string(
reinterpret_cast<const char*
>(reply_bytes), reply_size);
496 EXPECT_TRUE(messenger.SimulateEngineMessage(
kChannelName, encoded->data(),
497 encoded->size(), reply_handler));
500 "[\"Bad Arguments\",\"Could not set client, view ID is null.\",null]");
503TEST_F(TextInputPluginTest, TextEditingWorksWithDeltaModel) {
506 auto handled_message = CreateResponse(
true);
507 auto unhandled_message = CreateResponse(
false);
508 int received_scancode = 0;
510 TestBinaryMessenger messenger(
511 [&received_scancode, &handled_message, &unhandled_message](
515 int redispatch_scancode = 0;
518 auto args = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
522 rapidjson::Value client_config(rapidjson::kObjectType);
530 EXPECT_TRUE(messenger.SimulateEngineMessage(
532 [](
const uint8_t* reply,
size_t reply_size) {}));
534 handler.KeyboardHook(VK_RETURN, 100, WM_KEYDOWN,
'\n',
false,
false);
537 text.push_back(
'\n');
541 handler.KeyboardHook(0x4E, 100, WM_KEYDOWN,
'n',
false,
false);
543 std::u16string textN;
545 handler.ComposeChangeHook(textN, 1);
546 handler.KeyboardHook(0x49, 100, WM_KEYDOWN,
'i',
false,
false);
547 std::u16string textNi;
550 handler.ComposeChangeHook(textNi, 2);
551 handler.KeyboardHook(VK_RETURN, 100, WM_KEYDOWN,
'\n',
false,
false);
552 std::u16string textChineseCharacter;
553 text.push_back(u
'\u4F60');
554 handler.ComposeChangeHook(textChineseCharacter, 1);
562TEST_F(TextInputPluginTest, CompositionCursorPos) {
565 int selection_base = -1;
566 TestBinaryMessenger messenger([&](
const std::string&
channel,
572 const auto&
args = *method->arguments();
573 const auto& editing_state =
args[1];
576 ASSERT_NE(
base, editing_state.MemberEnd());
577 ASSERT_TRUE(
base->value.IsInt());
578 ASSERT_NE(extent, editing_state.MemberEnd());
579 ASSERT_TRUE(extent->value.IsInt());
580 selection_base =
base->value.GetInt();
581 EXPECT_EQ(extent->value.GetInt(), selection_base);
585 TextInputPlugin plugin(&messenger,
engine());
587 auto args = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
590 rapidjson::Value client_config(rapidjson::kObjectType);
595 EXPECT_TRUE(messenger.SimulateEngineMessage(
597 [](
const uint8_t* reply,
size_t reply_size) {}));
599 plugin.ComposeBeginHook();
600 EXPECT_EQ(selection_base, 0);
601 plugin.ComposeChangeHook(u
"abc", 3);
602 EXPECT_EQ(selection_base, 3);
604 plugin.ComposeCommitHook();
605 plugin.ComposeEndHook();
606 EXPECT_EQ(selection_base, 3);
608 plugin.ComposeBeginHook();
609 plugin.ComposeChangeHook(u
"1", 1);
610 EXPECT_EQ(selection_base, 4);
612 plugin.ComposeChangeHook(u
"12", 2);
613 EXPECT_EQ(selection_base, 5);
615 plugin.ComposeChangeHook(u
"12", 1);
616 EXPECT_EQ(selection_base, 4);
618 plugin.ComposeChangeHook(u
"12", 2);
619 EXPECT_EQ(selection_base, 5);
622TEST_F(TextInputPluginTest, TransformCursorRect) {
632 double ime_width = 50;
633 double ime_height = 60;
636 std::array<std::array<double, 4>, 4> editabletext_transform = {
637 1.0, 0.0, 0.0, view_x,
638 0.0, 1.0, 0.0, view_y,
642 TestBinaryMessenger messenger([](
const std::string&
channel,
643 const uint8_t*
message,
size_t message_size,
645 BinaryReply reply_handler = [](
const uint8_t* reply,
size_t reply_size) {};
648 TextInputPluginModifier modifier(&
handler);
649 modifier.SetViewId(456);
653 EXPECT_CALL(*
view(), OnCursorRectUpdated(Rect{{view_x, view_y}, {0, 0}}));
657 std::make_unique<rapidjson::Document>(rapidjson::kObjectType);
658 auto&
allocator = arguments->GetAllocator();
660 rapidjson::Value transoform(rapidjson::kArrayType);
661 for (
int i = 0;
i < 4 * 4;
i++) {
663 transoform.PushBack(editabletext_transform[
i % 4][
i / 4],
allocator);
666 arguments->AddMember(
"transform", transoform,
allocator);
668 auto message = codec.EncodeMethodCall(
669 {
"TextInput.setEditableSizeAndTransform", std::move(arguments)});
671 message->size(), reply_handler);
675 OnCursorRectUpdated(Rect{{view_x + ime_x, view_y + ime_y},
676 {ime_width, ime_height}}));
680 std::make_unique<rapidjson::Document>(rapidjson::kObjectType);
681 auto&
allocator = arguments->GetAllocator();
683 arguments->AddMember(
"x", ime_x,
allocator);
684 arguments->AddMember(
"y", ime_y,
allocator);
685 arguments->AddMember(
"width", ime_width,
allocator);
686 arguments->AddMember(
"height", ime_height,
allocator);
688 auto message = codec.EncodeMethodCall(
689 {
"TextInput.setMarkedTextRect", std::move(arguments)});
691 message->size(), reply_handler);
695TEST_F(TextInputPluginTest, SetMarkedTextRectRequiresView) {
698 TestBinaryMessenger messenger([](
const std::string&
channel,
699 const uint8_t*
message,
size_t message_size,
703 BinaryReply reply_handler = [&reply](
const uint8_t* reply_bytes,
705 reply = std::string(
reinterpret_cast<const char*
>(reply_bytes), reply_size);
713 std::make_unique<rapidjson::Document>(rapidjson::kObjectType);
714 auto&
allocator = arguments->GetAllocator();
718 arguments->AddMember(
"width", 0,
allocator);
719 arguments->AddMember(
"height", 0,
allocator);
721 auto message = codec.EncodeMethodCall(
722 {
"TextInput.setMarkedTextRect", std::move(arguments)});
724 message->size(), reply_handler);
728 "[\"Internal Consistency Error\",\"Text input is not available because "
729 "view with view_id=0 cannot be found\",null]");
732TEST_F(TextInputPluginTest, SetAndUseMultipleClients) {
736 bool sent_message =
false;
737 TestBinaryMessenger messenger(
738 [&sent_message](
const std::string&
channel,
const uint8_t*
message,
744 auto const set_client_and_send_message = [&](
int client_id,
int view_id) {
745 auto args = std::make_unique<rapidjson::Document>(rapidjson::kArrayType);
749 rapidjson::Value client_config(rapidjson::kObjectType);
757 BinaryReply reply_handler = [&reply](
const uint8_t* reply_bytes,
760 std::string(
reinterpret_cast<const char*
>(reply_bytes), reply_size);
763 EXPECT_TRUE(messenger.SimulateEngineMessage(
764 kChannelName, encoded->data(), encoded->size(), reply_handler));
766 sent_message =
false;
768 EXPECT_TRUE(sent_message);
769 sent_message =
false;
770 handler.ComposeChangeHook(u
"4", 1);
771 EXPECT_TRUE(sent_message);
772 sent_message =
false;
774 EXPECT_FALSE(sent_message);
775 sent_message =
false;
777 EXPECT_TRUE(sent_message);
780 set_client_and_send_message(123, 456);
781 set_client_and_send_message(123, 789);
786TEST_F(TextInputPluginTest, OnViewRemovedResetsActiveView) {
789 TestBinaryMessenger messenger([](
const std::string&
channel,
790 const uint8_t*
message,
size_t message_size,
792 BinaryReply reply_handler = [](
const uint8_t* reply,
size_t reply_size) {};
795 TextInputPluginModifier modifier(&
handler);
796 modifier.SetViewId(456);
800 auto set_client_message = codec.EncodeMethodCall(
801 {
"TextInput.setClient",
802 EncodedClientConfig(
"TextInputType.text",
"TextInputAction.done")});
803 messenger.SimulateEngineMessage(
kChannelName, set_client_message->data(),
804 set_client_message->size(), reply_handler);
806 EXPECT_TRUE(modifier.HasActiveModel());
807 EXPECT_EQ(modifier.GetViewId(), 456);
812 EXPECT_FALSE(modifier.HasActiveModel());
813 EXPECT_EQ(modifier.GetViewId(), 0);
818TEST_F(TextInputPluginTest, OnViewRemovedIgnoresNonActiveView) {
821 TestBinaryMessenger messenger([](
const std::string&
channel,
822 const uint8_t*
message,
size_t message_size,
824 BinaryReply reply_handler = [](
const uint8_t* reply,
size_t reply_size) {};
827 TextInputPluginModifier modifier(&
handler);
828 modifier.SetViewId(456);
832 auto set_client_message = codec.EncodeMethodCall(
833 {
"TextInput.setClient",
834 EncodedClientConfig(
"TextInputType.text",
"TextInputAction.done")});
835 messenger.SimulateEngineMessage(
kChannelName, set_client_message->data(),
836 set_client_message->size(), reply_handler);
838 EXPECT_TRUE(modifier.HasActiveModel());
839 EXPECT_EQ(modifier.GetViewId(), 456);
845 EXPECT_TRUE(modifier.HasActiveModel());
846 EXPECT_EQ(modifier.GetViewId(), 456);
850TEST_F(TextInputPluginTest, OnViewRemovedIgnoresImplicitView) {
853 TestBinaryMessenger messenger([](
const std::string&
channel,
854 const uint8_t*
message,
size_t message_size,
856 BinaryReply reply_handler = [](
const uint8_t* reply,
size_t reply_size) {};
859 TextInputPluginModifier modifier(&
handler);
864 auto set_client_message = codec.EncodeMethodCall(
865 {
"TextInput.setClient",
866 EncodedClientConfig(
"TextInputType.text",
"TextInputAction.done")});
867 messenger.SimulateEngineMessage(
kChannelName, set_client_message->data(),
868 set_client_message->size(), reply_handler);
870 EXPECT_TRUE(modifier.HasActiveModel());
877 EXPECT_TRUE(modifier.HasActiveModel());
FlutterWindowsView(FlutterViewId view_id, FlutterWindowsEngine *engine, std::unique_ptr< WindowBindingHandler > window_binding, bool is_sized_to_content, const BoxConstraints &box_constraints, FlutterWindowsViewSizingDelegate *sizing_delegate=nullptr, std::shared_ptr< WindowsProcTable > windows_proc_table=nullptr)
static const JsonMessageCodec & GetInstance()
static const JsonMethodCodec & GetInstance()
std::unique_ptr< std::vector< uint8_t > > EncodeMessage(const T &message) const
std::unique_ptr< MethodCall< T > > DecodeMethodCall(const uint8_t *message, size_t message_size) const
std::unique_ptr< std::vector< uint8_t > > EncodeMethodCall(const MethodCall< T > &method_call) const
FlutterViewId GetViewId()
void SetViewId(FlutterViewId view_id)
TextInputPluginModifier(TextInputPlugin *text_input_plugin)
~MockFlutterWindowsView()
MOCK_METHOD(void, NotifyWinEventWrapper,(ui::AXPlatformNodeWin *, ax::mojom::Event),(override))
MockFlutterWindowsView(FlutterWindowsEngine *engine, std::unique_ptr< WindowBindingHandler > wbh)
WindowsTestContext & GetContext()
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
const gchar FlBinaryMessengerMessageHandler handler
G_BEGIN_DECLS FlutterViewId view_id
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
static constexpr char kUpdateEditingStateMethod[]
static constexpr char kAffinityDownstream[]
std::shared_ptr< ImpellerAllocator > allocator
static NSString *const kEnableDeltaModel
static NSString *const kSetClientMethod
static constexpr char kScanCodeKey[]
constexpr char kTextPlainFormat[]
Clipboard plain text format.
static NSString *const kViewId
static NSString *const kTextKey
static NSString *const kSelectionBaseKey
static NSString *const kSelectionAffinityKey
static NSString *const kComposingExtentKey
static NSString *const kSelectionExtentKey
static NSString *const kComposingBaseKey
static NSString *const kSelectionIsDirectionalKey
TEST_F(DisplayListTest, Defaults)
constexpr int64_t kImplicitViewId
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
std::function< void(const uint8_t *reply, size_t reply_size)> BinaryReply