[go: nahoru, domu]

blob: 8c2c539cee3104331d83a6a835892a7df2c3fc67 [file] [log] [blame]
Avi Drissman8804558b2022-09-13 20:34:391// Copyright 2022 The Chromium Authors
Greg Thompson9bf10b02022-08-27 07:40:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FUCHSIA_WEB_COMMON_TEST_TEST_REALM_SUPPORT_H_
6#define FUCHSIA_WEB_COMMON_TEST_TEST_REALM_SUPPORT_H_
7
Greg Thompson2cd6c4872022-09-16 12:10:198#include "base/strings/string_piece.h"
9
10namespace base {
11class CommandLine;
12}
Greg Thompson9bf10b02022-08-27 07:40:5513
14namespace component_testing {
15class RealmBuilder;
16}
17
18namespace test {
19
Greg Thompson2cd6c4872022-09-16 12:10:1920// Appends the arguments of `command_line` (ignoring the program name at
21// position zero) to the command line for the component named `child_name`.
22void AppendCommandLineArguments(
23 ::component_testing::RealmBuilder& realm_builder,
24 base::StringPiece child_name,
25 const base::CommandLine& command_line);
26
Greg Thompson78920be72023-02-11 10:12:0427// Appends the arguments of `command_line` (ignoring the program name at
28// position zero) to the command line for the realm.
29void AppendCommandLineArgumentsForRealm(
30 ::component_testing::RealmBuilder& realm_builder,
31 const base::CommandLine& command_line);
32
Greg Thompson9bf10b02022-08-27 07:40:5533// In the functions below, the term "parent" is the `#realm_builder` collection
34// for the test component that is using these helpers to build a test realm.
35// Each test component must use a .cml fragment that routes the required
36// capabilities to `#realm_builder`.
37
David Dorwin8382ee6f2023-09-29 20:45:2238void AddRouteFromParent(component_testing::RealmBuilder& realm_builder,
39 base::StringPiece child_name,
40 base::StringPiece protocol_name);
41
Greg Thompson9bf10b02022-08-27 07:40:5542// Adds routes to the child component named `child_name` to satisfy that
43// child's use of syslog/client.shard.cml.
44void AddSyslogRoutesFromParent(::component_testing::RealmBuilder& realm_builder,
Greg Thompson2cd6c4872022-09-16 12:10:1945 base::StringPiece child_name);
Greg Thompson9bf10b02022-08-27 07:40:5546
47// Adds routes to the child component named `child_name` to satisfy that
48// child's use of vulkan/client.shard.cml.
49void AddVulkanRoutesFromParent(::component_testing::RealmBuilder& realm_builder,
Greg Thompson2cd6c4872022-09-16 12:10:1950 base::StringPiece child_name);
Greg Thompson9bf10b02022-08-27 07:40:5551
52// Adds fuchsia-pkg://fuchsia.com/fonts#meta/fonts.cm as a child in the realm,
53// routes all of its required capabilities from parent, and routes its
54// fuchsia.fonts.Provider protocol to the child component named `child_name`
55// in the realm.
56void AddFontService(::component_testing::RealmBuilder& realm_builder,
Greg Thompson2cd6c4872022-09-16 12:10:1957 base::StringPiece child_name);
Greg Thompson9bf10b02022-08-27 07:40:5558
59// Adds fuchsia-pkg://fuchsia.com/test-ui-stack#meta/test-ui-stack.cm as a
60// child in the realm, routes all of its required capabilities from parent,
61// and routes various of its protocols to the child component named
62// `child_name` in the realm.
63void AddTestUiStack(::component_testing::RealmBuilder& realm_builder,
Greg Thompson2cd6c4872022-09-16 12:10:1964 base::StringPiece child_name);
Greg Thompson9bf10b02022-08-27 07:40:5565
66} // namespace test
67
68#endif // FUCHSIA_WEB_COMMON_TEST_TEST_REALM_SUPPORT_H_