Route UI thread lifecycle through platform services

This commit is contained in:
2026-06-03 04:45:02 +02:00
parent dd641c047b
commit f3925f8423
10 changed files with 79 additions and 15 deletions

View File

@@ -40,6 +40,16 @@ public:
keyboard_visible = visible;
}
void attach_ui_thread() override
{
++ui_thread_attaches;
}
void detach_ui_thread() override
{
++ui_thread_detaches;
}
void update_platform_frame(float delta_time_seconds) override
{
++platform_frame_updates;
@@ -110,6 +120,8 @@ public:
int clipboard_writes = 0;
int cursor_updates = 0;
int keyboard_updates = 0;
int ui_thread_attaches = 0;
int ui_thread_detaches = 0;
int platform_frame_updates = 0;
int frame_reports = 0;
int display_file_requests = 0;
@@ -177,6 +189,18 @@ void platform_services_dispatch_visibility_updates(pp::tests::Harness& harness)
PP_EXPECT(harness, !fake.keyboard_visible);
}
void platform_services_dispatch_ui_thread_lifecycle(pp::tests::Harness& harness)
{
FakePlatformServices fake("unused");
pp::platform::PlatformServices& services = fake;
services.attach_ui_thread();
services.detach_ui_thread();
PP_EXPECT(harness, fake.ui_thread_attaches == 1);
PP_EXPECT(harness, fake.ui_thread_detaches == 1);
}
void platform_services_dispatch_frame_hooks(pp::tests::Harness& harness)
{
FakePlatformServices fake("unused");
@@ -263,6 +287,7 @@ int main()
harness.run("platform services dispatch clipboard reads and writes", platform_services_dispatch_clipboard_reads_and_writes);
harness.run("platform services preserve empty clipboard writes", platform_services_preserve_empty_clipboard_writes);
harness.run("platform services dispatch visibility updates", platform_services_dispatch_visibility_updates);
harness.run("platform services dispatch UI thread lifecycle", platform_services_dispatch_ui_thread_lifecycle);
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 picker callbacks", platform_services_dispatch_picker_callbacks);