Commit 7e415593 authored by Haines Sy's avatar Haines Sy Committed by Commit Bot

Add FakeComponentContext implementation for new API ConnectToAgentService

Add a basic FakeComponentContext implementation of ConnectToAgentService
to be used for Unit Testing.

Bug: b/139953375
Change-Id: I68fa278c5fb287eda691ab30ca21fa6381b93717
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1770955
Commit-Queue: Haines Sy <hainesy@google.com>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690904}
parent d0788ba8
......@@ -32,6 +32,15 @@ void FakeComponentContext::ConnectToAgent(
agent_impl_.Connect(component_url_, std::move(services));
}
void FakeComponentContext::ConnectToAgentService(
fuchsia::modular::AgentServiceRequest request) {
if (!agent_services_) {
ConnectToAgent(component_url_, agent_services_.NewRequest(), nullptr);
}
agent_services_->ConnectToService(std::move(request.service_name()),
std::move(*request.mutable_channel()));
}
void FakeComponentContext::NotImplemented_(const std::string& name) {
NOTIMPLEMENTED() << " API: " << name;
}
......
......@@ -37,6 +37,8 @@ class FakeComponentContext
fidl::InterfaceRequest<::fuchsia::sys::ServiceProvider> services,
fidl::InterfaceRequest<fuchsia::modular::AgentController> controller)
override;
void ConnectToAgentService(
fuchsia::modular::AgentServiceRequest request) override;
void NotImplemented_(const std::string& name) override;
private:
......@@ -44,6 +46,7 @@ class FakeComponentContext
binding_;
AgentImpl agent_impl_;
const std::string component_url_;
fuchsia::sys::ServiceProviderPtr agent_services_;
DISALLOW_COPY_AND_ASSIGN(FakeComponentContext);
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment