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

Unified Diff: media/filters/decrypting_audio_decoder_unittest.cc

Issue 140823012: Reland: Add Stop() to AudioDecoder. (https://codereview.chromium.org/126793002/) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove extra scope Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/decrypting_audio_decoder.cc ('k') | media/filters/ffmpeg_audio_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/decrypting_audio_decoder_unittest.cc
diff --git a/media/filters/decrypting_audio_decoder_unittest.cc b/media/filters/decrypting_audio_decoder_unittest.cc
index 20d1597332e18c771bdad0373c9016be5ad203f5..050bcf8555bed458befaba2103c2fc857a790eb2 100644
--- a/media/filters/decrypting_audio_decoder_unittest.cc
+++ b/media/filters/decrypting_audio_decoder_unittest.cc
@@ -83,6 +83,10 @@ class DecryptingAudioDecoderTest : public testing::Test {
decoded_frame_list_() {
}
+ virtual ~DecryptingAudioDecoderTest() {
+ Stop();
+ }
+
void InitializeAndExpectStatus(const AudioDecoderConfig& config,
PipelineStatus status) {
// Initialize data now that the config is known. Since the code uses
@@ -207,6 +211,16 @@ class DecryptingAudioDecoderTest : public testing::Test {
}
}
+ void AbortAllPendingCBs() {
+ if (!pending_init_cb_.is_null()) {
+ ASSERT_TRUE(pending_audio_decode_cb_.is_null());
+ base::ResetAndReturn(&pending_init_cb_).Run(false);
+ return;
+ }
+
+ AbortPendingAudioDecodeCB();
+ }
+
void Reset() {
EXPECT_CALL(*decryptor_, ResetDecoder(Decryptor::kAudio))
.WillRepeatedly(InvokeWithoutArgs(
@@ -216,6 +230,18 @@ class DecryptingAudioDecoderTest : public testing::Test {
message_loop_.RunUntilIdle();
}
+ void Stop() {
+ EXPECT_CALL(*decryptor_, RegisterNewKeyCB(Decryptor::kAudio,
+ IsNullCallback()))
+ .Times(AtMost(1));
+ EXPECT_CALL(*decryptor_, DeinitializeDecoder(Decryptor::kAudio))
+ .WillRepeatedly(InvokeWithoutArgs(
+ this, &DecryptingAudioDecoderTest::AbortAllPendingCBs));
+
+ decoder_->Stop(NewExpectedClosure());
+ message_loop_.RunUntilIdle();
+ }
+
MOCK_METHOD1(RequestDecryptorNotification, void(const DecryptorReadyCB&));
MOCK_METHOD2(FrameReady,
« no previous file with comments | « media/filters/decrypting_audio_decoder.cc ('k') | media/filters/ffmpeg_audio_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698