blob: 967c33b3d2ae4e025f5b23e57cdcee6d8b3ce013 [file] [log] [blame]
noahricbe850e12017-01-20 01:07:26 -08001/*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include "webrtc/media/engine/webrtcvideoencoderfactory.h"
12
13#include "webrtc/test/gtest.h"
14
15class WebRtcVideoEncoderFactoryForTest
16 : public cricket::WebRtcVideoEncoderFactory {
17 public:
18 WebRtcVideoEncoderFactoryForTest() {
19 codecs_.push_back(VideoCodec(webrtc::kVideoCodecH264, "H264"));
20 codecs_.push_back(VideoCodec(webrtc::kVideoCodecVP8, "VP8"));
21 }
22
23 const std::vector<VideoCodec>& codecs() const override { return codecs_; }
24
25 void DestroyVideoEncoder(webrtc::VideoEncoder* encoder) override {}
26
27 std::vector<VideoCodec> codecs_;
28};
29
30TEST(WebRtcVideoEncoderFactoryTest, TestMultipleCallsToSupportedCodecs) {
31 WebRtcVideoEncoderFactoryForTest factory;
32 EXPECT_EQ(2u, factory.supported_codecs().size());
33 EXPECT_EQ("H264", factory.supported_codecs()[0].name);
34 EXPECT_EQ("VP8", factory.supported_codecs()[1].name);
35
36 // The codec list doesn't grow when called repeatedly.
37 EXPECT_EQ(2u, factory.supported_codecs().size());
38}