From 935a3df4206c85110373238d2805f3850e8cfa95 Mon Sep 17 00:00:00 2001 From: George Wright Date: Fri, 23 Oct 2020 17:58:52 -0700 Subject: [PATCH 1/7] Add plumbing for command line arguments on Windows --- .../windows/client_wrapper/flutter_engine.cc | 12 ++++++++++++ .../client_wrapper/include/flutter/dart_project.h | 14 ++++++++++++++ shell/platform/windows/flutter_project_bundle.cc | 4 ++++ shell/platform/windows/flutter_project_bundle.h | 6 ++++++ shell/platform/windows/flutter_windows_engine.cc | 8 ++++++++ shell/platform/windows/public/flutter_windows.h | 5 +++++ 6 files changed, 49 insertions(+) diff --git a/shell/platform/windows/client_wrapper/flutter_engine.cc b/shell/platform/windows/client_wrapper/flutter_engine.cc index f6073f7f849de..390ef1ef7b742 100644 --- a/shell/platform/windows/client_wrapper/flutter_engine.cc +++ b/shell/platform/windows/client_wrapper/flutter_engine.cc @@ -17,6 +17,18 @@ FlutterEngine::FlutterEngine(const DartProject& project) { c_engine_properties.icu_data_path = project.icu_data_path().c_str(); c_engine_properties.aot_library_path = project.aot_library_path().c_str(); + const std::vector& entrypoint_args = + project.dart_entrypoint_arguments(); + std::vector entrypoint_argv; + std::transform( + entrypoint_args.begin(), entrypoint_args.end(), + std::back_inserter(entrypoint_argv), + [](const std::string& arg) -> const char* { return arg.c_str(); }); + + c_engine_properties.dart_entrypoint_argc = (int)entrypoint_argv.size(); + c_engine_properties.dart_entrypoint_argv = + entrypoint_argv.size() > 0 ? entrypoint_argv.data() : nullptr; + engine_ = FlutterDesktopEngineCreate(c_engine_properties); auto core_messenger = FlutterDesktopEngineGetMessenger(engine_); diff --git a/shell/platform/windows/client_wrapper/include/flutter/dart_project.h b/shell/platform/windows/client_wrapper/include/flutter/dart_project.h index 9f064417bf028..9dff236ff2cd5 100644 --- a/shell/platform/windows/client_wrapper/include/flutter/dart_project.h +++ b/shell/platform/windows/client_wrapper/include/flutter/dart_project.h @@ -29,6 +29,18 @@ class DartProject { ~DartProject() = default; + // Sets the command line arguments that should be passed to the Dart + // entrypoint. + void set_dart_entrypoint_arguments(std::vector arguments) { + dart_entrypoint_arguments_ = std::move(arguments); + } + + // Returns any command line arguments that should be passed to the Dart + // entrypoint. + const std::vector& dart_entrypoint_arguments() const { + return dart_entrypoint_arguments_; + } + private: // Accessors for internals are private, so that they can be changed if more // flexible options for project structures are needed later without it @@ -49,6 +61,8 @@ class DartProject { // The path to the AOT library. This will always return a path, but non-AOT // builds will not be expected to actually have a library at that path. std::wstring aot_library_path_; + // The list of arguments to pass through to the Dart entrypoint. + std::vector dart_entrypoint_arguments_; }; } // namespace flutter diff --git a/shell/platform/windows/flutter_project_bundle.cc b/shell/platform/windows/flutter_project_bundle.cc index 4b2c8dfef69be..fed366feba43c 100644 --- a/shell/platform/windows/flutter_project_bundle.cc +++ b/shell/platform/windows/flutter_project_bundle.cc @@ -20,6 +20,10 @@ FlutterProjectBundle::FlutterProjectBundle( aot_library_path_ = std::filesystem::path(properties.aot_library_path); } + for (int i = 0; i < properties.dart_entrypoint_argc; i++) { + dart_entrypoint_arguments_.push_back(std::string(properties.dart_entrypoint_argv[i])); + } + // Resolve any relative paths. if (assets_path_.is_relative() || icu_path_.is_relative() || (!aot_library_path_.empty() && aot_library_path_.is_relative())) { diff --git a/shell/platform/windows/flutter_project_bundle.h b/shell/platform/windows/flutter_project_bundle.h index fc77adfe8c00b..67dcab0554a77 100644 --- a/shell/platform/windows/flutter_project_bundle.h +++ b/shell/platform/windows/flutter_project_bundle.h @@ -51,12 +51,18 @@ class FlutterProjectBundle { // Logs and returns nullptr on failure. UniqueAotDataPtr LoadAotData(); + // Returns the command line arguments to be passed through to the Dart entrypoint. + const std::vector& dart_entrypoint_arguments() const { return dart_entrypoint_arguments_; } + private: std::filesystem::path assets_path_; std::filesystem::path icu_path_; // Path to the AOT library file, if any. std::filesystem::path aot_library_path_; + + // Dart entrypoint arguments. + std::vector dart_entrypoint_arguments_; }; } // namespace flutter diff --git a/shell/platform/windows/flutter_windows_engine.cc b/shell/platform/windows/flutter_windows_engine.cc index d70ca504c1b56..05dd2538afb00 100644 --- a/shell/platform/windows/flutter_windows_engine.cc +++ b/shell/platform/windows/flutter_windows_engine.cc @@ -143,6 +143,12 @@ bool FlutterWindowsEngine::RunWithEntrypoint(const char* entrypoint) { switches.begin(), switches.end(), std::back_inserter(argv), [](const std::string& arg) -> const char* { return arg.c_str(); }); + const std::vector& entrypoint_args = project_->dart_entrypoint_arguments(); + std::vector entrypoint_argv; + std::transform( + entrypoint_args.begin(), entrypoint_args.end(), std::back_inserter(entrypoint_argv), + [](const std::string& arg) -> const char* { return arg.c_str(); }); + // Configure task runners. FlutterTaskRunnerDescription platform_task_runner = {}; platform_task_runner.struct_size = sizeof(FlutterTaskRunnerDescription); @@ -166,6 +172,8 @@ bool FlutterWindowsEngine::RunWithEntrypoint(const char* entrypoint) { args.icu_data_path = icu_path_string.c_str(); args.command_line_argc = static_cast(argv.size()); args.command_line_argv = argv.size() > 0 ? argv.data() : nullptr; + args.dart_entrypoint_argc = static_cast(entrypoint_argv.size()); + args.dart_entrypoint_argv = entrypoint_argv.size() > 0 ? entrypoint_argv.data() : nullptr; args.platform_message_callback = [](const FlutterPlatformMessage* engine_message, void* user_data) -> void { diff --git a/shell/platform/windows/public/flutter_windows.h b/shell/platform/windows/public/flutter_windows.h index 25414937e54f6..bb10bd950117e 100644 --- a/shell/platform/windows/public/flutter_windows.h +++ b/shell/platform/windows/public/flutter_windows.h @@ -46,6 +46,11 @@ typedef struct { // containing the executable. This can be nullptr for a non-AOT build, as // it will be ignored in that case. const wchar_t* aot_library_path; + + // nullptr-terminated array of Dart entrypoint arguments. This is deep copied + // during the call to FlutterDesktopEngineCreate. + int dart_entrypoint_argc; + const char** dart_entrypoint_argv; } FlutterDesktopEngineProperties; // ========== View Controller ========== From fd787a474a040866b8bfb77ace0234a22aeaf966 Mon Sep 17 00:00:00 2001 From: George Wright Date: Mon, 26 Oct 2020 12:48:08 -0700 Subject: [PATCH 2/7] Review updates --- shell/platform/windows/client_wrapper/flutter_engine.cc | 2 +- shell/platform/windows/public/flutter_windows.h | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/shell/platform/windows/client_wrapper/flutter_engine.cc b/shell/platform/windows/client_wrapper/flutter_engine.cc index 390ef1ef7b742..a7d532e51bebe 100644 --- a/shell/platform/windows/client_wrapper/flutter_engine.cc +++ b/shell/platform/windows/client_wrapper/flutter_engine.cc @@ -25,7 +25,7 @@ FlutterEngine::FlutterEngine(const DartProject& project) { std::back_inserter(entrypoint_argv), [](const std::string& arg) -> const char* { return arg.c_str(); }); - c_engine_properties.dart_entrypoint_argc = (int)entrypoint_argv.size(); + c_engine_properties.dart_entrypoint_argc = static_cast(entrypoint_argv.size()); c_engine_properties.dart_entrypoint_argv = entrypoint_argv.size() > 0 ? entrypoint_argv.data() : nullptr; diff --git a/shell/platform/windows/public/flutter_windows.h b/shell/platform/windows/public/flutter_windows.h index bb10bd950117e..2c53e1740df52 100644 --- a/shell/platform/windows/public/flutter_windows.h +++ b/shell/platform/windows/public/flutter_windows.h @@ -47,9 +47,11 @@ typedef struct { // it will be ignored in that case. const wchar_t* aot_library_path; - // nullptr-terminated array of Dart entrypoint arguments. This is deep copied - // during the call to FlutterDesktopEngineCreate. + // Number of elements in the array passed in as dart_entrypoint_argv. int dart_entrypoint_argc; + + // Array of Dart entrypoint arguments. This is deep copied during the call + // to FlutterDesktopEngineCreate. const char** dart_entrypoint_argv; } FlutterDesktopEngineProperties; From b174d63ec6de6d6a3ffd91fa8bd6a5ee961ed3da Mon Sep 17 00:00:00 2001 From: George Wright Date: Mon, 26 Oct 2020 13:08:01 -0700 Subject: [PATCH 3/7] Add a unit test for setting dart entrypoint args in the client wrapper --- .../flutter_engine_unittests.cc | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc b/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc index 8fc43b7402db3..85e53f0886870 100644 --- a/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc +++ b/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc @@ -20,6 +20,7 @@ class TestFlutterWindowsApi : public testing::StubFlutterWindowsApi { FlutterDesktopEngineRef EngineCreate( const FlutterDesktopEngineProperties& engine_properties) { create_called_ = true; + engine_properties_ = engine_properties; return reinterpret_cast(1); } @@ -49,11 +50,14 @@ class TestFlutterWindowsApi : public testing::StubFlutterWindowsApi { bool reload_fonts_called() { return reload_fonts_called_; } + FlutterDesktopEngineProperties& engine_properties() { return engine_properties_; } + private: bool create_called_ = false; bool run_called_ = false; bool destroy_called_ = false; bool reload_fonts_called_ = false; + FlutterDesktopEngineProperties engine_properties_; }; } // namespace @@ -121,4 +125,20 @@ TEST(FlutterEngineTest, GetMessenger) { EXPECT_NE(engine.messenger(), nullptr); } +TEST(FlutterEngineTest, DartEntrypointArgs) { + DartProject project(L"data"); + std::vector arguments; + arguments.push_back("one"); + arguments.push_back("two"); + project.set_dart_entrypoint_arguments(arguments); + testing::ScopedStubFlutterWindowsApi scoped_api_stub( + std::make_unique()); + auto test_api = static_cast(scoped_api_stub.stub()); + + FlutterEngine engine(project); + EXPECT_TRUE(arguments[0] == test_api->engine_properties().dart_entrypoint_argv[0]); + EXPECT_TRUE(arguments[1] == test_api->engine_properties().dart_entrypoint_argv[1]); + EXPECT_EQ(2, test_api->engine_properties().dart_entrypoint_argc); +} + } // namespace flutter From bf3dd15c70e030e37369d08eecf600eac7e35742 Mon Sep 17 00:00:00 2001 From: George Wright Date: Tue, 27 Oct 2020 12:22:22 -0700 Subject: [PATCH 4/7] Fix unit test --- .../flutter_engine_unittests.cc | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc b/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc index 85e53f0886870..2920e49bcab72 100644 --- a/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc +++ b/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc @@ -20,7 +20,11 @@ class TestFlutterWindowsApi : public testing::StubFlutterWindowsApi { FlutterDesktopEngineRef EngineCreate( const FlutterDesktopEngineProperties& engine_properties) { create_called_ = true; - engine_properties_ = engine_properties; + + // dart_entrypoint_argv is only guaranteed to exist until this method returns, so copy it here for unit test validation + for (int i = 0; i < engine_properties.dart_entrypoint_argc; i++) { + dart_entrypoint_arguments_.push_back(std::string(engine_properties.dart_entrypoint_argv[i])); + } return reinterpret_cast(1); } @@ -50,14 +54,14 @@ class TestFlutterWindowsApi : public testing::StubFlutterWindowsApi { bool reload_fonts_called() { return reload_fonts_called_; } - FlutterDesktopEngineProperties& engine_properties() { return engine_properties_; } + const std::vector& dart_entrypoint_arguments() { return dart_entrypoint_arguments_; } private: bool create_called_ = false; bool run_called_ = false; bool destroy_called_ = false; bool reload_fonts_called_ = false; - FlutterDesktopEngineProperties engine_properties_; + std::vector dart_entrypoint_arguments_; }; } // namespace @@ -127,18 +131,19 @@ TEST(FlutterEngineTest, GetMessenger) { TEST(FlutterEngineTest, DartEntrypointArgs) { DartProject project(L"data"); - std::vector arguments; - arguments.push_back("one"); - arguments.push_back("two"); + std::vector arguments(2); + arguments[0] = "one"; + arguments[1] = "two"; project.set_dart_entrypoint_arguments(arguments); testing::ScopedStubFlutterWindowsApi scoped_api_stub( std::make_unique()); auto test_api = static_cast(scoped_api_stub.stub()); FlutterEngine engine(project); - EXPECT_TRUE(arguments[0] == test_api->engine_properties().dart_entrypoint_argv[0]); - EXPECT_TRUE(arguments[1] == test_api->engine_properties().dart_entrypoint_argv[1]); - EXPECT_EQ(2, test_api->engine_properties().dart_entrypoint_argc); + const std::vector& arguments_ref = test_api->dart_entrypoint_arguments(); + EXPECT_TRUE(arguments[0] == arguments_ref[0]); + EXPECT_TRUE(arguments[1] == arguments_ref[1]); + EXPECT_EQ(2, arguments_ref.size()); } } // namespace flutter From 92ea2c90d5e63dfcf32a1ffc4a4535f870c29ee7 Mon Sep 17 00:00:00 2001 From: George Wright Date: Tue, 27 Oct 2020 14:01:49 -0700 Subject: [PATCH 5/7] review updates --- .../client_wrapper/flutter_engine_unittests.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc b/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc index 2920e49bcab72..7277f934cb216 100644 --- a/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc +++ b/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc @@ -22,6 +22,7 @@ class TestFlutterWindowsApi : public testing::StubFlutterWindowsApi { create_called_ = true; // dart_entrypoint_argv is only guaranteed to exist until this method returns, so copy it here for unit test validation + dart_entrypoint_argv.clear(); for (int i = 0; i < engine_properties.dart_entrypoint_argc; i++) { dart_entrypoint_arguments_.push_back(std::string(engine_properties.dart_entrypoint_argv[i])); } @@ -130,20 +131,19 @@ TEST(FlutterEngineTest, GetMessenger) { } TEST(FlutterEngineTest, DartEntrypointArgs) { - DartProject project(L"data"); - std::vector arguments(2); - arguments[0] = "one"; - arguments[1] = "two"; - project.set_dart_entrypoint_arguments(arguments); testing::ScopedStubFlutterWindowsApi scoped_api_stub( std::make_unique()); auto test_api = static_cast(scoped_api_stub.stub()); + DartProject project(L"data"); + std::vector arguments = { "one", "two" }; + project.set_dart_entrypoint_arguments(arguments); + FlutterEngine engine(project); const std::vector& arguments_ref = test_api->dart_entrypoint_arguments(); + ASSERT_EQ(2, arguments_ref.size()); EXPECT_TRUE(arguments[0] == arguments_ref[0]); EXPECT_TRUE(arguments[1] == arguments_ref[1]); - EXPECT_EQ(2, arguments_ref.size()); } } // namespace flutter From e40e6759b86cf0f37e2a46201133405a7da01856 Mon Sep 17 00:00:00 2001 From: George Wright Date: Tue, 27 Oct 2020 14:02:30 -0700 Subject: [PATCH 6/7] formatting --- .../windows/client_wrapper/flutter_engine.cc | 3 ++- .../client_wrapper/flutter_engine_unittests.cc | 15 ++++++++++----- shell/platform/windows/flutter_project_bundle.cc | 3 ++- shell/platform/windows/flutter_project_bundle.h | 7 +++++-- shell/platform/windows/flutter_windows_engine.cc | 9 ++++++--- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/shell/platform/windows/client_wrapper/flutter_engine.cc b/shell/platform/windows/client_wrapper/flutter_engine.cc index a7d532e51bebe..a1fc0c4659066 100644 --- a/shell/platform/windows/client_wrapper/flutter_engine.cc +++ b/shell/platform/windows/client_wrapper/flutter_engine.cc @@ -25,7 +25,8 @@ FlutterEngine::FlutterEngine(const DartProject& project) { std::back_inserter(entrypoint_argv), [](const std::string& arg) -> const char* { return arg.c_str(); }); - c_engine_properties.dart_entrypoint_argc = static_cast(entrypoint_argv.size()); + c_engine_properties.dart_entrypoint_argc = + static_cast(entrypoint_argv.size()); c_engine_properties.dart_entrypoint_argv = entrypoint_argv.size() > 0 ? entrypoint_argv.data() : nullptr; diff --git a/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc b/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc index 7277f934cb216..d414b29acb922 100644 --- a/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc +++ b/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc @@ -21,10 +21,12 @@ class TestFlutterWindowsApi : public testing::StubFlutterWindowsApi { const FlutterDesktopEngineProperties& engine_properties) { create_called_ = true; - // dart_entrypoint_argv is only guaranteed to exist until this method returns, so copy it here for unit test validation + // dart_entrypoint_argv is only guaranteed to exist until this method + // returns, so copy it here for unit test validation dart_entrypoint_argv.clear(); for (int i = 0; i < engine_properties.dart_entrypoint_argc; i++) { - dart_entrypoint_arguments_.push_back(std::string(engine_properties.dart_entrypoint_argv[i])); + dart_entrypoint_arguments_.push_back( + std::string(engine_properties.dart_entrypoint_argv[i])); } return reinterpret_cast(1); } @@ -55,7 +57,9 @@ class TestFlutterWindowsApi : public testing::StubFlutterWindowsApi { bool reload_fonts_called() { return reload_fonts_called_; } - const std::vector& dart_entrypoint_arguments() { return dart_entrypoint_arguments_; } + const std::vector& dart_entrypoint_arguments() { + return dart_entrypoint_arguments_; + } private: bool create_called_ = false; @@ -136,11 +140,12 @@ TEST(FlutterEngineTest, DartEntrypointArgs) { auto test_api = static_cast(scoped_api_stub.stub()); DartProject project(L"data"); - std::vector arguments = { "one", "two" }; + std::vector arguments = {"one", "two"}; project.set_dart_entrypoint_arguments(arguments); FlutterEngine engine(project); - const std::vector& arguments_ref = test_api->dart_entrypoint_arguments(); + const std::vector& arguments_ref = + test_api->dart_entrypoint_arguments(); ASSERT_EQ(2, arguments_ref.size()); EXPECT_TRUE(arguments[0] == arguments_ref[0]); EXPECT_TRUE(arguments[1] == arguments_ref[1]); diff --git a/shell/platform/windows/flutter_project_bundle.cc b/shell/platform/windows/flutter_project_bundle.cc index fed366feba43c..4790697b585e8 100644 --- a/shell/platform/windows/flutter_project_bundle.cc +++ b/shell/platform/windows/flutter_project_bundle.cc @@ -21,7 +21,8 @@ FlutterProjectBundle::FlutterProjectBundle( } for (int i = 0; i < properties.dart_entrypoint_argc; i++) { - dart_entrypoint_arguments_.push_back(std::string(properties.dart_entrypoint_argv[i])); + dart_entrypoint_arguments_.push_back( + std::string(properties.dart_entrypoint_argv[i])); } // Resolve any relative paths. diff --git a/shell/platform/windows/flutter_project_bundle.h b/shell/platform/windows/flutter_project_bundle.h index 67dcab0554a77..72ee38d12fdb8 100644 --- a/shell/platform/windows/flutter_project_bundle.h +++ b/shell/platform/windows/flutter_project_bundle.h @@ -51,8 +51,11 @@ class FlutterProjectBundle { // Logs and returns nullptr on failure. UniqueAotDataPtr LoadAotData(); - // Returns the command line arguments to be passed through to the Dart entrypoint. - const std::vector& dart_entrypoint_arguments() const { return dart_entrypoint_arguments_; } + // Returns the command line arguments to be passed through to the Dart + // entrypoint. + const std::vector& dart_entrypoint_arguments() const { + return dart_entrypoint_arguments_; + } private: std::filesystem::path assets_path_; diff --git a/shell/platform/windows/flutter_windows_engine.cc b/shell/platform/windows/flutter_windows_engine.cc index 05dd2538afb00..7516c6a5af0c4 100644 --- a/shell/platform/windows/flutter_windows_engine.cc +++ b/shell/platform/windows/flutter_windows_engine.cc @@ -143,10 +143,12 @@ bool FlutterWindowsEngine::RunWithEntrypoint(const char* entrypoint) { switches.begin(), switches.end(), std::back_inserter(argv), [](const std::string& arg) -> const char* { return arg.c_str(); }); - const std::vector& entrypoint_args = project_->dart_entrypoint_arguments(); + const std::vector& entrypoint_args = + project_->dart_entrypoint_arguments(); std::vector entrypoint_argv; std::transform( - entrypoint_args.begin(), entrypoint_args.end(), std::back_inserter(entrypoint_argv), + entrypoint_args.begin(), entrypoint_args.end(), + std::back_inserter(entrypoint_argv), [](const std::string& arg) -> const char* { return arg.c_str(); }); // Configure task runners. @@ -173,7 +175,8 @@ bool FlutterWindowsEngine::RunWithEntrypoint(const char* entrypoint) { args.command_line_argc = static_cast(argv.size()); args.command_line_argv = argv.size() > 0 ? argv.data() : nullptr; args.dart_entrypoint_argc = static_cast(entrypoint_argv.size()); - args.dart_entrypoint_argv = entrypoint_argv.size() > 0 ? entrypoint_argv.data() : nullptr; + args.dart_entrypoint_argv = + entrypoint_argv.size() > 0 ? entrypoint_argv.data() : nullptr; args.platform_message_callback = [](const FlutterPlatformMessage* engine_message, void* user_data) -> void { From 85b86c8a22d9eae10f9a3268318ac23d81da86c4 Mon Sep 17 00:00:00 2001 From: George Wright Date: Tue, 27 Oct 2020 14:05:53 -0700 Subject: [PATCH 7/7] typo --- .../platform/windows/client_wrapper/flutter_engine_unittests.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc b/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc index d414b29acb922..e52fb336a3373 100644 --- a/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc +++ b/shell/platform/windows/client_wrapper/flutter_engine_unittests.cc @@ -23,7 +23,7 @@ class TestFlutterWindowsApi : public testing::StubFlutterWindowsApi { // dart_entrypoint_argv is only guaranteed to exist until this method // returns, so copy it here for unit test validation - dart_entrypoint_argv.clear(); + dart_entrypoint_arguments_.clear(); for (int i = 0; i < engine_properties.dart_entrypoint_argc; i++) { dart_entrypoint_arguments_.push_back( std::string(engine_properties.dart_entrypoint_argv[i]));