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

Unified Diff: media/mojo/clients/mojo_audio_decoder_unittest.cc

Issue 2624213006: media: Fix MojoAudioDecoder reinitialization (Closed)
Patch Set: Created 3 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
Index: media/mojo/clients/mojo_audio_decoder_unittest.cc
diff --git a/media/mojo/clients/mojo_audio_decoder_unittest.cc b/media/mojo/clients/mojo_audio_decoder_unittest.cc
index d45f22472f68eb6461fdf7ef463bb5221fb4ff58..58d1eb95b9e171e8cea9c2176bea53fd90bfeba3 100644
--- a/media/mojo/clients/mojo_audio_decoder_unittest.cc
+++ b/media/mojo/clients/mojo_audio_decoder_unittest.cc
@@ -108,11 +108,13 @@ class MojoAudioDecoderTest : public ::testing::Test {
mock_audio_decoder_ = mock_audio_decoder.get();
EXPECT_CALL(*mock_audio_decoder_, Initialize(_, _, _, _))
- .WillOnce(DoAll(SaveArg<3>(&output_cb_), RunCallback<2>(true)));
+ .WillRepeatedly(DoAll(SaveArg<3>(&output_cb_), RunCallback<2>(true)));
EXPECT_CALL(*mock_audio_decoder_, Decode(_, _))
.WillRepeatedly(
DoAll(InvokeWithoutArgs(this, &MojoAudioDecoderTest::ReturnOutput),
RunCallback<1>(DecodeStatus::OK)));
+ EXPECT_CALL(*mock_audio_decoder_, Reset(_))
+ .WillRepeatedly(RunCallback<0>());
mojo::MakeStrongBinding(base::MakeUnique<MojoAudioDecoderService>(
mojo_cdm_service_context_.GetWeakPtr(),
@@ -139,6 +141,16 @@ class MojoAudioDecoderTest : public ::testing::Test {
void Initialize() { InitializeAndExpect(true); }
+ void Reset() {
+ DVLOG(1) << __func__;
+ EXPECT_CALL(*this, OnReset())
+ .WillOnce(InvokeWithoutArgs(this, &MojoAudioDecoderTest::QuitLoop));
+
+ mojo_audio_decoder_->Reset(
+ base::Bind(&MojoAudioDecoderTest::OnReset, base::Unretained(this)));
+ RunLoop();
+ }
+
void ReturnOutput() {
for (int i = 0; i < kOutputPerDecode; ++i) {
scoped_refptr<AudioBuffer> audio_buffer = MakeAudioBuffer<float>(
@@ -211,6 +223,15 @@ TEST_F(MojoAudioDecoderTest, Initialize_Success) {
Initialize();
}
+TEST_F(MojoAudioDecoderTest, Reinitialize_Success) {
+ Initialize();
+ DecodeMultipleTimes(10);
+ Reset();
+
+ // Reinitialize MojoAudioDecoder.
+ Initialize();
+}
+
// Makes sure all callbacks and client calls are called in order. See
// http://crbug.com/646054
TEST_F(MojoAudioDecoderTest, Decode_MultipleTimes) {

Powered by Google App Engine
This is Rietveld 408576698