| // Copyright 2018 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. |
| |
| library test.component.mockrunner; |
| |
| using fuchsia.sys; |
| using zx; |
| |
| struct ComponentInfo { |
| uint64 unique_id; |
| string url; |
| }; |
| |
| // interface to control the fake component created by MockRunner. |
| protocol MockComponent { |
| Kill(uint64 errorcode); |
| ConnectToService(string service_name, zx.handle:CHANNEL channel); |
| |
| // Set backend service directory which can be used by `PublishService` to |
| // publish mock services. |
| SetServiceDirectory(zx.handle:CHANNEL channel); |
| |
| // Publishes `service_name` and connects to |backend service directory| when |
| // request comes in. |
| PublishService(string service_name) -> (); |
| |
| // Gets program metadata for that particular component. |
| GetProgramMetadata() -> (vector<fuchsia.sys.ProgramMetadata>:20 metadata); |
| }; |
| |
| protocol MockRunner { |
| Crash(); |
| ConnectToComponent(uint64 id, request<MockComponent> req); |
| |
| -> OnComponentCreated(ComponentInfo info); |
| -> OnComponentKilled(uint64 id); |
| }; |
| |
| // This interface will help mock runners register themselves so that tests can |
| // inspect and control them. |
| // |
| // Mock runners should register to this service when started. |
| [Discoverable] |
| protocol MockRunnerRegistry { |
| Register(MockRunner runner); |
| }; |