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 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } | 53 } |
54 void TearDown() {} | 54 void TearDown() {} |
55 | 55 |
56 void ExpectInit() { | 56 void ExpectInit() { |
57 EXPECT_CALL(encoder_mock_, InitEncode(_, _, _)).Times(1); | 57 EXPECT_CALL(encoder_mock_, InitEncode(_, _, _)).Times(1); |
58 EXPECT_CALL(encoder_mock_, RegisterEncodeCompleteCallback(_)) | 58 EXPECT_CALL(encoder_mock_, RegisterEncodeCompleteCallback(_)) |
59 .Times(AtLeast(1)); | 59 .Times(AtLeast(1)); |
60 EXPECT_CALL(decoder_mock_, InitDecode(_, _)).Times(1); | 60 EXPECT_CALL(decoder_mock_, InitDecode(_, _)).Times(1); |
61 EXPECT_CALL(decoder_mock_, RegisterDecodeCompleteCallback(_)) | 61 EXPECT_CALL(decoder_mock_, RegisterDecodeCompleteCallback(_)) |
62 .Times(AtLeast(1)); | 62 .Times(AtLeast(1)); |
63 EXPECT_CALL(frame_reader_mock_, NumberOfFrames()).WillOnce(Return(1)); | 63 EXPECT_CALL(frame_reader_mock_, NumberOfFrames()).WillRepeatedly(Return(1)); |
64 EXPECT_CALL(frame_reader_mock_, FrameLength()).WillOnce(Return(152064)); | 64 EXPECT_CALL(frame_reader_mock_, FrameLength()).WillOnce(Return(152064)); |
65 } | 65 } |
66 }; | 66 }; |
67 | 67 |
68 TEST_F(VideoProcessorTest, Init) { | 68 TEST_F(VideoProcessorTest, Init) { |
69 ExpectInit(); | 69 ExpectInit(); |
70 VideoProcessorImpl video_processor( | 70 VideoProcessorImpl video_processor( |
71 &encoder_mock_, &decoder_mock_, &frame_reader_mock_, &frame_writer_mock_, | 71 &encoder_mock_, &decoder_mock_, &frame_reader_mock_, &frame_writer_mock_, |
72 &packet_manipulator_mock_, config_, &stats_, | 72 &packet_manipulator_mock_, config_, &stats_, |
73 nullptr /* source_frame_writer */, nullptr /* encoded_frame_writer */, | 73 nullptr /* source_frame_writer */, nullptr /* encoded_frame_writer */, |
74 nullptr /* decoded_frame_writer */); | 74 nullptr /* decoded_frame_writer */); |
75 ASSERT_TRUE(video_processor.Init()); | 75 video_processor.Init(); |
76 } | 76 } |
77 | 77 |
78 TEST_F(VideoProcessorTest, ProcessFrame) { | 78 TEST_F(VideoProcessorTest, ProcessFrame) { |
79 ExpectInit(); | 79 ExpectInit(); |
80 EXPECT_CALL(encoder_mock_, Encode(_, _, _)).Times(1); | 80 EXPECT_CALL(encoder_mock_, Encode(_, _, _)).Times(1); |
81 EXPECT_CALL(frame_reader_mock_, ReadFrame()) | 81 EXPECT_CALL(frame_reader_mock_, ReadFrame()) |
82 .WillOnce(Return(I420Buffer::Create(50, 50))); | 82 .WillOnce(Return(I420Buffer::Create(50, 50))); |
83 // Since we don't return any callback from the mock, the decoder will not | 83 // Since we don't return any callback from the mock, the decoder will not |
84 // be more than initialized... | 84 // be more than initialized... |
85 VideoProcessorImpl video_processor( | 85 VideoProcessorImpl video_processor( |
86 &encoder_mock_, &decoder_mock_, &frame_reader_mock_, &frame_writer_mock_, | 86 &encoder_mock_, &decoder_mock_, &frame_reader_mock_, &frame_writer_mock_, |
87 &packet_manipulator_mock_, config_, &stats_, | 87 &packet_manipulator_mock_, config_, &stats_, |
88 nullptr /* source_frame_writer */, nullptr /* encoded_frame_writer */, | 88 nullptr /* source_frame_writer */, nullptr /* encoded_frame_writer */, |
89 nullptr /* decoded_frame_writer */); | 89 nullptr /* decoded_frame_writer */); |
90 ASSERT_TRUE(video_processor.Init()); | 90 video_processor.Init(); |
91 video_processor.ProcessFrame(0); | 91 video_processor.ProcessFrame(0); |
92 } | 92 } |
93 | 93 |
94 } // namespace test | 94 } // namespace test |
95 } // namespace webrtc | 95 } // namespace webrtc |
OLD | NEW |