Commit 1b0ad2b7 authored by Sergey Ulanov's avatar Sergey Ulanov Committed by Commit Bot

[Fuchsia] Stop using ApplicationControllerReceiver.

ApplicationControllerReceiver protocol is being replaced ApplicationContext.
This CL updates CastRunner to use ApplicationContext instead of
ApplicationControllerReceiver.

Bug: 1028409
Change-Id: I7679ba3238754e994bf9fcc2bec1a30ddcd75389
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2079808
Commit-Queue: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Auto-Submit: Sergey Ulanov <sergeyu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746144}
parent 1f323f2f
......@@ -9,13 +9,12 @@
ApplicationControllerImpl::ApplicationControllerImpl(
fuchsia::web::Frame* frame,
fidl::InterfaceHandle<chromium::cast::ApplicationControllerReceiver>
receiver)
fidl::InterfaceHandle<chromium::cast::ApplicationContext> context)
: binding_(this), frame_(frame) {
DCHECK(receiver);
DCHECK(context);
DCHECK(frame_);
receiver.Bind()->SetApplicationController(binding_.NewBinding());
context.Bind()->SetApplicationController(binding_.NewBinding());
binding_.set_error_handler([](zx_status_t status) {
if (status != ZX_ERR_PEER_CLOSED && status != ZX_ERR_CANCELED) {
......
......@@ -15,8 +15,7 @@ class ApplicationControllerImpl : public chromium::cast::ApplicationController {
public:
ApplicationControllerImpl(
fuchsia::web::Frame* frame,
fidl::InterfaceHandle<chromium::cast::ApplicationControllerReceiver>
receiver);
fidl::InterfaceHandle<chromium::cast::ApplicationContext> context);
~ApplicationControllerImpl() final;
protected:
......
......@@ -29,13 +29,12 @@ class MockFrame : public fuchsia::web::testing::Frame_TestBase {
MOCK_METHOD1(SetEnableInput, void(bool));
};
class ApplicationControllerImplTest
: public chromium::cast::ApplicationControllerReceiver,
public testing::Test {
class ApplicationControllerImplTest : public chromium::cast::ApplicationContext,
public testing::Test {
public:
ApplicationControllerImplTest()
: application_receiver_binding_(this),
application_(&frame_, application_receiver_binding_.NewBinding()) {
: application_context_(this),
application_(&frame_, application_context_.NewBinding()) {
base::RunLoop run_loop;
wait_for_controller_callback_ = run_loop.QuitClosure();
run_loop.Run();
......@@ -45,6 +44,9 @@ class ApplicationControllerImplTest
protected:
// chromium::cast::ApplicationReceiver implementation.
void GetMediaSessionId(GetMediaSessionIdCallback callback) final {
NOTREACHED();
}
void SetApplicationController(
fidl::InterfaceHandle<chromium::cast::ApplicationController> application)
final {
......@@ -58,8 +60,7 @@ class ApplicationControllerImplTest
base::test::SingleThreadTaskEnvironment::MainThreadType::IO};
MockFrame frame_;
fidl::Binding<chromium::cast::ApplicationControllerReceiver>
application_receiver_binding_;
fidl::Binding<chromium::cast::ApplicationContext> application_context_;
chromium::cast::ApplicationControllerPtr application_ptr_;
ApplicationControllerImpl application_;
......
......@@ -83,9 +83,9 @@ void CastComponent::StartComponent() {
}
application_controller_ = std::make_unique<ApplicationControllerImpl>(
frame(), agent_manager_->ConnectToAgentService<
chromium::cast::ApplicationControllerReceiver>(
CastRunner::kAgentComponentUrl));
frame(),
agent_manager_->ConnectToAgentService<chromium::cast::ApplicationContext>(
CastRunner::kAgentComponentUrl));
}
void CastComponent::DestroyComponent(int termination_exit_code,
......
......@@ -83,15 +83,13 @@ class FakeUrlRequestRewriteRulesProvider
bool rules_sent_ = false;
};
class FakeApplicationControllerReceiver
: public chromium::cast::ApplicationControllerReceiver {
class FakeApplicationContext : public chromium::cast::ApplicationContext {
public:
FakeApplicationControllerReceiver() = default;
~FakeApplicationControllerReceiver() final = default;
FakeApplicationControllerReceiver(const FakeApplicationControllerReceiver&) =
delete;
FakeApplicationControllerReceiver& operator=(
const FakeApplicationControllerReceiver&) = delete;
FakeApplicationContext() = default;
~FakeApplicationContext() final = default;
FakeApplicationContext(const FakeApplicationContext&) = delete;
FakeApplicationContext& operator=(const FakeApplicationContext&) = delete;
chromium::cast::ApplicationController* controller() {
if (!controller_)
......@@ -101,7 +99,10 @@ class FakeApplicationControllerReceiver
}
private:
// chromium::cast::ApplicationControllerReceiver implementation.
// chromium::cast::ApplicationContext implementation.
void GetMediaSessionId(GetMediaSessionIdCallback callback) final {
callback(0);
}
void SetApplicationController(
fidl::InterfaceHandle<chromium::cast::ApplicationController> controller)
final {
......@@ -122,8 +123,7 @@ class FakeComponentState : public cr_fuchsia::AgentImpl::ComponentStateBase {
: ComponentStateBase(component_url),
app_config_binding_(outgoing_directory(), app_config_manager),
bindings_manager_binding_(outgoing_directory(), bindings_manager),
controller_receiver_binding_(outgoing_directory(),
&controller_receiver_) {
context_binding_(outgoing_directory(), &application_context_) {
if (url_request_rules_provider) {
url_request_rules_provider_binding_.emplace(outgoing_directory(),
url_request_rules_provider);
......@@ -137,8 +137,8 @@ class FakeComponentState : public cr_fuchsia::AgentImpl::ComponentStateBase {
FakeComponentState(const FakeComponentState&) = delete;
FakeComponentState& operator=(const FakeComponentState&) = delete;
FakeApplicationControllerReceiver* controller_receiver() {
return &controller_receiver_;
FakeApplicationContext* application_context() {
return &application_context_;
}
void set_on_delete(base::OnceClosure on_delete) {
......@@ -167,10 +167,9 @@ class FakeComponentState : public cr_fuchsia::AgentImpl::ComponentStateBase {
base::Optional<base::fuchsia::ScopedServiceBinding<
chromium::cast::UrlRequestRewriteRulesProvider>>
url_request_rules_provider_binding_;
FakeApplicationControllerReceiver controller_receiver_;
const base::fuchsia::ScopedServiceBinding<
chromium::cast::ApplicationControllerReceiver>
controller_receiver_binding_;
FakeApplicationContext application_context_;
const base::fuchsia::ScopedServiceBinding<chromium::cast::ApplicationContext>
context_binding_;
base::OnceClosure on_delete_;
};
......@@ -494,7 +493,7 @@ TEST_F(CastRunnerIntegrationTest, ApplicationControllerBound) {
// Spin the message loop to handle creation of the component state.
base::RunLoop().RunUntilIdle();
ASSERT_TRUE(component_state_);
EXPECT_TRUE(component_state_->controller_receiver()->controller());
EXPECT_TRUE(component_state_->application_context()->controller());
}
// Verify an App launched with remote debugging enabled is properly reachable.
......
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