#include "components/mirroring/service/openscreen_session_host.h"
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "base/values.h"
#include "components/mirroring/service/fake_network_service.h"
#include "components/mirroring/service/fake_video_capture_host.h"
#include "components/mirroring/service/mirror_settings.h"
#include "components/mirroring/service/mirroring_features.h"
#include "media/base/audio_codecs.h"
#include "media/base/media_switches.h"
#include "media/base/video_codecs.h"
#include "media/cast/cast_config.h"
#include "media/cast/test/utility/default_config.h"
#include "media/video/video_decode_accelerator.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/ip_address.h"
#include "services/network/public/mojom/clear_data_filter.mojom.h"
#include "services/viz/public/cpp/gpu/gpu.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/jsoncpp/source/include/json/reader.h"
#include "third_party/jsoncpp/source/include/json/writer.h"
#include "third_party/openscreen/src/cast/streaming/message_fields.h"
#include "third_party/openscreen/src/cast/streaming/offer_messages.h"
#include "third_party/openscreen/src/cast/streaming/remoting_capabilities.h"
#include "third_party/openscreen/src/cast/streaming/sender_message.h"
#include "third_party/openscreen/src/cast/streaming/ssrc.h"
FrameSenderConfig;
Packet;
RemotingSinkMetadata;
RemotingSinkMetadataPtr;
RemotingStartFailReason;
RemotingStopReason;
SessionError;
SessionType;
ErrorOr;
SenderMessage;
_;
AtLeast;
InvokeWithoutArgs;
Mock;
NiceMock;
namespace mirroring {
namespace {
const openscreen::cast::Answer kAnswerWithConstraints{ … };
class MockRemotingSource : public media::mojom::RemotingSource { … };
Json::Value ParseAsJsoncppValue(std::string_view document) { … }
std::string Stringify(const Json::Value& value) { … }
openscreen::cast::SenderStats ConstructDefaultSenderStats() { … }
}
class OpenscreenSessionHostTest : public mojom::ResourceProvider,
public mojom::SessionObserver,
public mojom::CastMessageChannel,
public ::testing::Test { … };
TEST_F(OpenscreenSessionHostTest, AudioOnlyMirroring) { … }
TEST_F(OpenscreenSessionHostTest, VideoOnlyMirroring) { … }
TEST_F(OpenscreenSessionHostTest, AudioAndVideoMirroring) { … }
TEST_F(OpenscreenSessionHostTest, AnswerWithConstraints) { … }
TEST_F(OpenscreenSessionHostTest, AnswerWithConstraintsLetterboxDisabled) { … }
TEST_F(OpenscreenSessionHostTest, AnswerWithConstraintsLetterboxForced) { … }
TEST_F(OpenscreenSessionHostTest, AnswerTimeout) { … }
TEST_F(OpenscreenSessionHostTest, SwitchToAndFromRemoting) { … }
TEST_F(OpenscreenSessionHostTest, SwitchFromRemotingForRemotePlayback) { … }
TEST_F(OpenscreenSessionHostTest, RemotingNotSupported) { … }
TEST_F(OpenscreenSessionHostTest, StopSessionWhileRemoting) { … }
TEST_F(OpenscreenSessionHostTest, StartRemotingFailed) { … }
TEST_F(OpenscreenSessionHostTest, SwitchSourceTabFromMirroring) { … }
TEST_F(OpenscreenSessionHostTest, SwitchSourceTabFromRemoting) { … }
TEST_F(OpenscreenSessionHostTest, StartRemotePlaybackTimeOut) { … }
TEST_F(OpenscreenSessionHostTest, ChangeTargetPlayoutDelay) { … }
TEST_F(OpenscreenSessionHostTest, UpdateBandwidthEstimate) { … }
TEST_F(OpenscreenSessionHostTest, CanRequestRefresh) { … }
TEST_F(OpenscreenSessionHostTest, Vp9CodecEnabledInOffer) { … }
TEST_F(OpenscreenSessionHostTest, Av1CodecEnabledInOffer) { … }
TEST_F(OpenscreenSessionHostTest, ShouldEnableHardwareVp8EncodingIfSupported) { … }
TEST_F(OpenscreenSessionHostTest, ShouldEnableHardwareH264EncodingIfSupported) { … }
TEST_F(OpenscreenSessionHostTest, GetStatsDefault) { … }
TEST_F(OpenscreenSessionHostTest, GetStatsEnabled) { … }
}