@@ -2836,13 +2836,14 @@ TEST_F(ShellTest, SpawnWithDartEntrypointArgs) {
2836
2836
auto configuration = RunConfiguration::InferFromSettings (settings);
2837
2837
ASSERT_TRUE (configuration.IsValid ());
2838
2838
configuration.SetEntrypoint (" canRecieveArgumentsWhenEngineRun" );
2839
- const std::vector<std::string> entrypoint_args{" arg1" };
2839
+ const std::vector<std::string> entrypoint_args{
2840
+ " {\" foo\" :\" arg1\" ,\" bar\" :\" arg2\" }" };
2840
2841
configuration.SetEntrypointArgs (entrypoint_args);
2841
2842
2842
2843
auto second_configuration = RunConfiguration::InferFromSettings (settings);
2843
2844
ASSERT_TRUE (second_configuration.IsValid ());
2844
2845
second_configuration.SetEntrypoint (" canRecieveArgumentsWhenEngineSpawn" );
2845
- const std::vector<std::string> second_entrypoint_args{" arg2" };
2846
+ const std::vector<std::string> second_entrypoint_args{" [ \" arg1 \" , \" arg2\" ] " };
2846
2847
second_configuration.SetEntrypointArgs (second_entrypoint_args);
2847
2848
2848
2849
const std::string initial_route (" /foo" );
@@ -2935,6 +2936,36 @@ TEST_F(ShellTest, SpawnWithDartEntrypointArgs) {
2935
2936
ASSERT_FALSE (DartVMRef::IsInstanceRunning ());
2936
2937
}
2937
2938
2939
+ TEST_F (ShellTest, CanRecieveEmptyArguments) {
2940
+ auto settings = CreateSettingsForFixture ();
2941
+ auto shell = CreateShell (settings);
2942
+ ASSERT_TRUE (ValidateShell (shell.get ()));
2943
+
2944
+ auto configuration = RunConfiguration::InferFromSettings (settings);
2945
+ ASSERT_TRUE (configuration.IsValid ());
2946
+ configuration.SetEntrypoint (" canRecieveEmptyArguments" );
2947
+
2948
+ fml::AutoResetWaitableEvent main_latch;
2949
+ std::string last_entry_point;
2950
+
2951
+ AddNativeCallback (" NotifyNativeWhenEngineRun" ,
2952
+ CREATE_NATIVE_ENTRY (([&](Dart_NativeArguments args) {
2953
+ ASSERT_TRUE (tonic::DartConverter<bool >::FromDart (
2954
+ Dart_GetNativeArgument (args, 0 )));
2955
+ last_entry_point =
2956
+ shell->GetEngine ()->GetLastEntrypoint ();
2957
+ main_latch.Signal ();
2958
+ })));
2959
+
2960
+ RunEngine (shell.get (), std::move (configuration));
2961
+ main_latch.Wait ();
2962
+ ASSERT_TRUE (DartVMRef::IsInstanceRunning ());
2963
+ ASSERT_EQ (" canRecieveEmptyArguments" , last_entry_point);
2964
+
2965
+ DestroyShell (std::move (shell));
2966
+ ASSERT_FALSE (DartVMRef::IsInstanceRunning ());
2967
+ }
2968
+
2938
2969
TEST_F (ShellTest, UpdateAssetResolverByTypeReplaces) {
2939
2970
ASSERT_FALSE (DartVMRef::IsInstanceRunning ());
2940
2971
Settings settings = CreateSettingsForFixture ();
0 commit comments