fix(runtime): harden application service boundaries

This commit is contained in:
edde746
2026-07-24 03:46:46 +02:00
parent 658da37b48
commit e0bf66eea8
309 changed files with 32574 additions and 4369 deletions
+28
View File
@@ -1,5 +1,9 @@
#include "mpv_player_common.h"
#ifdef NDEBUG
#undef NDEBUG
#endif
#include <cassert>
#include <chrono>
#include <string>
@@ -37,6 +41,29 @@ void TestRequestRegistry() {
assert(cancelled.properties.size() == 1);
}
void TestSetPropertyResultContract() {
using namespace plezy::mpv_common;
assert(std::string(kSetPropertyFailedCode) == "SET_PROPERTY_FAILED");
assert(std::string(kSetPropertyNotInitializedCode) == "NOT_INITIALIZED");
assert(SetPropertyStatusSucceeded(MPV_ERROR_SUCCESS));
assert(SetPropertyStatusSucceeded(1));
constexpr int kFailureStatuses[] = {
MPV_ERROR_INVALID_PARAMETER,
MPV_ERROR_PROPERTY_ERROR,
-1,
MPV_ERROR_UNINITIALIZED,
};
for (const int status : kFailureStatuses) {
assert(!SetPropertyStatusSucceeded(status));
const std::string description = SetPropertyErrorDescription(status);
assert(!description.empty());
assert(description.size() <= kSetPropertyErrorDescriptionLimit);
assert(description.find("caller-secret") == std::string::npos);
}
}
void TestPropertyObservationRegistry() {
plezy::mpv_common::PropertyObservationRegistry registry;
const auto first = registry.Register("pause", "bool", 17);
@@ -138,6 +165,7 @@ void TestHdrHelpers() {
int main() {
TestRequestRegistry();
TestSetPropertyResultContract();
TestPropertyObservationRegistry();
TestResumeRecoverySchedule();
TestNullFallbackRecoverySchedule();