Fix some potential after free errors on TestCompletionCallback
[chromium-blink-merge.git] / media / filters / decrypting_video_decoder_unittest.cc
blob27d4e5383ecb5823e8fb21460ad55cba704b626b
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include <string>
6 #include <vector>
8 #include "base/bind.h"
9 #include "base/callback_helpers.h"
10 #include "base/message_loop.h"
11 #include "media/base/decoder_buffer.h"
12 #include "media/base/decrypt_config.h"
13 #include "media/base/gmock_callback_support.h"
14 #include "media/base/mock_filters.h"
15 #include "media/base/test_helpers.h"
16 #include "media/base/video_frame.h"
17 #include "media/filters/decrypting_video_decoder.h"
18 #include "testing/gmock/include/gmock/gmock.h"
20 using ::testing::_;
21 using ::testing::AtMost;
22 using ::testing::IsNull;
23 using ::testing::ReturnRef;
24 using ::testing::SaveArg;
25 using ::testing::StrictMock;
27 namespace media {
29 static const uint8 kFakeKeyId[] = { 0x4b, 0x65, 0x79, 0x20, 0x49, 0x44 };
30 static const uint8 kFakeIv[DecryptConfig::kDecryptionKeySize] = { 0 };
32 // Create a fake non-empty encrypted buffer.
33 static scoped_refptr<DecoderBuffer> CreateFakeEncryptedBuffer() {
34 const int buffer_size = 16; // Need a non-empty buffer;
35 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(buffer_size));
36 buffer->SetDecryptConfig(scoped_ptr<DecryptConfig>(new DecryptConfig(
37 std::string(reinterpret_cast<const char*>(kFakeKeyId),
38 arraysize(kFakeKeyId)),
39 std::string(reinterpret_cast<const char*>(kFakeIv), arraysize(kFakeIv)),
41 std::vector<SubsampleEntry>())));
42 return buffer;
45 // Use anonymous namespace here to prevent the actions to be defined multiple
46 // times across multiple test files. Sadly we can't use static for them.
47 namespace {
49 ACTION_P(ReturnBuffer, buffer) {
50 arg0.Run(buffer.get() ? DemuxerStream::kOk : DemuxerStream::kAborted, buffer);
53 ACTION_P(RunCallbackIfNotNull, param) {
54 if (!arg0.is_null())
55 arg0.Run(param);
58 ACTION_P2(ResetAndRunCallback, callback, param) {
59 base::ResetAndReturn(callback).Run(param);
62 MATCHER(IsEndOfStream, "end of stream") {
63 return (arg->IsEndOfStream());
66 } // namespace
68 class DecryptingVideoDecoderTest : public testing::Test {
69 public:
70 DecryptingVideoDecoderTest()
71 : decoder_(new DecryptingVideoDecoder(
72 message_loop_.message_loop_proxy(),
73 base::Bind(
74 &DecryptingVideoDecoderTest::RequestDecryptorNotification,
75 base::Unretained(this)))),
76 decryptor_(new StrictMock<MockDecryptor>()),
77 demuxer_(new StrictMock<MockDemuxerStream>(DemuxerStream::VIDEO)),
78 encrypted_buffer_(CreateFakeEncryptedBuffer()),
79 decoded_video_frame_(VideoFrame::CreateBlackFrame(
80 TestVideoConfig::NormalCodedSize())),
81 null_video_frame_(scoped_refptr<VideoFrame>()),
82 end_of_stream_video_frame_(VideoFrame::CreateEmptyFrame()) {
83 EXPECT_CALL(*this, RequestDecryptorNotification(_))
84 .WillRepeatedly(RunCallbackIfNotNull(decryptor_.get()));
87 virtual ~DecryptingVideoDecoderTest() {
88 Stop();
91 void InitializeAndExpectStatus(const VideoDecoderConfig& config,
92 PipelineStatus status) {
93 demuxer_->set_video_decoder_config(config);
94 decoder_->Initialize(demuxer_.get(), NewExpectedStatusCB(status),
95 base::Bind(&MockStatisticsCB::OnStatistics,
96 base::Unretained(&statistics_cb_)));
97 message_loop_.RunUntilIdle();
100 void Initialize() {
101 EXPECT_CALL(*decryptor_, InitializeVideoDecoder(_, _))
102 .WillRepeatedly(RunCallback<1>(true));
103 EXPECT_CALL(*decryptor_, RegisterNewKeyCB(Decryptor::kVideo, _))
104 .WillRepeatedly(SaveArg<1>(&key_added_cb_));
106 InitializeAndExpectStatus(TestVideoConfig::NormalEncrypted(), PIPELINE_OK);
109 void Reinitialize() {
110 EXPECT_CALL(*decryptor_, DeinitializeDecoder(Decryptor::kVideo));
111 InitializeAndExpectStatus(TestVideoConfig::LargeEncrypted(), PIPELINE_OK);
114 void ReadAndExpectFrameReadyWith(
115 VideoDecoder::Status status,
116 const scoped_refptr<VideoFrame>& video_frame) {
117 if (status != VideoDecoder::kOk)
118 EXPECT_CALL(*this, FrameReady(status, IsNull()));
119 else if (video_frame.get() && video_frame->IsEndOfStream())
120 EXPECT_CALL(*this, FrameReady(status, IsEndOfStream()));
121 else
122 EXPECT_CALL(*this, FrameReady(status, video_frame));
124 decoder_->Read(base::Bind(&DecryptingVideoDecoderTest::FrameReady,
125 base::Unretained(this)));
126 message_loop_.RunUntilIdle();
129 // Sets up expectations and actions to put DecryptingVideoDecoder in an
130 // active normal decoding state.
131 void EnterNormalDecodingState() {
132 EXPECT_CALL(*demuxer_, Read(_))
133 .WillOnce(ReturnBuffer(encrypted_buffer_))
134 .WillRepeatedly(ReturnBuffer(DecoderBuffer::CreateEOSBuffer()));
135 EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _))
136 .WillOnce(RunCallback<1>(Decryptor::kSuccess, decoded_video_frame_))
137 .WillRepeatedly(RunCallback<1>(Decryptor::kNeedMoreData,
138 scoped_refptr<VideoFrame>()));
139 EXPECT_CALL(statistics_cb_, OnStatistics(_));
141 ReadAndExpectFrameReadyWith(VideoDecoder::kOk, decoded_video_frame_);
144 // Sets up expectations and actions to put DecryptingVideoDecoder in an end
145 // of stream state. This function must be called after
146 // EnterNormalDecodingState() to work.
147 void EnterEndOfStreamState() {
148 ReadAndExpectFrameReadyWith(VideoDecoder::kOk, end_of_stream_video_frame_);
151 // Make the read callback pending by saving and not firing it.
152 void EnterPendingReadState() {
153 EXPECT_TRUE(pending_demuxer_read_cb_.is_null());
154 EXPECT_CALL(*demuxer_, Read(_))
155 .WillOnce(SaveArg<0>(&pending_demuxer_read_cb_));
156 decoder_->Read(base::Bind(&DecryptingVideoDecoderTest::FrameReady,
157 base::Unretained(this)));
158 message_loop_.RunUntilIdle();
159 // Make sure the Read() on the decoder triggers a Read() on the demuxer.
160 EXPECT_FALSE(pending_demuxer_read_cb_.is_null());
163 // Make the video decode callback pending by saving and not firing it.
164 void EnterPendingDecodeState() {
165 EXPECT_TRUE(pending_video_decode_cb_.is_null());
166 EXPECT_CALL(*demuxer_, Read(_))
167 .WillRepeatedly(ReturnBuffer(encrypted_buffer_));
168 EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(encrypted_buffer_, _))
169 .WillOnce(SaveArg<1>(&pending_video_decode_cb_));
171 decoder_->Read(base::Bind(&DecryptingVideoDecoderTest::FrameReady,
172 base::Unretained(this)));
173 message_loop_.RunUntilIdle();
174 // Make sure the Read() on the decoder triggers a DecryptAndDecode() on the
175 // decryptor.
176 EXPECT_FALSE(pending_video_decode_cb_.is_null());
179 void EnterWaitingForKeyState() {
180 EXPECT_CALL(*demuxer_, Read(_))
181 .WillRepeatedly(ReturnBuffer(encrypted_buffer_));
182 EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _))
183 .WillRepeatedly(RunCallback<1>(Decryptor::kNoKey, null_video_frame_));
184 decoder_->Read(base::Bind(&DecryptingVideoDecoderTest::FrameReady,
185 base::Unretained(this)));
186 message_loop_.RunUntilIdle();
189 void AbortPendingVideoDecodeCB() {
190 if (!pending_video_decode_cb_.is_null()) {
191 base::ResetAndReturn(&pending_video_decode_cb_).Run(
192 Decryptor::kSuccess, scoped_refptr<VideoFrame>(NULL));
196 void AbortAllPendingCBs() {
197 if (!pending_init_cb_.is_null()) {
198 ASSERT_TRUE(pending_video_decode_cb_.is_null());
199 base::ResetAndReturn(&pending_init_cb_).Run(false);
200 return;
203 AbortPendingVideoDecodeCB();
206 void Reset() {
207 EXPECT_CALL(*decryptor_, ResetDecoder(Decryptor::kVideo))
208 .WillRepeatedly(InvokeWithoutArgs(
209 this, &DecryptingVideoDecoderTest::AbortPendingVideoDecodeCB));
211 decoder_->Reset(NewExpectedClosure());
212 message_loop_.RunUntilIdle();
215 void Stop() {
216 EXPECT_CALL(*decryptor_, RegisterNewKeyCB(Decryptor::kVideo,
217 IsNullCallback()))
218 .Times(AtMost(1));
219 EXPECT_CALL(*decryptor_, DeinitializeDecoder(Decryptor::kVideo))
220 .WillRepeatedly(InvokeWithoutArgs(
221 this, &DecryptingVideoDecoderTest::AbortAllPendingCBs));
223 decoder_->Stop(NewExpectedClosure());
224 message_loop_.RunUntilIdle();
227 MOCK_METHOD1(RequestDecryptorNotification, void(const DecryptorReadyCB&));
229 MOCK_METHOD2(FrameReady, void(VideoDecoder::Status,
230 const scoped_refptr<VideoFrame>&));
232 base::MessageLoop message_loop_;
233 scoped_ptr<DecryptingVideoDecoder> decoder_;
234 scoped_ptr<StrictMock<MockDecryptor> > decryptor_;
235 scoped_ptr<StrictMock<MockDemuxerStream> > demuxer_;
236 MockStatisticsCB statistics_cb_;
238 DemuxerStream::ReadCB pending_demuxer_read_cb_;
239 Decryptor::DecoderInitCB pending_init_cb_;
240 Decryptor::NewKeyCB key_added_cb_;
241 Decryptor::VideoDecodeCB pending_video_decode_cb_;
243 // Constant buffer/frames to be returned by the |demuxer_| and |decryptor_|.
244 scoped_refptr<DecoderBuffer> encrypted_buffer_;
245 scoped_refptr<VideoFrame> decoded_video_frame_;
246 scoped_refptr<VideoFrame> null_video_frame_;
247 scoped_refptr<VideoFrame> end_of_stream_video_frame_;
249 private:
250 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoderTest);
253 TEST_F(DecryptingVideoDecoderTest, Initialize_Normal) {
254 Initialize();
257 TEST_F(DecryptingVideoDecoderTest, Initialize_NullDecryptor) {
258 EXPECT_CALL(*this, RequestDecryptorNotification(_))
259 .WillRepeatedly(RunCallbackIfNotNull(static_cast<Decryptor*>(NULL)));
260 InitializeAndExpectStatus(TestVideoConfig::NormalEncrypted(),
261 DECODER_ERROR_NOT_SUPPORTED);
264 TEST_F(DecryptingVideoDecoderTest, Initialize_Failure) {
265 EXPECT_CALL(*decryptor_, InitializeVideoDecoder(_, _))
266 .WillRepeatedly(RunCallback<1>(false));
267 EXPECT_CALL(*decryptor_, RegisterNewKeyCB(Decryptor::kVideo, _))
268 .WillRepeatedly(SaveArg<1>(&key_added_cb_));
270 InitializeAndExpectStatus(TestVideoConfig::NormalEncrypted(),
271 DECODER_ERROR_NOT_SUPPORTED);
274 TEST_F(DecryptingVideoDecoderTest, Reinitialize_Normal) {
275 Initialize();
276 EnterNormalDecodingState();
277 Reinitialize();
280 TEST_F(DecryptingVideoDecoderTest, Reinitialize_Failure) {
281 Initialize();
282 EnterNormalDecodingState();
284 EXPECT_CALL(*decryptor_, DeinitializeDecoder(Decryptor::kVideo));
285 EXPECT_CALL(*decryptor_, InitializeVideoDecoder(_, _))
286 .WillOnce(RunCallback<1>(false));
288 InitializeAndExpectStatus(TestVideoConfig::NormalEncrypted(),
289 DECODER_ERROR_NOT_SUPPORTED);
292 // Test normal decrypt and decode case.
293 TEST_F(DecryptingVideoDecoderTest, DecryptAndDecode_Normal) {
294 Initialize();
295 EnterNormalDecodingState();
298 // Test the case where the decryptor returns error when doing decrypt and
299 // decode.
300 TEST_F(DecryptingVideoDecoderTest, DecryptAndDecode_DecodeError) {
301 Initialize();
303 EXPECT_CALL(*demuxer_, Read(_))
304 .WillRepeatedly(ReturnBuffer(encrypted_buffer_));
305 EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _))
306 .WillRepeatedly(RunCallback<1>(Decryptor::kError,
307 scoped_refptr<VideoFrame>(NULL)));
309 ReadAndExpectFrameReadyWith(VideoDecoder::kDecodeError, null_video_frame_);
311 // After a decode error occurred, all following read returns kDecodeError.
312 ReadAndExpectFrameReadyWith(VideoDecoder::kDecodeError, null_video_frame_);
315 // Test the case where the decryptor returns kNeedMoreData to ask for more
316 // buffers before it can produce a frame.
317 TEST_F(DecryptingVideoDecoderTest, DecryptAndDecode_NeedMoreData) {
318 Initialize();
320 EXPECT_CALL(*demuxer_, Read(_))
321 .Times(2)
322 .WillRepeatedly(ReturnBuffer(encrypted_buffer_));
323 EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _))
324 .WillOnce(RunCallback<1>(Decryptor::kNeedMoreData,
325 scoped_refptr<VideoFrame>()))
326 .WillRepeatedly(RunCallback<1>(Decryptor::kSuccess,
327 decoded_video_frame_));
328 EXPECT_CALL(statistics_cb_, OnStatistics(_))
329 .Times(2);
331 ReadAndExpectFrameReadyWith(VideoDecoder::kOk, decoded_video_frame_);
334 // Test the case where the decryptor receives end-of-stream buffer.
335 TEST_F(DecryptingVideoDecoderTest, DecryptAndDecode_EndOfStream) {
336 Initialize();
337 EnterNormalDecodingState();
338 EnterEndOfStreamState();
341 // Test aborted read on the demuxer stream.
342 TEST_F(DecryptingVideoDecoderTest, DemuxerRead_Aborted) {
343 Initialize();
345 // ReturnBuffer() with NULL triggers aborted demuxer read.
346 EXPECT_CALL(*demuxer_, Read(_))
347 .WillOnce(ReturnBuffer(scoped_refptr<DecoderBuffer>()));
349 ReadAndExpectFrameReadyWith(VideoDecoder::kOk, null_video_frame_);
352 // Test the case where the a key is added when the decryptor is in
353 // kWaitingForKey state.
354 TEST_F(DecryptingVideoDecoderTest, KeyAdded_DuringWaitingForKey) {
355 Initialize();
356 EnterWaitingForKeyState();
358 EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _))
359 .WillRepeatedly(RunCallback<1>(Decryptor::kSuccess,
360 decoded_video_frame_));
361 EXPECT_CALL(statistics_cb_, OnStatistics(_));
362 EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, decoded_video_frame_));
363 key_added_cb_.Run();
364 message_loop_.RunUntilIdle();
367 // Test the case where the a key is added when the decryptor is in
368 // kPendingDecode state.
369 TEST_F(DecryptingVideoDecoderTest, KeyAdded_DruingPendingDecode) {
370 Initialize();
371 EnterPendingDecodeState();
373 EXPECT_CALL(*decryptor_, DecryptAndDecodeVideo(_, _))
374 .WillRepeatedly(RunCallback<1>(Decryptor::kSuccess,
375 decoded_video_frame_));
376 EXPECT_CALL(statistics_cb_, OnStatistics(_));
377 EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, decoded_video_frame_));
378 // The video decode callback is returned after the correct decryption key is
379 // added.
380 key_added_cb_.Run();
381 base::ResetAndReturn(&pending_video_decode_cb_).Run(Decryptor::kNoKey,
382 null_video_frame_);
383 message_loop_.RunUntilIdle();
386 // Test resetting when the decoder is in kIdle state but has not decoded any
387 // frame.
388 TEST_F(DecryptingVideoDecoderTest, Reset_DuringIdleAfterInitialization) {
389 Initialize();
390 Reset();
393 // Test resetting when the decoder is in kIdle state after it has decoded one
394 // frame.
395 TEST_F(DecryptingVideoDecoderTest, Reset_DuringIdleAfterDecodedOneFrame) {
396 Initialize();
397 EnterNormalDecodingState();
398 Reset();
401 // Test resetting when the decoder is in kPendingDemuxerRead state and the read
402 // callback is returned with kOk.
403 TEST_F(DecryptingVideoDecoderTest, Reset_DuringDemuxerRead_Ok) {
404 Initialize();
405 EnterPendingReadState();
407 EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull()));
409 Reset();
410 base::ResetAndReturn(&pending_demuxer_read_cb_).Run(DemuxerStream::kOk,
411 encrypted_buffer_);
412 message_loop_.RunUntilIdle();
415 // Test resetting when the decoder is in kPendingDemuxerRead state and the read
416 // callback is returned with kAborted.
417 TEST_F(DecryptingVideoDecoderTest, Reset_DuringDemuxerRead_Aborted) {
418 Initialize();
419 EnterPendingReadState();
421 // Make sure we get a NULL video frame returned.
422 EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull()));
424 Reset();
425 base::ResetAndReturn(&pending_demuxer_read_cb_).Run(DemuxerStream::kAborted,
426 NULL);
427 message_loop_.RunUntilIdle();
430 // Test resetting when the decoder is in kPendingDecode state.
431 TEST_F(DecryptingVideoDecoderTest, Reset_DuringPendingDecode) {
432 Initialize();
433 EnterPendingDecodeState();
435 EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull()));
437 Reset();
440 // Test resetting when the decoder is in kWaitingForKey state.
441 TEST_F(DecryptingVideoDecoderTest, Reset_DuringWaitingForKey) {
442 Initialize();
443 EnterWaitingForKeyState();
445 EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull()));
447 Reset();
450 // Test resetting when the decoder has hit end of stream and is in
451 // kDecodeFinished state.
452 TEST_F(DecryptingVideoDecoderTest, Reset_AfterDecodeFinished) {
453 Initialize();
454 EnterNormalDecodingState();
455 EnterEndOfStreamState();
456 Reset();
459 // Test resetting after the decoder has been reset.
460 TEST_F(DecryptingVideoDecoderTest, Reset_AfterReset) {
461 Initialize();
462 EnterNormalDecodingState();
463 Reset();
464 Reset();
467 // Test stopping when the decoder is in kDecryptorRequested state.
468 TEST_F(DecryptingVideoDecoderTest, Stop_DuringDecryptorRequested) {
469 demuxer_->set_video_decoder_config(TestVideoConfig::NormalEncrypted());
470 DecryptorReadyCB decryptor_ready_cb;
471 EXPECT_CALL(*this, RequestDecryptorNotification(_))
472 .WillOnce(SaveArg<0>(&decryptor_ready_cb));
473 decoder_->Initialize(demuxer_.get(),
474 NewExpectedStatusCB(DECODER_ERROR_NOT_SUPPORTED),
475 base::Bind(&MockStatisticsCB::OnStatistics,
476 base::Unretained(&statistics_cb_)));
477 message_loop_.RunUntilIdle();
478 // |decryptor_ready_cb| is saved but not called here.
479 EXPECT_FALSE(decryptor_ready_cb.is_null());
481 // During stop, RequestDecryptorNotification() should be called with a NULL
482 // callback to cancel the |decryptor_ready_cb|.
483 EXPECT_CALL(*this, RequestDecryptorNotification(IsNullCallback()))
484 .WillOnce(ResetAndRunCallback(&decryptor_ready_cb,
485 reinterpret_cast<Decryptor*>(NULL)));
486 Stop();
489 // Test stopping when the decoder is in kPendingDecoderInit state.
490 TEST_F(DecryptingVideoDecoderTest, Stop_DuringPendingDecoderInit) {
491 EXPECT_CALL(*decryptor_, InitializeVideoDecoder(_, _))
492 .WillOnce(SaveArg<1>(&pending_init_cb_));
494 InitializeAndExpectStatus(TestVideoConfig::NormalEncrypted(),
495 DECODER_ERROR_NOT_SUPPORTED);
496 EXPECT_FALSE(pending_init_cb_.is_null());
498 Stop();
501 // Test stopping when the decoder is in kIdle state but has not decoded any
502 // frame.
503 TEST_F(DecryptingVideoDecoderTest, Stop_DuringIdleAfterInitialization) {
504 Initialize();
505 Stop();
508 // Test stopping when the decoder is in kIdle state after it has decoded one
509 // frame.
510 TEST_F(DecryptingVideoDecoderTest, Stop_DuringIdleAfterDecodedOneFrame) {
511 Initialize();
512 EnterNormalDecodingState();
513 Stop();
516 // Test stopping when the decoder is in kPendingDemuxerRead state.
517 TEST_F(DecryptingVideoDecoderTest, Stop_DuringPendingDemuxerRead) {
518 Initialize();
519 EnterPendingReadState();
521 EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull()));
523 Stop();
524 base::ResetAndReturn(&pending_demuxer_read_cb_).Run(DemuxerStream::kOk,
525 encrypted_buffer_);
526 message_loop_.RunUntilIdle();
529 // Test stopping when the decoder is in kPendingDecode state.
530 TEST_F(DecryptingVideoDecoderTest, Stop_DuringPendingDecode) {
531 Initialize();
532 EnterPendingDecodeState();
534 EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull()));
536 Stop();
539 // Test stopping when the decoder is in kWaitingForKey state.
540 TEST_F(DecryptingVideoDecoderTest, Stop_DuringWaitingForKey) {
541 Initialize();
542 EnterWaitingForKeyState();
544 EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull()));
546 Stop();
549 // Test stopping when the decoder has hit end of stream and is in
550 // kDecodeFinished state.
551 TEST_F(DecryptingVideoDecoderTest, Stop_AfterDecodeFinished) {
552 Initialize();
553 EnterNormalDecodingState();
554 EnterEndOfStreamState();
555 Stop();
558 // Test stopping when there is a pending reset on the decoder.
559 // Reset is pending because it cannot complete when the video decode callback
560 // is pending.
561 TEST_F(DecryptingVideoDecoderTest, Stop_DuringPendingReset) {
562 Initialize();
563 EnterPendingDecodeState();
565 EXPECT_CALL(*decryptor_, ResetDecoder(Decryptor::kVideo));
566 EXPECT_CALL(*this, FrameReady(VideoDecoder::kOk, IsNull()));
568 decoder_->Reset(NewExpectedClosure());
569 Stop();
572 // Test stopping after the decoder has been reset.
573 TEST_F(DecryptingVideoDecoderTest, Stop_AfterReset) {
574 Initialize();
575 EnterNormalDecodingState();
576 Reset();
577 Stop();
580 // Test stopping after the decoder has been stopped.
581 TEST_F(DecryptingVideoDecoderTest, Stop_AfterStop) {
582 Initialize();
583 EnterNormalDecodingState();
584 Stop();
585 Stop();
588 } // namespace media