Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions shell/platform/windows/client_wrapper/dart_project_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> 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
18 changes: 18 additions & 0 deletions shell/platform/windows/flutter_project_bundle_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<const char*> test_arguments = {"arg1", "arg2"};
properties.dart_entrypoint_argc = test_arguments.size();
properties.dart_entrypoint_argv = test_arguments.data();

FlutterProjectBundle project(properties);

std::vector<std::string> 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 = {};
Expand Down
9 changes: 8 additions & 1 deletion shell/platform/windows/flutter_windows_engine_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ std::unique_ptr<FlutterWindowsEngine> 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<const char*> 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<FlutterWindowsEngine>(project);

Expand Down Expand Up @@ -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);
Expand Down