@@ -96,7 +96,7 @@ class MockPlatformViewDelegate : public flutter::PlatformView::Delegate {
96
96
// |flutter::PlatformView::Delegate|
97
97
void OnPlatformViewDispatchSemanticsAction (int32_t id,
98
98
flutter::SemanticsAction action,
99
- std::vector< uint8_t > args) {}
99
+ fml::MallocMapping args) {}
100
100
// |flutter::PlatformView::Delegate|
101
101
void OnPlatformViewSetSemanticsEnabled (bool enabled) {
102
102
semantics_enabled_ = enabled;
@@ -571,7 +571,7 @@ TEST_F(PlatformViewTests, EnableWireframeTest) {
571
571
std::unique_ptr<flutter::PlatformMessage> message =
572
572
std::make_unique<flutter::PlatformMessage>(
573
573
" flutter/platform_views" ,
574
- std::vector< uint8_t > (txt, txt + sizeof (txt)),
574
+ fml::MallocMapping::Copy (txt, txt + sizeof (txt)),
575
575
fml::RefPtr<flutter::PlatformMessageResponse>());
576
576
base_view->HandlePlatformMessage (std::move (message));
577
577
@@ -631,7 +631,7 @@ TEST_F(PlatformViewTests, CreateViewTest) {
631
631
std::unique_ptr<flutter::PlatformMessage> message =
632
632
std::make_unique<flutter::PlatformMessage>(
633
633
" flutter/platform_views" ,
634
- std::vector< uint8_t > (txt, txt + sizeof (txt)),
634
+ fml::MallocMapping::Copy (txt, txt + sizeof (txt)),
635
635
fml::RefPtr<flutter::PlatformMessageResponse>());
636
636
base_view->HandlePlatformMessage (std::move (message));
637
637
@@ -681,7 +681,7 @@ TEST_F(PlatformViewTests, UpdateViewTest) {
681
681
std::unique_ptr<flutter::PlatformMessage> message =
682
682
std::make_unique<flutter::PlatformMessage>(
683
683
" flutter/platform_views" ,
684
- std::vector< uint8_t > (txt, txt + sizeof (txt)),
684
+ fml::MallocMapping::Copy (txt, txt + sizeof (txt)),
685
685
fml::RefPtr<flutter::PlatformMessageResponse>());
686
686
base_view->HandlePlatformMessage (std::move (message));
687
687
@@ -738,7 +738,7 @@ TEST_F(PlatformViewTests, DestroyViewTest) {
738
738
std::unique_ptr<flutter::PlatformMessage> message =
739
739
std::make_unique<flutter::PlatformMessage>(
740
740
" flutter/platform_views" ,
741
- std::vector< uint8_t > (txt, txt + sizeof (txt)),
741
+ fml::MallocMapping::Copy (txt, txt + sizeof (txt)),
742
742
fml::RefPtr<flutter::PlatformMessageResponse>());
743
743
base_view->HandlePlatformMessage (std::move (message));
744
744
@@ -826,8 +826,9 @@ TEST_F(PlatformViewTests, ViewEventsTest) {
826
826
<< " }"
827
827
<< " }" ;
828
828
EXPECT_EQ (view_connected_expected_out.str (),
829
- std::string (view_connected_msg->data ().begin (),
830
- view_connected_msg->data ().end ()));
829
+ std::string (view_connected_msg->GetMapping (),
830
+ view_connected_msg->GetMapping () +
831
+ view_connected_msg->GetSize ()));
831
832
832
833
// ViewDisconnected event.
833
834
delegate.Reset ();
@@ -938,7 +939,7 @@ TEST_F(PlatformViewTests, RequestFocusTest) {
938
939
std::unique_ptr<flutter::PlatformMessage> message =
939
940
std::make_unique<flutter::PlatformMessage>(
940
941
" flutter/platform_views" ,
941
- std::vector< uint8_t > (buff, buff + sizeof (buff)), response);
942
+ fml::MallocMapping::Copy (buff, buff + sizeof (buff)), response);
942
943
base_view->HandlePlatformMessage (std::move (message));
943
944
944
945
RunLoopUntilIdle ();
@@ -1001,7 +1002,7 @@ TEST_F(PlatformViewTests, RequestFocusFailTest) {
1001
1002
std::unique_ptr<flutter::PlatformMessage> message =
1002
1003
std::make_unique<flutter::PlatformMessage>(
1003
1004
" flutter/platform_views" ,
1004
- std::vector< uint8_t > (buff, buff + sizeof (buff)), response);
1005
+ fml::MallocMapping::Copy (buff, buff + sizeof (buff)), response);
1005
1006
base_view->HandlePlatformMessage (std::move (message));
1006
1007
1007
1008
RunLoopUntilIdle ();
@@ -1093,8 +1094,9 @@ TEST_F(PlatformViewTests, OnKeyEvent) {
1093
1094
key_event_status = status;
1094
1095
});
1095
1096
RunLoopUntilIdle ();
1096
- const std::vector<uint8_t > data = delegate.message ()->data ();
1097
- const std::string message = std::string (data.begin (), data.end ());
1097
+ const fml::MallocMapping data = delegate.message ()->releaseData ();
1098
+ const std::string message =
1099
+ std::string (data.GetMapping (), data.GetMapping () + data.GetSize ());
1098
1100
1099
1101
EXPECT_EQ (event.expected_platform_message , message);
1100
1102
EXPECT_EQ (key_event_status, event.expected_key_event_status );
0 commit comments