| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/api/video/i420_buffer.h" | 11 #include "webrtc/api/video/i420_buffer.h" |
| 12 #include "webrtc/modules/video_coding/codecs/test/mock/mock_packet_manipulator.h
" | 12 #include "webrtc/modules/video_coding/codecs/test/mock/mock_packet_manipulator.h
" |
| 13 #include "webrtc/modules/video_coding/codecs/test/videoprocessor.h" | 13 #include "webrtc/modules/video_coding/codecs/test/videoprocessor.h" |
| 14 #include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h" | 14 #include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h" |
| 15 #include "webrtc/modules/video_coding/include/video_coding.h" | 15 #include "webrtc/modules/video_coding/include/video_coding.h" |
| 16 #include "webrtc/test/gmock.h" | 16 #include "webrtc/test/gmock.h" |
| 17 #include "webrtc/test/gtest.h" | 17 #include "webrtc/test/gtest.h" |
| 18 #include "webrtc/test/testsupport/mock/mock_frame_reader.h" | 18 #include "webrtc/test/testsupport/mock/mock_frame_reader.h" |
| 19 #include "webrtc/test/testsupport/mock/mock_frame_writer.h" | 19 #include "webrtc/test/testsupport/mock/mock_frame_writer.h" |
| 20 #include "webrtc/test/testsupport/packet_reader.h" | 20 #include "webrtc/test/testsupport/packet_reader.h" |
| 21 #include "webrtc/test/testsupport/unittest_utils.h" | 21 #include "webrtc/test/testsupport/unittest_utils.h" |
| 22 #include "webrtc/test/video_codec_settings.h" |
| 22 #include "webrtc/typedefs.h" | 23 #include "webrtc/typedefs.h" |
| 23 | 24 |
| 24 using ::testing::_; | 25 using ::testing::_; |
| 25 using ::testing::AtLeast; | 26 using ::testing::AtLeast; |
| 26 using ::testing::Return; | 27 using ::testing::Return; |
| 27 | 28 |
| 28 namespace webrtc { | 29 namespace webrtc { |
| 29 namespace test { | 30 namespace test { |
| 30 | 31 |
| 31 // Very basic testing for VideoProcessor. It's mostly tested by running the | 32 // Very basic testing for VideoProcessor. It's mostly tested by running the |
| 32 // video_quality_measurement program. | 33 // video_quality_measurement program. |
| 33 class VideoProcessorTest : public testing::Test { | 34 class VideoProcessorTest : public testing::Test { |
| 34 protected: | 35 protected: |
| 35 MockVideoEncoder encoder_mock_; | 36 MockVideoEncoder encoder_mock_; |
| 36 MockVideoDecoder decoder_mock_; | 37 MockVideoDecoder decoder_mock_; |
| 37 MockFrameReader frame_reader_mock_; | 38 MockFrameReader frame_reader_mock_; |
| 38 MockFrameWriter frame_writer_mock_; | 39 MockFrameWriter frame_writer_mock_; |
| 39 MockPacketManipulator packet_manipulator_mock_; | 40 MockPacketManipulator packet_manipulator_mock_; |
| 40 Stats stats_; | 41 Stats stats_; |
| 41 TestConfig config_; | 42 TestConfig config_; |
| 42 VideoCodec codec_settings_; | 43 VideoCodec codec_settings_; |
| 43 | 44 |
| 44 VideoProcessorTest() {} | 45 VideoProcessorTest() {} |
| 45 virtual ~VideoProcessorTest() {} | 46 virtual ~VideoProcessorTest() {} |
| 46 void SetUp() { | 47 void SetUp() { |
| 47 // Get a codec configuration struct and configure it. | 48 // Get a codec configuration struct and configure it. |
| 48 VideoCodingModule::Codec(kVideoCodecVP8, &codec_settings_); | 49 webrtc::test::CodecSettings(kVideoCodecVP8, &codec_settings_); |
| 49 config_.codec_settings = &codec_settings_; | 50 config_.codec_settings = &codec_settings_; |
| 50 config_.codec_settings->startBitrate = 100; | 51 config_.codec_settings->startBitrate = 100; |
| 51 config_.codec_settings->width = 352; | 52 config_.codec_settings->width = 352; |
| 52 config_.codec_settings->height = 288; | 53 config_.codec_settings->height = 288; |
| 53 } | 54 } |
| 54 void TearDown() {} | 55 void TearDown() {} |
| 55 | 56 |
| 56 void ExpectInit() { | 57 void ExpectInit() { |
| 57 EXPECT_CALL(encoder_mock_, InitEncode(_, _, _)).Times(1); | 58 EXPECT_CALL(encoder_mock_, InitEncode(_, _, _)).Times(1); |
| 58 EXPECT_CALL(encoder_mock_, RegisterEncodeCompleteCallback(_)) | 59 EXPECT_CALL(encoder_mock_, RegisterEncodeCompleteCallback(_)) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 86 &encoder_mock_, &decoder_mock_, &frame_reader_mock_, &frame_writer_mock_, | 87 &encoder_mock_, &decoder_mock_, &frame_reader_mock_, &frame_writer_mock_, |
| 87 &packet_manipulator_mock_, config_, &stats_, | 88 &packet_manipulator_mock_, config_, &stats_, |
| 88 nullptr /* source_frame_writer */, nullptr /* encoded_frame_writer */, | 89 nullptr /* source_frame_writer */, nullptr /* encoded_frame_writer */, |
| 89 nullptr /* decoded_frame_writer */); | 90 nullptr /* decoded_frame_writer */); |
| 90 video_processor.Init(); | 91 video_processor.Init(); |
| 91 video_processor.ProcessFrame(0); | 92 video_processor.ProcessFrame(0); |
| 92 } | 93 } |
| 93 | 94 |
| 94 } // namespace test | 95 } // namespace test |
| 95 } // namespace webrtc | 96 } // namespace webrtc |
| OLD | NEW |