OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <deque> | 5 #include <deque> |
6 | 6 |
7 #include "media/base/mock_ffmpeg.h" | 7 #include "media/base/mock_ffmpeg.h" |
8 #include "media/ffmpeg/ffmpeg_common.h" | 8 #include "media/ffmpeg/ffmpeg_common.h" |
9 #include "media/filters/bitstream_converter.h" | 9 #include "media/filters/bitstream_converter.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 FFmpegBitstreamConverter converter(kTestFilterName, &test_stream_context_); | 84 FFmpegBitstreamConverter converter(kTestFilterName, &test_stream_context_); |
85 | 85 |
86 // Inject mock filter instance. | 86 // Inject mock filter instance. |
87 converter.stream_filter_ = &test_filter_; | 87 converter.stream_filter_ = &test_filter_; |
88 | 88 |
89 // Simulate a successful filter call, that allocates a new data buffer. | 89 // Simulate a successful filter call, that allocates a new data buffer. |
90 EXPECT_CALL(mock_ffmpeg_, | 90 EXPECT_CALL(mock_ffmpeg_, |
91 AVBitstreamFilterFilter(&test_filter_, &test_stream_context_, | 91 AVBitstreamFilterFilter(&test_filter_, &test_stream_context_, |
92 NULL, _, _, | 92 NULL, _, _, |
93 test_packet_.data, test_packet_.size, _)) | 93 test_packet_.data, test_packet_.size, _)) |
94 .WillOnce(Return(AVERROR_UNKNOWN)); | 94 .WillOnce(Return(AVERROR(EINVAL))); |
95 | 95 |
96 EXPECT_FALSE(converter.ConvertPacket(&test_packet_)); | 96 EXPECT_FALSE(converter.ConvertPacket(&test_packet_)); |
97 | 97 |
98 // Uninject mock filter instance to avoid cleanup code on destruction of | 98 // Uninject mock filter instance to avoid cleanup code on destruction of |
99 // converter. | 99 // converter. |
100 converter.stream_filter_ = NULL; | 100 converter.stream_filter_ = NULL; |
101 } | 101 } |
102 | 102 |
103 TEST_F(BitstreamConverterTest, ConvertPacket_Success) { | 103 TEST_F(BitstreamConverterTest, ConvertPacket_Success) { |
104 FFmpegBitstreamConverter converter(kTestFilterName, &test_stream_context_); | 104 FFmpegBitstreamConverter converter(kTestFilterName, &test_stream_context_); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 EXPECT_EQ(kData1, test_packet_.data); | 154 EXPECT_EQ(kData1, test_packet_.data); |
155 EXPECT_EQ(kTestSize1, test_packet_.size); | 155 EXPECT_EQ(kTestSize1, test_packet_.size); |
156 EXPECT_TRUE(test_packet_.destruct == NULL); | 156 EXPECT_TRUE(test_packet_.destruct == NULL); |
157 | 157 |
158 // Uninject mock filter instance to avoid cleanup code on destruction of | 158 // Uninject mock filter instance to avoid cleanup code on destruction of |
159 // converter. | 159 // converter. |
160 converter.stream_filter_ = NULL; | 160 converter.stream_filter_ = NULL; |
161 } | 161 } |
162 | 162 |
163 } // namespace media | 163 } // namespace media |
OLD | NEW |