Route VR lifecycle through platform services

This commit is contained in:
2026-06-04 18:39:22 +02:00
parent 4bd29bee9f
commit 7aadd1041a
10 changed files with 87 additions and 22 deletions

View File

@@ -186,6 +186,17 @@ public:
++app_close_requests;
}
[[nodiscard]] bool start_vr_mode() override
{
++vr_starts;
return vr_start_success;
}
void stop_vr_mode() override
{
++vr_stops;
}
void pick_image(pp::platform::PickedPathCallback callback) override
{
++pick_image_requests;
@@ -334,6 +345,8 @@ public:
int display_file_requests = 0;
int share_file_requests = 0;
int app_close_requests = 0;
int vr_starts = 0;
int vr_stops = 0;
int pick_image_requests = 0;
int pick_file_requests = 0;
int pick_save_file_requests = 0;
@@ -353,6 +366,7 @@ public:
bool cursor_visible = false;
bool keyboard_visible = false;
bool prepared_file_saved = true;
bool vr_start_success = false;
bool prepared_file_writes = true;
bool working_directory_picker_supported = false;
bool work_directory_document_export_collections = false;
@@ -611,6 +625,20 @@ void platform_services_dispatch_file_actions(pp::tests::Harness& harness)
PP_EXPECT(harness, fake.shared_path == "D:/Paint/demo.ppi");
}
void platform_services_dispatch_vr_lifecycle(pp::tests::Harness& harness)
{
FakePlatformServices fake("unused");
pp::platform::PlatformServices& services = fake;
PP_EXPECT(harness, !services.start_vr_mode());
fake.vr_start_success = true;
PP_EXPECT(harness, services.start_vr_mode());
services.stop_vr_mode();
PP_EXPECT(harness, fake.vr_starts == 2);
PP_EXPECT(harness, fake.vr_stops == 1);
}
void platform_services_dispatch_picker_callbacks(pp::tests::Harness& harness)
{
FakePlatformServices fake("unused");
@@ -793,6 +821,7 @@ int main()
harness.run("platform services dispatch live asset reload policy", platform_services_dispatch_live_asset_reload_policy);
harness.run("platform services dispatch frame hooks", platform_services_dispatch_frame_hooks);
harness.run("platform services dispatch file actions", platform_services_dispatch_file_actions);
harness.run("platform services dispatch VR lifecycle", platform_services_dispatch_vr_lifecycle);
harness.run("platform services dispatch picker callbacks", platform_services_dispatch_picker_callbacks);
harness.run(
"platform services dispatch working directory picker policy",