#include "chrome/browser/media/router/providers/cast/mirroring_activity.h"
#include <memory>
#include <utility>
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/field_trial_params.h"
#include "base/strings/string_number_conversions.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/mock_callback.h"
#include "base/test/values_test_util.h"
#include "base/values.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/media/router/providers/cast/cast_activity_test_base.h"
#include "chrome/browser/media/router/providers/cast/mock_mirroring_service_host.h"
#include "chrome/browser/media/router/providers/cast/test_util.h"
#include "chrome/browser/media/router/test/media_router_mojo_test.h"
#include "chrome/browser/media/router/test/mock_mojo_media_router.h"
#include "components/media_router/common/mojom/debugger.mojom.h"
#include "components/media_router/common/providers/cast/channel/cast_device_capability.h"
#include "components/media_router/common/providers/cast/channel/cast_test_util.h"
#include "components/mirroring/mojom/session_parameters.mojom.h"
#include "media/base/media_switches.h"
#include "media/cast/constants.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/blink/public/mojom/presentation/presentation.mojom.h"
IsJson;
_;
NiceMock;
WithArg;
WithArgs;
namespace media_router {
namespace {
constexpr int kFrameTreeNodeId = …;
constexpr int kTabId = …;
constexpr char kDescription[] = …;
constexpr char kDesktopMediaId[] = …;
constexpr char kDestinationId[] = …;
constexpr char kMessageDestinationId[] = …;
constexpr char kMessageSourceId[] = …;
constexpr char kNamespace[] = …;
constexpr char kPresentationId[] = …;
constexpr char kHistogramSessionLength[] = …;
constexpr char kHistogramSessionLengthAccessCode[] = …;
constexpr char kHistogramSessionLengthDesktop[] = …;
constexpr char kHistogramSessionLengthOffscreenTab[] = …;
constexpr char kHistogramSessionLengthTab[] = …;
constexpr char kHistogramAudioTransmissionKbps[] = …;
constexpr char kHistogramAudioAverageEncodeTime[] = …;
constexpr char kHistogramAudioAverageCaptureLatency[] = …;
constexpr char kHistogramAudioAverageEndToEndLatency[] = …;
constexpr char kHistogramAudioAverageNetworkLatency[] = …;
constexpr char kHistogramAudioRetransmittedPacketsPercentage[] = …;
constexpr char kHistogramAudioExceededPlayoutDelayPacketsPercentage[] = …;
constexpr char kHistogramAudioLateFramesPercentage[] = …;
constexpr char kHistogramVideoTransmissionKbps[] = …;
constexpr char kHistogramVideoAverageEncodeTime[] = …;
constexpr char kHistogramVideoAverageCaptureLatency[] = …;
constexpr char kHistogramVideoAverageEndToEndLatency[] = …;
constexpr char kHistogramVideoAverageNetworkLatency[] = …;
constexpr char kHistogramVideoRetransmittedPacketsPercentage[] = …;
constexpr char kHistogramVideoExceededPlayoutDelayPacketsPercentage[] = …;
constexpr char kHistogramVideoLateFramesPercentage[] = …;
class MockMirroringServiceHostFactory
: public mirroring::MirroringServiceHostFactory { … };
class MockCastMessageChannel : public mirroring::mojom::CastMessageChannel { … };
class MockMediaRouterDebugger : public mojom::Debugger { … };
}
class MirroringActivityTest
: public CastActivityTestBase,
public testing::WithParamInterface<const char* > { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(MirroringActivityTest, MirrorDesktop) { … }
TEST_F(MirroringActivityTest, MirrorTab) { … }
TEST_F(MirroringActivityTest, CreateMojoBindingsForTabWithCastAppUrl) { … }
TEST_F(MirroringActivityTest, MirrorOffscreenTab) { … }
TEST_F(MirroringActivityTest, MirrorAccessCode) { … }
TEST_F(MirroringActivityTest, OnError) { … }
TEST_F(MirroringActivityTest, DidStop) { … }
TEST_F(MirroringActivityTest, SendWebRtc) { … }
TEST_F(MirroringActivityTest, SendRemoting) { … }
TEST_F(MirroringActivityTest, OnAppMessageWrongNamespace) { … }
TEST_P(MirroringActivityTest, OnAppMessageWrongDestination) { … }
TEST_P(MirroringActivityTest, OnAppMessageWrongSource) { … }
TEST_P(MirroringActivityTest, OnAppMessageWrongNonlocal) { … }
TEST_P(MirroringActivityTest, OnAppMessage) { … }
TEST_F(MirroringActivityTest, OnInternalMessageNonlocal) { … }
TEST_F(MirroringActivityTest, OnInternalMessage) { … }
TEST_F(MirroringActivityTest, GetScrubbedLogMessage) { … }
TEST_F(MirroringActivityTest, SendMessageToClient) { … }
TEST_F(MirroringActivityTest, OnSourceChanged) { … }
TEST_F(MirroringActivityTest, OnSourceChangedNotifiesMediaStatusObserver) { … }
TEST_F(MirroringActivityTest, ReportsNotEnabledByDefault) { … }
TEST_F(MirroringActivityTest, EnableRtcpReports) { … }
TEST_F(MirroringActivityTest, Pause) { … }
TEST_F(MirroringActivityTest, Play) { … }
TEST_F(MirroringActivityTest, PauseAndPlay) { … }
TEST_F(MirroringActivityTest, PauseAndReset) { … }
TEST_F(MirroringActivityTest, OnRemotingStateChanged) { … }
TEST_F(MirroringActivityTest, MultipleMediaControllersNotified) { … }
TEST_F(MirroringActivityTest, TargetPlayoutDelaySetInRequest) { … }
TEST_F(MirroringActivityTest, TargetPlayoutDelayFeatureFlagParam) { … }
TEST_F(MirroringActivityTest, CastStreamingSenderUma) { … }
}