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

Unified Diff: media/filters/decrypting_audio_decoder_unittest.cc

Issue 1143223007: media: Reland "Simplify {Audio|Video}Decoder initialization callback." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/decrypting_video_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 1f8395bf53a7173b11c65c3333351bd5afb5b37b..bb82a4c484d2af34210ce530a5c434c4a2a2896e 100644
--- a/media/filters/decrypting_audio_decoder_unittest.cc
+++ b/media/filters/decrypting_audio_decoder_unittest.cc
@@ -79,8 +79,8 @@ class DecryptingAudioDecoderTest : public testing::Test {
Destroy();
}
- void InitializeAndExpectStatus(const AudioDecoderConfig& config,
- PipelineStatus status) {
+ void InitializeAndExpectResult(const AudioDecoderConfig& config,
+ bool success) {
// Initialize data now that the config is known. Since the code uses
// invalid values (that CreateEmptyBuffer() doesn't support), tweak them
// just for CreateEmptyBuffer().
@@ -94,7 +94,7 @@ class DecryptingAudioDecoderTest : public testing::Test {
kNoTimestamp());
decoded_frame_list_.push_back(decoded_frame_);
- decoder_->Initialize(config, NewExpectedStatusCB(status),
+ decoder_->Initialize(config, NewExpectedBoolCB(success),
base::Bind(&DecryptingAudioDecoderTest::FrameReady,
base::Unretained(this)));
message_loop_.RunUntilIdle();
@@ -119,7 +119,7 @@ class DecryptingAudioDecoderTest : public testing::Test {
config_.Initialize(kCodecVorbis, kSampleFormatPlanarF32,
CHANNEL_LAYOUT_STEREO, kSampleRate, NULL, 0, true, true,
base::TimeDelta(), 0);
- InitializeAndExpectStatus(config_, PIPELINE_OK);
+ InitializeAndExpectResult(config_, true);
}
void Reinitialize() {
@@ -132,7 +132,7 @@ class DecryptingAudioDecoderTest : public testing::Test {
.WillOnce(RunCallback<1>(true));
EXPECT_CALL(*decryptor_, RegisterNewKeyCB(Decryptor::kAudio, _))
.WillOnce(SaveArg<1>(&key_added_cb_));
- decoder_->Initialize(new_config, NewExpectedStatusCB(PIPELINE_OK),
+ decoder_->Initialize(new_config, NewExpectedBoolCB(true),
base::Bind(&DecryptingAudioDecoderTest::FrameReady,
base::Unretained(this)));
}
@@ -288,7 +288,7 @@ TEST_F(DecryptingAudioDecoderTest, Initialize_UnencryptedAudioConfig) {
AudioDecoderConfig config(kCodecVorbis, kSampleFormatPlanarF32,
CHANNEL_LAYOUT_STEREO, kSampleRate, NULL, 0, false);
- InitializeAndExpectStatus(config, DECODER_ERROR_NOT_SUPPORTED);
+ InitializeAndExpectResult(config, false);
}
// Ensure decoder handles invalid audio configs without crashing.
@@ -296,7 +296,7 @@ TEST_F(DecryptingAudioDecoderTest, Initialize_InvalidAudioConfig) {
AudioDecoderConfig config(kUnknownAudioCodec, kUnknownSampleFormat,
CHANNEL_LAYOUT_STEREO, 0, NULL, 0, true);
- InitializeAndExpectStatus(config, PIPELINE_ERROR_DECODE);
+ InitializeAndExpectResult(config, false);
}
// Ensure decoder handles unsupported audio configs without crashing.
@@ -307,14 +307,14 @@ TEST_F(DecryptingAudioDecoderTest, Initialize_UnsupportedAudioConfig) {
AudioDecoderConfig config(kCodecVorbis, kSampleFormatPlanarF32,
CHANNEL_LAYOUT_STEREO, kSampleRate, NULL, 0, true);
- InitializeAndExpectStatus(config, DECODER_ERROR_NOT_SUPPORTED);
+ InitializeAndExpectResult(config, false);
}
TEST_F(DecryptingAudioDecoderTest, Initialize_NullDecryptor) {
ExpectDecryptorNotification(NULL, false);
AudioDecoderConfig config(kCodecVorbis, kSampleFormatPlanarF32,
CHANNEL_LAYOUT_STEREO, kSampleRate, NULL, 0, true);
- InitializeAndExpectStatus(config, DECODER_ERROR_NOT_SUPPORTED);
+ InitializeAndExpectResult(config, false);
}
// Test normal decrypt and decode case.
« no previous file with comments | « media/filters/decrypting_audio_decoder.cc ('k') | media/filters/decrypting_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698