chromium/third_party/openscreen/src/cast/streaming/impl/answer_messages_unittest.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cast/streaming/public/answer_messages.h"

#include <chrono>
#include <string_view>
#include <utility>

#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "util/chrono_helpers.h"
#include "util/json/json_serialization.h"

namespace openscreen::cast {

namespace {

ElementsAre;

// NOTE: the castMode property has been removed from the specification. We leave
// it here in the valid offer to ensure that its inclusion does not break
// parsing.
constexpr char kValidAnswerJson[] =;

const Answer kValidAnswer{};

constexpr int kValidMaxPixelsPerSecond =;
constexpr Dimensions kValidDimensions{};
static const VideoConstraints kValidVideoConstraints{};

constexpr AudioConstraints kValidAudioConstraints{};

void ExpectEqualsValidAnswerJson(const Answer& answer) {}

void ExpectFailureOnParse(std::string_view raw_json) {}

// Functions that use ASSERT_* must return void, so we use an out parameter
// here instead of returning.
void ExpectSuccessOnParse(std::string_view raw_json, Answer* out = nullptr) {}

}  // anonymous namespace

TEST(AnswerMessagesTest, ProperlyPopulatedAnswerSerializesProperly) {}

TEST(AnswerMessagesTest, EmptyArraysOmitted) {}

TEST(AnswerMessagesTest, InvalidDimensionsCauseInvalid) {}

TEST(AnswerMessagesTest, InvalidAudioConstraintsCauseError) {}

TEST(AnswerMessagesTest, InvalidVideoConstraintsCauseError) {}

TEST(AnswerMessagesTest, InvalidDisplayDescriptionsCauseError) {}

TEST(AnswerMessagesTest, InvalidUdpPortsCauseError) {}

TEST(AnswerMessagesTest, CanParseValidAnswerJson) {}

// In practice, the rtpExtensions, receiverRtcpDscp, and receiverRtcpEventLog
// fields may be missing from some receivers. We handle this case by treating
// them as empty.
TEST(AnswerMessagesTest, SucceedsWithMissingRtpFields) {}

TEST(AnswerMessagesTest, ErrorOnEmptyAnswer) {}

TEST(AnswerMessagesTest, ErrorOnMissingUdpPort) {}

TEST(AnswerMessagesTest, ErrorOnMissingSsrcs) {}

TEST(AnswerMessagesTest, ErrorOnMissingSendIndexes) {}

TEST(AnswerMessagesTest, AllowsReceiverSideScaling) {}

TEST(AnswerMessagesTest, AssumesMinBitRateIfOmitted) {}

// Instead of testing all possible json parsing options for validity, we
// can instead directly test the IsValid() methods.
TEST(AnswerMessagesTest, AudioConstraintsIsValid) {}

TEST(AnswerMessagesTest, DimensionsIsValid) {}

TEST(AnswerMessagesTest, VideoConstraintsIsValid) {}

TEST(AnswerMessagesTest, ConstraintsIsValid) {}

TEST(AnswerMessagesTest, AspectRatioIsValid) {}

TEST(AnswerMessagesTest, AspectRatioTryParse) {}

TEST(AnswerMessagesTest, DisplayDescriptionTryParse) {}

TEST(AnswerMessagesTest, DisplayDescriptionIsValid) {}

// Instead of being tested here, Answer's IsValid is checked in all other
// relevant tests.

}  // namespace openscreen::cast