#include "cast/streaming/public/receiver_session.h"
#include <utility>
#include "cast/streaming/public/receiver.h"
#include "cast/streaming/testing/mock_environment.h"
#include "cast/streaming/testing/simple_message_port.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "platform/base/ip_address.h"
#include "platform/test/fake_clock.h"
#include "platform/test/fake_task_runner.h"
#include "util/chrono_helpers.h"
#include "util/json/json_serialization.h"
_;
InSequence;
Invoke;
NiceMock;
Return;
StrictMock;
namespace openscreen::cast {
namespace {
constexpr char kValidOfferMessage[] = …;
constexpr char kValidRemotingOfferMessage[] = …;
constexpr char kNoAudioOfferMessage[] = …;
constexpr char kInvalidCodecOfferMessage[] = …;
constexpr char kNoVideoOfferMessage[] = …;
constexpr char kNoAudioOrVideoOfferMessage[] = …;
constexpr char kInvalidJsonOfferMessage[] = …;
constexpr char kMissingMandatoryFieldOfferMessage[] = …;
constexpr char kMissingSeqNumOfferMessage[] = …;
constexpr char kValidJsonInvalidFormatOfferMessage[] = …;
constexpr char kNullJsonOfferMessage[] = …;
constexpr char kInvalidSequenceNumberMessage[] = …;
constexpr char kUnknownTypeMessage[] = …;
constexpr char kInvalidTypeMessage[] = …;
constexpr char kGetCapabilitiesMessage[] = …;
constexpr char kRpcMessage[] = …;
class FakeClient : public ReceiverSession::Client { … };
void ExpectIsErrorAnswer(const std::string& raw_message) { … }
Json::Value ExpectIsValidAnswer(const std::string& raw_message) { … }
MATCHER_P(
NegotiatedWithSender,
sender_id,
"Checks that a set of ConfiguredReceivers are from a specific sender") { … }
}
class ReceiverSessionTest : public ::testing::Test { … };
TEST_F(ReceiverSessionTest, CanNegotiateWithDefaultConstraints) { … }
TEST_F(ReceiverSessionTest, CanNegotiateWithCustomCodecConstraints) { … }
TEST_F(ReceiverSessionTest, RejectsStreamWithUnsupportedCodecParameter) { … }
TEST_F(ReceiverSessionTest, AcceptsStreamWithNoCodecParameter) { … }
TEST_F(ReceiverSessionTest, AcceptsStreamWithMatchingParameter) { … }
TEST_F(ReceiverSessionTest, CanNegotiateWithLimits) { … }
TEST_F(ReceiverSessionTest, HandlesNoValidAudioStream) { … }
TEST_F(ReceiverSessionTest, HandlesInvalidCodec) { … }
TEST_F(ReceiverSessionTest, HandlesNoValidVideoStream) { … }
TEST_F(ReceiverSessionTest, RejectsOfferIfNewOneComesBeforeNegotiationIsDone) { … }
TEST_F(ReceiverSessionTest, HandlesRenegotiationFromSameSender) { … }
TEST_F(ReceiverSessionTest, HandlesRenegotiationFromAnotherSender) { … }
TEST_F(ReceiverSessionTest, HandlesErrorOfferFromAnotherSender) { … }
TEST_F(ReceiverSessionTest, HandlesNoValidStreams) { … }
TEST_F(ReceiverSessionTest, HandlesMalformedOffer) { … }
TEST_F(ReceiverSessionTest, HandlesMissingSeqNumInOffer) { … }
TEST_F(ReceiverSessionTest, HandlesOfferMissingMandatoryFields) { … }
TEST_F(ReceiverSessionTest, HandlesImproperlyFormattedOffer) { … }
TEST_F(ReceiverSessionTest, HandlesNullOffer) { … }
TEST_F(ReceiverSessionTest, HandlesInvalidSequenceNumber) { … }
TEST_F(ReceiverSessionTest, HandlesUnknownTypeMessage) { … }
TEST_F(ReceiverSessionTest, HandlesInvalidTypeMessage) { … }
TEST_F(ReceiverSessionTest, DoesNotCrashOnMessagePortError) { … }
TEST_F(ReceiverSessionTest, NotifiesReceiverDestruction) { … }
TEST_F(ReceiverSessionTest, HandlesInvalidAnswer) { … }
TEST_F(ReceiverSessionTest, DelaysAnswerUntilEnvironmentIsReady) { … }
TEST_F(ReceiverSessionTest,
ReturnsErrorAnswerIfEnvironmentIsAlreadyInvalidated) { … }
TEST_F(ReceiverSessionTest, ReturnsErrorAnswerIfEnvironmentIsInvalidated) { … }
TEST_F(ReceiverSessionTest, ReturnsErrorCapabilitiesIfRemotingDisabled) { … }
TEST_F(ReceiverSessionTest, ReturnsCapabilitiesWithRemotingDefaults) { … }
TEST_F(ReceiverSessionTest, ReturnsCapabilitiesWithRemotingConstraints) { … }
TEST_F(ReceiverSessionTest, CanNegotiateRemoting) { … }
TEST_F(ReceiverSessionTest, HandlesRpcMessage) { … }
}