Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: media/filters/fake_video_decoder_unittest.cc

Issue 2835203006: media: Refactor VideoFrameStreamTest (Closed)
Patch Set: comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/filters/fake_video_decoder.cc ('k') | media/filters/video_frame_stream_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "media/base/decoder_buffer.h" 9 #include "media/base/decoder_buffer.h"
10 #include "media/base/mock_filters.h" 10 #include "media/base/mock_filters.h"
(...skipping 14 matching lines...) Expand all
25 int decoding_delay; 25 int decoding_delay;
26 int max_decode_requests; 26 int max_decode_requests;
27 }; 27 };
28 28
29 class FakeVideoDecoderTest 29 class FakeVideoDecoderTest
30 : public testing::Test, 30 : public testing::Test,
31 public testing::WithParamInterface<FakeVideoDecoderTestParams> { 31 public testing::WithParamInterface<FakeVideoDecoderTestParams> {
32 public: 32 public:
33 FakeVideoDecoderTest() 33 FakeVideoDecoderTest()
34 : decoder_(new FakeVideoDecoder( 34 : decoder_(new FakeVideoDecoder(
35 "FakeVideoDecoder",
35 GetParam().decoding_delay, 36 GetParam().decoding_delay,
36 GetParam().max_decode_requests, 37 GetParam().max_decode_requests,
37 base::Bind(&FakeVideoDecoderTest::OnBytesDecoded, 38 base::Bind(&FakeVideoDecoderTest::OnBytesDecoded,
38 base::Unretained(this)))), 39 base::Unretained(this)))),
39 num_input_buffers_(0), 40 num_input_buffers_(0),
40 num_decoded_frames_(0), 41 num_decoded_frames_(0),
41 num_bytes_decoded_(0), 42 num_bytes_decoded_(0),
42 total_bytes_in_buffers_(0), 43 total_bytes_in_buffers_(0),
43 last_decode_status_(DecodeStatus::OK), 44 last_decode_status_(DecodeStatus::OK),
44 pending_decode_requests_(0), 45 pending_decode_requests_(0),
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 Initialize(); 270 Initialize();
270 271
271 while (num_input_buffers_ < kTotalBuffers) { 272 while (num_input_buffers_ < kTotalBuffers) {
272 ReadOneFrame(); 273 ReadOneFrame();
273 EXPECT_EQ(num_input_buffers_, 274 EXPECT_EQ(num_input_buffers_,
274 num_decoded_frames_ + GetParam().decoding_delay); 275 num_decoded_frames_ + GetParam().decoding_delay);
275 } 276 }
276 } 277 }
277 278
278 TEST_P(FakeVideoDecoderTest, Read_ZeroDelay) { 279 TEST_P(FakeVideoDecoderTest, Read_ZeroDelay) {
279 decoder_.reset(new FakeVideoDecoder( 280 decoder_.reset(
280 0, 1, base::Bind(&FakeVideoDecoderTest::OnBytesDecoded, 281 new FakeVideoDecoder("FakeVideoDecoder", 0, 1,
281 base::Unretained(this)))); 282 base::Bind(&FakeVideoDecoderTest::OnBytesDecoded,
283 base::Unretained(this))));
282 Initialize(); 284 Initialize();
283 285
284 while (num_input_buffers_ < kTotalBuffers) { 286 while (num_input_buffers_ < kTotalBuffers) {
285 ReadOneFrame(); 287 ReadOneFrame();
286 EXPECT_EQ(num_input_buffers_, num_decoded_frames_); 288 EXPECT_EQ(num_input_buffers_, num_decoded_frames_);
287 } 289 }
288 } 290 }
289 291
290 TEST_P(FakeVideoDecoderTest, Read_Pending_NotEnoughData) { 292 TEST_P(FakeVideoDecoderTest, Read_Pending_NotEnoughData) {
291 if (GetParam().decoding_delay < 1) 293 if (GetParam().decoding_delay < 1)
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 } 425 }
424 426
425 TEST_P(FakeVideoDecoderTest, Destroy_DuringPendingReadAndPendingReset) { 427 TEST_P(FakeVideoDecoderTest, Destroy_DuringPendingReadAndPendingReset) {
426 Initialize(); 428 Initialize();
427 EnterPendingReadState(); 429 EnterPendingReadState();
428 EnterPendingResetState(); 430 EnterPendingResetState();
429 Destroy(); 431 Destroy();
430 } 432 }
431 433
432 } // namespace media 434 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/fake_video_decoder.cc ('k') | media/filters/video_frame_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698