Route diagnostic hooks through platform services

This commit is contained in:
2026-06-03 05:12:00 +02:00
parent e152616d7f
commit 6652127545
8 changed files with 69 additions and 21 deletions

View File

@@ -21,6 +21,16 @@ public:
return storage_paths;
}
void log_stacktrace() override
{
++stacktrace_logs;
}
void trigger_crash_test() override
{
++crash_tests;
}
[[nodiscard]] std::string clipboard_text() override
{
++clipboard_reads;
@@ -177,6 +187,8 @@ public:
int render_capture_begins = 0;
int render_capture_ends = 0;
int storage_prepares = 0;
int stacktrace_logs = 0;
int crash_tests = 0;
int recording_delete_policy_checks = 0;
int recording_clears = 0;
int live_asset_reload_policy_checks = 0;
@@ -244,6 +256,18 @@ void platform_services_dispatch_storage_path_preparation(pp::tests::Harness& har
PP_EXPECT(harness, paths.temporary_path == "D:/Paint/tmp");
}
void platform_services_dispatch_diagnostics(pp::tests::Harness& harness)
{
FakePlatformServices fake("unused");
pp::platform::PlatformServices& services = fake;
services.log_stacktrace();
services.trigger_crash_test();
PP_EXPECT(harness, fake.stacktrace_logs == 1);
PP_EXPECT(harness, fake.crash_tests == 1);
}
void platform_services_preserve_empty_clipboard_writes(pp::tests::Harness& harness)
{
FakePlatformServices fake("initial");
@@ -417,6 +441,7 @@ int main()
{
pp::tests::Harness harness;
harness.run("platform services dispatch storage path preparation", platform_services_dispatch_storage_path_preparation);
harness.run("platform services dispatch diagnostics", platform_services_dispatch_diagnostics);
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);