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 @@ ...@@ -9,13 +9,12 @@
ApplicationControllerImpl::ApplicationControllerImpl( ApplicationControllerImpl::ApplicationControllerImpl(
fuchsia::web::Frame* frame, fuchsia::web::Frame* frame,
fidl::InterfaceHandle<chromium::cast::ApplicationControllerReceiver> fidl::InterfaceHandle<chromium::cast::ApplicationContext> context)
receiver)
: binding_(this), frame_(frame) { : binding_(this), frame_(frame) {
DCHECK(receiver); DCHECK(context);
DCHECK(frame_); DCHECK(frame_);
receiver.Bind()->SetApplicationController(binding_.NewBinding()); context.Bind()->SetApplicationController(binding_.NewBinding());
binding_.set_error_handler([](zx_status_t status) { binding_.set_error_handler([](zx_status_t status) {
if (status != ZX_ERR_PEER_CLOSED && status != ZX_ERR_CANCELED) { if (status != ZX_ERR_PEER_CLOSED && status != ZX_ERR_CANCELED) {
......
...@@ -15,8 +15,7 @@ class ApplicationControllerImpl : public chromium::cast::ApplicationController { ...@@ -15,8 +15,7 @@ class ApplicationControllerImpl : public chromium::cast::ApplicationController {
public: public:
ApplicationControllerImpl( ApplicationControllerImpl(
fuchsia::web::Frame* frame, fuchsia::web::Frame* frame,
fidl::InterfaceHandle<chromium::cast::ApplicationControllerReceiver> fidl::InterfaceHandle<chromium::cast::ApplicationContext> context);
receiver);
~ApplicationControllerImpl() final; ~ApplicationControllerImpl() final;
protected: protected:
......
...@@ -29,13 +29,12 @@ class MockFrame : public fuchsia::web::testing::Frame_TestBase { ...@@ -29,13 +29,12 @@ class MockFrame : public fuchsia::web::testing::Frame_TestBase {
MOCK_METHOD1(SetEnableInput, void(bool)); MOCK_METHOD1(SetEnableInput, void(bool));
}; };
class ApplicationControllerImplTest class ApplicationControllerImplTest : public chromium::cast::ApplicationContext,
: public chromium::cast::ApplicationControllerReceiver, public testing::Test {
public testing::Test {
public: public:
ApplicationControllerImplTest() ApplicationControllerImplTest()
: application_receiver_binding_(this), : application_context_(this),
application_(&frame_, application_receiver_binding_.NewBinding()) { application_(&frame_, application_context_.NewBinding()) {
base::RunLoop run_loop; base::RunLoop run_loop;
wait_for_controller_callback_ = run_loop.QuitClosure(); wait_for_controller_callback_ = run_loop.QuitClosure();
run_loop.Run(); run_loop.Run();
...@@ -45,6 +44,9 @@ class ApplicationControllerImplTest ...@@ -45,6 +44,9 @@ class ApplicationControllerImplTest
protected: protected:
// chromium::cast::ApplicationReceiver implementation. // chromium::cast::ApplicationReceiver implementation.
void GetMediaSessionId(GetMediaSessionIdCallback callback) final {
NOTREACHED();
}
void SetApplicationController( void SetApplicationController(
fidl::InterfaceHandle<chromium::cast::ApplicationController> application) fidl::InterfaceHandle<chromium::cast::ApplicationController> application)
final { final {
...@@ -58,8 +60,7 @@ class ApplicationControllerImplTest ...@@ -58,8 +60,7 @@ class ApplicationControllerImplTest
base::test::SingleThreadTaskEnvironment::MainThreadType::IO}; base::test::SingleThreadTaskEnvironment::MainThreadType::IO};
MockFrame frame_; MockFrame frame_;
fidl::Binding<chromium::cast::ApplicationControllerReceiver> fidl::Binding<chromium::cast::ApplicationContext> application_context_;
application_receiver_binding_;
chromium::cast::ApplicationControllerPtr application_ptr_; chromium::cast::ApplicationControllerPtr application_ptr_;
ApplicationControllerImpl application_; ApplicationControllerImpl application_;
......
...@@ -83,9 +83,9 @@ void CastComponent::StartComponent() { ...@@ -83,9 +83,9 @@ void CastComponent::StartComponent() {
} }
application_controller_ = std::make_unique<ApplicationControllerImpl>( application_controller_ = std::make_unique<ApplicationControllerImpl>(
frame(), agent_manager_->ConnectToAgentService< frame(),
chromium::cast::ApplicationControllerReceiver>( agent_manager_->ConnectToAgentService<chromium::cast::ApplicationContext>(
CastRunner::kAgentComponentUrl)); CastRunner::kAgentComponentUrl));
} }
void CastComponent::DestroyComponent(int termination_exit_code, void CastComponent::DestroyComponent(int termination_exit_code,
......
...@@ -83,15 +83,13 @@ class FakeUrlRequestRewriteRulesProvider ...@@ -83,15 +83,13 @@ class FakeUrlRequestRewriteRulesProvider
bool rules_sent_ = false; bool rules_sent_ = false;
}; };
class FakeApplicationControllerReceiver class FakeApplicationContext : public chromium::cast::ApplicationContext {
: public chromium::cast::ApplicationControllerReceiver {
public: public:
FakeApplicationControllerReceiver() = default; FakeApplicationContext() = default;
~FakeApplicationControllerReceiver() final = default; ~FakeApplicationContext() final = default;
FakeApplicationControllerReceiver(const FakeApplicationControllerReceiver&) =
delete; FakeApplicationContext(const FakeApplicationContext&) = delete;
FakeApplicationControllerReceiver& operator=( FakeApplicationContext& operator=(const FakeApplicationContext&) = delete;
const FakeApplicationControllerReceiver&) = delete;
chromium::cast::ApplicationController* controller() { chromium::cast::ApplicationController* controller() {
if (!controller_) if (!controller_)
...@@ -101,7 +99,10 @@ class FakeApplicationControllerReceiver ...@@ -101,7 +99,10 @@ class FakeApplicationControllerReceiver
} }
private: private:
// chromium::cast::ApplicationControllerReceiver implementation. // chromium::cast::ApplicationContext implementation.
void GetMediaSessionId(GetMediaSessionIdCallback callback) final {
callback(0);
}
void SetApplicationController( void SetApplicationController(
fidl::InterfaceHandle<chromium::cast::ApplicationController> controller) fidl::InterfaceHandle<chromium::cast::ApplicationController> controller)
final { final {
...@@ -122,8 +123,7 @@ class FakeComponentState : public cr_fuchsia::AgentImpl::ComponentStateBase { ...@@ -122,8 +123,7 @@ class FakeComponentState : public cr_fuchsia::AgentImpl::ComponentStateBase {
: ComponentStateBase(component_url), : ComponentStateBase(component_url),
app_config_binding_(outgoing_directory(), app_config_manager), app_config_binding_(outgoing_directory(), app_config_manager),
bindings_manager_binding_(outgoing_directory(), bindings_manager), bindings_manager_binding_(outgoing_directory(), bindings_manager),
controller_receiver_binding_(outgoing_directory(), context_binding_(outgoing_directory(), &application_context_) {
&controller_receiver_) {
if (url_request_rules_provider) { if (url_request_rules_provider) {
url_request_rules_provider_binding_.emplace(outgoing_directory(), url_request_rules_provider_binding_.emplace(outgoing_directory(),
url_request_rules_provider); url_request_rules_provider);
...@@ -137,8 +137,8 @@ class FakeComponentState : public cr_fuchsia::AgentImpl::ComponentStateBase { ...@@ -137,8 +137,8 @@ class FakeComponentState : public cr_fuchsia::AgentImpl::ComponentStateBase {
FakeComponentState(const FakeComponentState&) = delete; FakeComponentState(const FakeComponentState&) = delete;
FakeComponentState& operator=(const FakeComponentState&) = delete; FakeComponentState& operator=(const FakeComponentState&) = delete;
FakeApplicationControllerReceiver* controller_receiver() { FakeApplicationContext* application_context() {
return &controller_receiver_; return &application_context_;
} }
void set_on_delete(base::OnceClosure on_delete) { void set_on_delete(base::OnceClosure on_delete) {
...@@ -167,10 +167,9 @@ class FakeComponentState : public cr_fuchsia::AgentImpl::ComponentStateBase { ...@@ -167,10 +167,9 @@ class FakeComponentState : public cr_fuchsia::AgentImpl::ComponentStateBase {
base::Optional<base::fuchsia::ScopedServiceBinding< base::Optional<base::fuchsia::ScopedServiceBinding<
chromium::cast::UrlRequestRewriteRulesProvider>> chromium::cast::UrlRequestRewriteRulesProvider>>
url_request_rules_provider_binding_; url_request_rules_provider_binding_;
FakeApplicationControllerReceiver controller_receiver_; FakeApplicationContext application_context_;
const base::fuchsia::ScopedServiceBinding< const base::fuchsia::ScopedServiceBinding<chromium::cast::ApplicationContext>
chromium::cast::ApplicationControllerReceiver> context_binding_;
controller_receiver_binding_;
base::OnceClosure on_delete_; base::OnceClosure on_delete_;
}; };
...@@ -494,7 +493,7 @@ TEST_F(CastRunnerIntegrationTest, ApplicationControllerBound) { ...@@ -494,7 +493,7 @@ TEST_F(CastRunnerIntegrationTest, ApplicationControllerBound) {
// Spin the message loop to handle creation of the component state. // Spin the message loop to handle creation of the component state.
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
ASSERT_TRUE(component_state_); 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. // 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