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

Unified Diff: media/filters/ffmpeg_demuxer_unittest.cc

Issue 2086353002: Remove calls to deprecated MessageLoop methods in media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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/fake_video_decoder_unittest.cc ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/ffmpeg_demuxer_unittest.cc
diff --git a/media/filters/ffmpeg_demuxer_unittest.cc b/media/filters/ffmpeg_demuxer_unittest.cc
index 59977f41058aac0b11376c918693cce13e3f234e..629205bc355d4fea38f7c1bcf71cf4284d6c1078 100644
--- a/media/filters/ffmpeg_demuxer_unittest.cc
+++ b/media/filters/ffmpeg_demuxer_unittest.cc
@@ -15,6 +15,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/path_service.h"
+#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -174,7 +175,8 @@ class FFmpegDemuxerTest : public testing::Test {
EXPECT_EQ(read_expectation.is_key_frame, buffer->is_key_frame());
DCHECK_EQ(&message_loop_, base::MessageLoop::current());
OnReadDoneCalled(read_expectation.size, read_expectation.timestamp_us);
- message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
+ message_loop_.task_runner()->PostTask(
+ FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
}
DemuxerStream::ReadCB NewReadCB(const tracked_objects::Location& location,
@@ -247,7 +249,7 @@ class FFmpegDemuxerTest : public testing::Test {
const int kMaxBuffers = 170;
for (int i = 0; !got_eos_buffer && i < kMaxBuffers; i++) {
stream->Read(base::Bind(&EosOnReadDone, &got_eos_buffer));
- message_loop_.Run();
+ base::RunLoop().Run();
}
EXPECT_TRUE(got_eos_buffer);
@@ -425,10 +427,10 @@ TEST_F(FFmpegDemuxerTest, Read_Audio) {
DemuxerStream* audio = demuxer_->GetStream(DemuxerStream::AUDIO);
audio->Read(NewReadCB(FROM_HERE, 29, 0, true));
- message_loop_.Run();
+ base::RunLoop().Run();
audio->Read(NewReadCB(FROM_HERE, 27, 3000, true));
- message_loop_.Run();
+ base::RunLoop().Run();
EXPECT_EQ(22084, demuxer_->GetMemoryUsage());
}
@@ -442,10 +444,10 @@ TEST_F(FFmpegDemuxerTest, Read_Video) {
DemuxerStream* video = demuxer_->GetStream(DemuxerStream::VIDEO);
video->Read(NewReadCB(FROM_HERE, 22084, 0, true));
- message_loop_.Run();
+ base::RunLoop().Run();
video->Read(NewReadCB(FROM_HERE, 1057, 33000, false));
- message_loop_.Run();
+ base::RunLoop().Run();
EXPECT_EQ(323, demuxer_->GetMemoryUsage());
}
@@ -461,10 +463,10 @@ TEST_F(FFmpegDemuxerTest, Read_Text) {
EXPECT_EQ(DemuxerStream::TEXT, text_stream->type());
text_stream->Read(NewReadCB(FROM_HERE, 31, 0, true));
- message_loop_.Run();
+ base::RunLoop().Run();
text_stream->Read(NewReadCB(FROM_HERE, 19, 500000, true));
- message_loop_.Run();
+ base::RunLoop().Run();
}
TEST_F(FFmpegDemuxerTest, SeekInitialized_NoVideoStartTime) {
@@ -494,10 +496,10 @@ TEST_F(FFmpegDemuxerTest, Read_VideoPositiveStartTime) {
for (int i = 0; i < 2; ++i) {
video->Read(NewReadCB(FROM_HERE, 5636, video_start_time.InMicroseconds(),
true));
- message_loop_.Run();
+ base::RunLoop().Run();
audio->Read(NewReadCB(FROM_HERE, 165, audio_start_time.InMicroseconds(),
true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Verify that the start time is equal to the lowest timestamp (ie the
// audio).
@@ -523,7 +525,7 @@ TEST_F(FFmpegDemuxerTest, Read_AudioNoStartTime) {
for (int i = 0; i < 2; ++i) {
demuxer_->GetStream(DemuxerStream::AUDIO)
->Read(NewReadCB(FROM_HERE, 4095, 0, true));
- message_loop_.Run();
+ base::RunLoop().Run();
EXPECT_EQ(base::TimeDelta(), demuxer_->start_time());
// Seek back to the beginning and repeat the test.
@@ -553,28 +555,28 @@ TEST_F(FFmpegDemuxerTest,
audio->Read(
NewReadCBWithCheckedDiscard(FROM_HERE, 40, 0, kInfiniteDuration(),
true));
- message_loop_.Run();
+ base::RunLoop().Run();
audio->Read(
NewReadCBWithCheckedDiscard(FROM_HERE, 41, 2903, kInfiniteDuration(),
true));
- message_loop_.Run();
+ base::RunLoop().Run();
audio->Read(NewReadCBWithCheckedDiscard(
FROM_HERE, 173, 5805, base::TimeDelta::FromMicroseconds(10159), true));
- message_loop_.Run();
+ base::RunLoop().Run();
audio->Read(NewReadCB(FROM_HERE, 148, 18866, true));
- message_loop_.Run();
+ base::RunLoop().Run();
EXPECT_EQ(base::TimeDelta::FromMicroseconds(-15964),
demuxer_->start_time());
video->Read(NewReadCB(FROM_HERE, 5751, 0, true));
- message_loop_.Run();
+ base::RunLoop().Run();
video->Read(NewReadCB(FROM_HERE, 846, 33367, true));
- message_loop_.Run();
+ base::RunLoop().Run();
video->Read(NewReadCB(FROM_HERE, 1255, 66733, true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Seek back to the beginning and repeat the test.
WaitableMessageLoopEvent event;
@@ -600,10 +602,10 @@ TEST_F(FFmpegDemuxerTest, Read_AudioNegativeStartTimeAndOggDiscard_Sync) {
for (int i = 0; i < 2; ++i) {
audio->Read(NewReadCBWithCheckedDiscard(
FROM_HERE, 1, 0, base::TimeDelta::FromMicroseconds(2902), true));
- message_loop_.Run();
+ base::RunLoop().Run();
audio->Read(NewReadCB(FROM_HERE, 1, 2902, true));
- message_loop_.Run();
+ base::RunLoop().Run();
EXPECT_EQ(base::TimeDelta::FromMicroseconds(-2902),
demuxer_->start_time());
@@ -612,13 +614,13 @@ TEST_F(FFmpegDemuxerTest, Read_AudioNegativeStartTimeAndOggDiscard_Sync) {
EXPECT_EQ(base::TimeDelta(), demuxer_->GetStartTime());
video->Read(NewReadCB(FROM_HERE, 9997, 0, true));
- message_loop_.Run();
+ base::RunLoop().Run();
video->Read(NewReadCB(FROM_HERE, 16, 33241, false));
- message_loop_.Run();
+ base::RunLoop().Run();
video->Read(NewReadCB(FROM_HERE, 631, 66482, false));
- message_loop_.Run();
+ base::RunLoop().Run();
// Seek back to the beginning and repeat the test.
WaitableMessageLoopEvent event;
@@ -650,7 +652,7 @@ TEST_F(FFmpegDemuxerTest, Read_AudioNegativeStartTimeAndOpusDiscard_Sync) {
for (size_t j = 0; j < arraysize(kTestExpectations); ++j) {
audio->Read(NewReadCB(FROM_HERE, kTestExpectations[j][0],
kTestExpectations[j][1], true));
- message_loop_.Run();
+ base::RunLoop().Run();
}
// Though the internal start time may be below zero, the exposed media time
@@ -658,13 +660,13 @@ TEST_F(FFmpegDemuxerTest, Read_AudioNegativeStartTimeAndOpusDiscard_Sync) {
EXPECT_EQ(base::TimeDelta(), demuxer_->GetStartTime());
video->Read(NewReadCB(FROM_HERE, 16009, 0, true));
- message_loop_.Run();
+ base::RunLoop().Run();
video->Read(NewReadCB(FROM_HERE, 2715, 1000, false));
- message_loop_.Run();
+ base::RunLoop().Run();
video->Read(NewReadCB(FROM_HERE, 427, 33000, false));
- message_loop_.Run();
+ base::RunLoop().Run();
// Seek back to the beginning and repeat the test.
WaitableMessageLoopEvent event;
@@ -686,10 +688,10 @@ TEST_F(FFmpegDemuxerTest, Read_AudioNegativeStartTimeAndOpusSfxDiscard_Sync) {
// Run the test twice with a seek in between.
for (int i = 0; i < 2; ++i) {
audio->Read(NewReadCB(FROM_HERE, 314, 0, true));
- message_loop_.Run();
+ base::RunLoop().Run();
audio->Read(NewReadCB(FROM_HERE, 244, 20000, true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Though the internal start time may be below zero, the exposed media time
// must always be greater than zero.
@@ -723,7 +725,7 @@ TEST_F(FFmpegDemuxerTest, Read_EndOfStreamText) {
const int kMaxBuffers = 10;
for (int i = 0; !got_eos_buffer && i < kMaxBuffers; i++) {
text_stream->Read(base::Bind(&EosOnReadDone, &got_eos_buffer));
- message_loop_.Run();
+ base::RunLoop().Run();
}
EXPECT_TRUE(got_eos_buffer);
@@ -781,7 +783,7 @@ TEST_F(FFmpegDemuxerTest, Seek) {
// Read a video packet and release it.
video->Read(NewReadCB(FROM_HERE, 22084, 0, true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Issue a simple forward seek, which should discard queued packets.
WaitableMessageLoopEvent event;
@@ -791,19 +793,19 @@ TEST_F(FFmpegDemuxerTest, Seek) {
// Audio read #1.
audio->Read(NewReadCB(FROM_HERE, 145, 803000, true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Audio read #2.
audio->Read(NewReadCB(FROM_HERE, 148, 826000, true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Video read #1.
video->Read(NewReadCB(FROM_HERE, 5425, 801000, true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Video read #2.
video->Read(NewReadCB(FROM_HERE, 1906, 834000, false));
- message_loop_.Run();
+ base::RunLoop().Run();
}
TEST_F(FFmpegDemuxerTest, SeekText) {
@@ -825,7 +827,7 @@ TEST_F(FFmpegDemuxerTest, SeekText) {
// Read a text packet and release it.
text_stream->Read(NewReadCB(FROM_HERE, 31, 0, true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Issue a simple forward seek, which should discard queued packets.
WaitableMessageLoopEvent event;
@@ -835,27 +837,27 @@ TEST_F(FFmpegDemuxerTest, SeekText) {
// Audio read #1.
audio->Read(NewReadCB(FROM_HERE, 145, 803000, true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Audio read #2.
audio->Read(NewReadCB(FROM_HERE, 148, 826000, true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Video read #1.
video->Read(NewReadCB(FROM_HERE, 5425, 801000, true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Video read #2.
video->Read(NewReadCB(FROM_HERE, 1906, 834000, false));
- message_loop_.Run();
+ base::RunLoop().Run();
// Text read #1.
text_stream->Read(NewReadCB(FROM_HERE, 19, 500000, true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Text read #2.
text_stream->Read(NewReadCB(FROM_HERE, 19, 1000000, true));
- message_loop_.Run();
+ base::RunLoop().Run();
}
class MockReadCB {
@@ -887,7 +889,7 @@ TEST_F(FFmpegDemuxerTest, Stop) {
// Attempt the read...
audio->Read(base::Bind(&MockReadCB::Run, base::Unretained(&callback)));
- message_loop_.RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
// Don't let the test call Stop() again.
demuxer_.reset();
@@ -907,7 +909,7 @@ TEST_F(FFmpegDemuxerTest, SeekWithCuesBeforeFirstCluster) {
// Read a video packet and release it.
video->Read(NewReadCB(FROM_HERE, 22084, 0, true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Issue a simple forward seek, which should discard queued packets.
WaitableMessageLoopEvent event;
@@ -917,19 +919,19 @@ TEST_F(FFmpegDemuxerTest, SeekWithCuesBeforeFirstCluster) {
// Audio read #1.
audio->Read(NewReadCB(FROM_HERE, 40, 2403000, true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Audio read #2.
audio->Read(NewReadCB(FROM_HERE, 42, 2406000, true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Video read #1.
video->Read(NewReadCB(FROM_HERE, 5276, 2402000, true));
- message_loop_.Run();
+ base::RunLoop().Run();
// Video read #2.
video->Read(NewReadCB(FROM_HERE, 1740, 2436000, false));
- message_loop_.Run();
+ base::RunLoop().Run();
}
#if defined(USE_PROPRIETARY_CODECS)
« no previous file with comments | « media/filters/fake_video_decoder_unittest.cc ('k') | media/filters/ffmpeg_video_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698