1// Copyright 2023 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
45use crate::media_session::facade::MediaSessionFacade;
6use crate::server::Facade;
7use anyhow::{bail, Error};
8use async_trait::async_trait;
9use serde_json::{to_value, Value};
1011#[async_trait(?Send)]
12/// The media session facade is added here for media latency e2e test.
13impl Facade for MediaSessionFacade {
14async fn handle_request(&self, method: String, _args: Value) -> Result<Value, Error> {
15match method.as_ref() {
16"WatchActiveSessionStatus" => {
17let result = self.watch_active_session_status().await?;
18Ok(to_value(result)?)
19 }
20"PublishMockPlayer" => {
21let result = self.publish_mock_player().await?;
22Ok(to_value(result)?)
23 }
24"StopMockPlayer" => {
25let result = self.stop_mock_player().await?;
26Ok(to_value(result)?)
27 }
28"ListReceivedRequests" => {
29let result = self.list_received_requests().await?;
30Ok(to_value(result)?)
31 }
32_ => bail!("Invalid MediaSessionFacade FIDL method: {:?}", method),
33 }
34 }
35}