diff --git a/shell/platform/windows/client_wrapper/dart_project_unittests.cc b/shell/platform/windows/client_wrapper/dart_project_unittests.cc index 618d131963df730ee47bcd02e07bdc35d6df589f..bfc151947f673f60f25dceb2c19e0005cac392a6 100644 --- a/shell/platform/windows/client_wrapper/dart_project_unittests.cc +++ b/shell/platform/windows/client_wrapper/dart_project_unittests.cc @@ -42,4 +42,17 @@ TEST_F(DartProjectTest, ProjectWithCustomPaths) { EXPECT_EQ(GetProjectAotLibraryPath(project), L"lib\\file.so"); } +TEST_F(DartProjectTest, DartEntrypointArguments) { + DartProject project(L"test"); + + std::vector test_arguments = {"arg1", "arg2", "arg3"}; + project.set_dart_entrypoint_arguments(test_arguments); + + auto returned_arguments = project.dart_entrypoint_arguments(); + EXPECT_EQ(returned_arguments.size(), 3U); + EXPECT_EQ(returned_arguments[0], "arg1"); + EXPECT_EQ(returned_arguments[1], "arg2"); + EXPECT_EQ(returned_arguments[2], "arg3"); +} + } // namespace flutter diff --git a/shell/platform/windows/flutter_project_bundle_unittests.cc b/shell/platform/windows/flutter_project_bundle_unittests.cc index c149fbe85c8b5df0cdf2085acaece86265af5d71..607d1cc707d99eb0015ed9016b93c97b2e2d9d8a 100644 --- a/shell/platform/windows/flutter_project_bundle_unittests.cc +++ b/shell/platform/windows/flutter_project_bundle_unittests.cc @@ -47,6 +47,24 @@ TEST(FlutterProjectBundle, SwitchesEmpty) { EXPECT_EQ(project.GetSwitches().size(), 0); } +TEST(FlutterProjectBundle, DartEntrypointArguments) { + FlutterDesktopEngineProperties properties = {}; + properties.assets_path = L"foo\\flutter_assets"; + properties.icu_data_path = L"foo\\icudtl.dat"; + + std::vector test_arguments = {"arg1", "arg2"}; + properties.dart_entrypoint_argc = test_arguments.size(); + properties.dart_entrypoint_argv = test_arguments.data(); + + FlutterProjectBundle project(properties); + + std::vector retrieved_arguments = + project.dart_entrypoint_arguments(); + EXPECT_EQ(retrieved_arguments.size(), 2U); + EXPECT_EQ(retrieved_arguments[0], "arg1"); + EXPECT_EQ(retrieved_arguments[1], "arg2"); +} + #ifndef FLUTTER_RELEASE TEST(FlutterProjectBundle, Switches) { FlutterDesktopEngineProperties properties = {}; diff --git a/shell/platform/windows/flutter_windows_engine_unittests.cc b/shell/platform/windows/flutter_windows_engine_unittests.cc index 56809ea62c5c0ac1188a6c9bf5becfe6b6b9e44b..5e24d26e628b0263bbaa4f0e96431d73997e77f8 100644 --- a/shell/platform/windows/flutter_windows_engine_unittests.cc +++ b/shell/platform/windows/flutter_windows_engine_unittests.cc @@ -19,6 +19,11 @@ std::unique_ptr GetTestEngine() { properties.assets_path = L"C:\\foo\\flutter_assets"; properties.icu_data_path = L"C:\\foo\\icudtl.dat"; properties.aot_library_path = L"C:\\foo\\aot.so"; + + std::vector test_arguments = {"arg1", "arg2"}; + properties.dart_entrypoint_argc = test_arguments.size(); + properties.dart_entrypoint_argv = test_arguments.data(); + FlutterProjectBundle project(properties); auto engine = std::make_unique(project); @@ -52,7 +57,9 @@ TEST(FlutterWindowsEngine, RunDoesExpectedInitialization) { // Spot-check arguments. EXPECT_STREQ(args->assets_path, "C:\\foo\\flutter_assets"); EXPECT_STREQ(args->icu_data_path, "C:\\foo\\icudtl.dat"); - EXPECT_EQ(args->dart_entrypoint_argc, 0); + EXPECT_EQ(args->dart_entrypoint_argc, 2U); + EXPECT_EQ(strcmp(args->dart_entrypoint_argv[0], "arg1"), 0); + EXPECT_EQ(strcmp(args->dart_entrypoint_argv[1], "arg2"), 0); EXPECT_NE(args->platform_message_callback, nullptr); EXPECT_NE(args->custom_task_runners, nullptr); EXPECT_EQ(args->custom_dart_entrypoint, nullptr);