blob: 5ff5941be40e95edfe551745bea29c3c9441c60a [file]
// Copyright 2026 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// The Factory protocol allows TRF clients to dynamically instantiate
/// test realms. It serves as an entry point for testing harnesses and allows
/// configuration injection for test instances.
library fuchsia.trf.factory;
using fuchsia.testing.harness;
/// A primitive configuration value used to override component configurations.
type ConfigValue = flexible union {
/// A boolean configuration value.
1: bool_value bool;
/// A 64-bit signed integer configuration value.
2: int64_value int64;
/// A string configuration value.
3: string_value string:MAX;
};
/// A key-value pair used to override a configuration setting in the realm.
type ConfigOverride = table {
/// The configuration key to override.
1: key string:MAX;
/// The value to set for the configuration key.
2: value ConfigValue;
};
/// Parameters for creating a new test realm.
type CreateRealmRequest = resource table {
/// A list of configuration overrides to apply to the newly created realm.
1: overrides vector<ConfigOverride>:MAX;
};
/// Factory creates isolated test realms.
/// It wraps the underlying test harness infrastructure to simplify setup.
@discoverable
open protocol Factory {
/// Creates a new test realm configured with the given parameters and overrides.
/// Returns a `RealmProxy` that the client can use to start and introspect the realm.
flexible CreateRealm(CreateRealmRequest) -> (resource struct {
/// A client endpoint to interact with the created realm.
realm client_end:fuchsia.testing.harness.RealmProxy;
}) error fuchsia.testing.harness.OperationError;
};