0

[fuchsia] Clarify protocols used in cast_runner_integration_test

Previously, the reason for some of the protocols in the CML file and
routed via RealmBuilder was unclear and some protocols required by
WebEngine were missing. This CL documents all of the protocols and
makes some minor changes

Bug: b/298698003, 1364196
Change-Id: I9768f7b1b7076701cf85afbb1277aef918d55c13
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4854390
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Commit-Queue: David Dorwin <ddorwin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1203427}
This commit is contained in:
David Dorwin
2023-09-29 20:45:22 +00:00
committed by Chromium LUCI CQ
parent 87d29093e6
commit 8382ee6f4f
4 changed files with 79 additions and 22 deletions

@ -80,13 +80,18 @@ void AppendCommandLineArgumentsForRealm(
realm_builder.ReplaceRealmDecl(std::move(decl));
}
void AddRouteFromParent(RealmBuilder& realm_builder,
base::StringPiece child_name,
base::StringPiece protocol_name) {
ChildRef child_ref{std::string_view(child_name.data(), child_name.size())};
realm_builder.AddRoute(Route{.capabilities = {Protocol{protocol_name}},
.source = ParentRef{},
.targets = {std::move(child_ref)}});
}
void AddSyslogRoutesFromParent(RealmBuilder& realm_builder,
base::StringPiece child_name) {
ChildRef child_ref{std::string_view(child_name.data(), child_name.size())};
realm_builder.AddRoute(
Route{.capabilities = {Protocol{"fuchsia.logger.LogSink"}},
.source = ParentRef{},
.targets = {std::move(child_ref)}});
AddRouteFromParent(realm_builder, child_name, "fuchsia.logger.LogSink");
}
void AddVulkanRoutesFromParent(RealmBuilder& realm_builder,
@ -126,8 +131,11 @@ void AddTestUiStack(RealmBuilder& realm_builder, base::StringPiece child_name) {
"fuchsia-pkg://fuchsia.com/flatland-scene-manager-test-ui-stack#meta/"
"test-ui-stack.cm";
realm_builder.AddChild(kTestUiStackService, kTestUiStackUrl);
AddRouteFromParent(realm_builder, kTestUiStackService,
"fuchsia.scheduler.ProfileProvider");
AddSyslogRoutesFromParent(realm_builder, kTestUiStackService);
AddVulkanRoutesFromParent(realm_builder, kTestUiStackService);
ChildRef child_ref{std::string_view(child_name.data(), child_name.size())};
realm_builder
.AddRoute(

@ -35,6 +35,10 @@ void AppendCommandLineArgumentsForRealm(
// Each test component must use a .cml fragment that routes the required
// capabilities to `#realm_builder`.
void AddRouteFromParent(component_testing::RealmBuilder& realm_builder,
base::StringPiece child_name,
base::StringPiece protocol_name);
// Adds routes to the child component named `child_name` to satisfy that
// child's use of syslog/client.shard.cml.
void AddSyslogRoutesFromParent(::component_testing::RealmBuilder& realm_builder,

@ -15,18 +15,39 @@
},
{
protocol: [
// fuchsia.web/Context required and recommended protocols.
// "fuchsia.buildinfo.Provider" is provided by #build-info-service.
"fuchsia.device.NameProvider",
"fuchsia.fonts.Provider",
"fuchsia.hwinfo.Product",
// "fuchsia.intl.PropertyProvider" is provided by #intl_property_manager.
"fuchsia.kernel.VmexResource",
"fuchsia.media.AudioDeviceEnumerator",
"fuchsia.logger.LogSink",
"fuchsia.media.ProfileProvider",
"fuchsia.memorypressure.Provider",
"fuchsia.net.interfaces.State",
"fuchsia.posix.socket.Provider",
"fuchsia.process.Launcher",
"fuchsia.scheduler.ProfileProvider",
"fuchsia.settings.Display",
"fuchsia.sysmem.Allocator",
// CastRunner sets ContextFeatureFlags::NETWORK by default.
"fuchsia.net.interfaces.State",
"fuchsia.net.name.Lookup",
"fuchsia.posix.socket.Provider",
// CastRunner sets ThemeType::DEFAULT when not headless.
"fuchsia.settings.Display",
// Used by the test UI stack and VulkanCastRunnerIntegrationTest.
"fuchsia.tracing.provider.Registry",
"fuchsia.vulkan.loader.Loader",
// Used by most tests.
"fuchsia.media.AudioDeviceEnumerator",
// Used by the test UI stack.
"fuchsia.scheduler.ProfileProvider",
// TODO(crbug.com/1364196) Remove once not needed to avoid log spam.
"fuchsia.tracing.perfetto.ProducerConnector",
],
from: "parent",
to: "#realm_builder",

@ -106,12 +106,11 @@ CastRunnerLauncher::CastRunnerLauncher(CastRunnerFeatures runner_features) {
FakeFeedbackService::RouteToChild(realm_builder, kCastRunnerComponentName);
AddSyslogRoutesFromParent(realm_builder, kCastRunnerComponentName);
AddVulkanRoutesFromParent(realm_builder, kCastRunnerComponentName);
// Run an isolated font service for cast_runner.
// Run an isolated font service and route it to cast_runner.
AddFontService(realm_builder, kCastRunnerComponentName);
// Run the test-ui-stack and route the protocols needed by cast_runner to it.
// Run the test-ui-stack and route it to cast_runner.
AddTestUiStack(realm_builder, kCastRunnerComponentName);
realm_builder.AddRoute(Route{
@ -127,15 +126,25 @@ CastRunnerLauncher::CastRunnerLauncher(CastRunnerFeatures runner_features) {
.as = "config-data-for-web-instance",
.subdir = "web_engine"},
Directory{.name = "root-ssl-certificates"},
// fuchsia.web/Context required and recommended protocols.
Protocol{fuchsia::buildinfo::Provider::Name_},
Protocol{fuchsia::kernel::VmexResource::Name_},
Protocol{"fuchsia.device.NameProvider"},
// "fuchsia.fonts.Provider" is provided above.
Protocol{"fuchsia.hwinfo.Product"},
Protocol{fuchsia::intl::PropertyProvider::Name_},
Protocol{fuchsia::kernel::VmexResource::Name_},
Protocol{"fuchsia.logger.LogSink"},
Protocol{fuchsia::media::ProfileProvider::Name_},
Protocol{fuchsia::memorypressure::Provider::Name_},
Protocol{fuchsia::net::interfaces::State::Name_},
Protocol{"fuchsia.posix.socket.Provider"},
Protocol{"fuchsia.process.Launcher"},
Protocol{fuchsia::settings::Display::Name_},
Protocol{"fuchsia.sysmem.Allocator"},
// CastRunner sets ContextFeatureFlags::NETWORK by default.
Protocol{fuchsia::net::interfaces::State::Name_},
Protocol{"fuchsia.net.name.Lookup"},
Protocol{"fuchsia.posix.socket.Provider"},
Storage{.name = "cache", .path = "/cache"},
},
.source = ParentRef(),
@ -162,6 +171,16 @@ CastRunnerLauncher::CastRunnerLauncher(CastRunnerFeatures runner_features) {
.source = ChildRef{kFakeCastAgentName},
.targets = {ChildRef{kCastRunnerComponentName}}});
if (!(runner_features & kCastRunnerFeaturesHeadless)) {
// CastRunner sets ThemeType::DEFAULT when not headless.
AddRouteFromParent(realm_builder, kCastRunnerComponentName,
fuchsia::settings::Display::Name_);
}
if (runner_features & kCastRunnerFeaturesVulkan) {
AddVulkanRoutesFromParent(realm_builder, kCastRunnerComponentName);
}
// Either route the fake AudioDeviceEnumerator or the system one.
if (runner_features & kCastRunnerFeaturesFakeAudioDeviceEnumerator) {
static constexpr char kAudioDeviceEnumerator[] =
@ -175,13 +194,18 @@ CastRunnerLauncher::CastRunnerLauncher(CastRunnerFeatures runner_features) {
.source = ChildRef{kAudioDeviceEnumerator},
.targets = {ChildRef{kCastRunnerComponentName}}});
} else {
realm_builder.AddRoute(
Route{.capabilities = {Protocol{
fuchsia::media::AudioDeviceEnumerator::Name_}},
.source = ParentRef(),
.targets = {ChildRef{kCastRunnerComponentName}}});
AddRouteFromParent(realm_builder, kCastRunnerComponentName,
fuchsia::media::AudioDeviceEnumerator::Name_);
}
// Always offer tracing to CastRunner to suppress log spam. See its CML file.
AddRouteFromParent(realm_builder, kCastRunnerComponentName,
"fuchsia.tracing.provider.Registry");
// TODO(crbug.com/1364196) Remove once not needed to avoid log spam.
AddRouteFromParent(realm_builder, kCastRunnerComponentName,
"fuchsia.tracing.perfetto.ProducerConnector");
// Route capabilities from the cast_runner back up to the test.
realm_builder.AddRoute(
Route{.capabilities = {Protocol{chromium::cast::DataReset::Name_},