diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-06-18 14:10:49 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2015-06-18 13:53:24 +0000 |
commit | 813fbf95af77a531c57a8c497345ad2c61d475b3 (patch) | |
tree | 821b2c8de8365f21b6c9ba17a236fb3006a1d506 /chromium/media/base/test_helpers.cc | |
parent | af6588f8d723931a298c995fa97259bb7f7deb55 (diff) | |
download | qtwebengine-chromium-813fbf95af77a531c57a8c497345ad2c61d475b3.tar.gz |
BASELINE: Update chromium to 44.0.2403.47
Change-Id: Ie056fedba95cf5e5c76b30c4b2c80fca4764aa2f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Diffstat (limited to 'chromium/media/base/test_helpers.cc')
-rw-r--r-- | chromium/media/base/test_helpers.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/chromium/media/base/test_helpers.cc b/chromium/media/base/test_helpers.cc index b37dc0e8f8a..bde12b4061a 100644 --- a/chromium/media/base/test_helpers.cc +++ b/chromium/media/base/test_helpers.cc @@ -8,13 +8,14 @@ #include "base/logging.h" #include "base/message_loop/message_loop.h" #include "base/pickle.h" +#include "base/run_loop.h" #include "base/test/test_timeouts.h" #include "base/time/time.h" #include "base/timer/timer.h" #include "media/base/audio_buffer.h" #include "media/base/bind_to_current_loop.h" #include "media/base/decoder_buffer.h" -#include "ui/gfx/rect.h" +#include "ui/gfx/geometry/rect.h" using ::testing::_; using ::testing::StrictMock; @@ -84,26 +85,31 @@ void WaitableMessageLoopEvent::RunAndWaitForStatus(PipelineStatus expected) { return; } + run_loop_.reset(new base::RunLoop()); base::Timer timer(false, false); timer.Start(FROM_HERE, TestTimeouts::action_timeout(), base::Bind( &WaitableMessageLoopEvent::OnTimeout, base::Unretained(this))); - message_loop_->Run(); + run_loop_->Run(); EXPECT_TRUE(signaled_); EXPECT_EQ(expected, status_); + run_loop_.reset(); } void WaitableMessageLoopEvent::OnCallback(PipelineStatus status) { DCHECK_EQ(message_loop_, base::MessageLoop::current()); signaled_ = true; status_ = status; - message_loop_->QuitWhenIdle(); + + // |run_loop_| may be null if the callback fires before RunAndWaitForStatus(). + if (run_loop_) + run_loop_->Quit(); } void WaitableMessageLoopEvent::OnTimeout() { DCHECK_EQ(message_loop_, base::MessageLoop::current()); ADD_FAILURE() << "Timed out waiting for message loop to quit"; - message_loop_->QuitWhenIdle(); + run_loop_->Quit(); } static VideoDecoderConfig GetTestConfig(VideoCodec codec, @@ -222,6 +228,7 @@ scoped_refptr<DecoderBuffer> CreateFakeVideoBufferForTest( static_cast<int>(pickle.size())); buffer->set_timestamp(timestamp); buffer->set_duration(duration); + buffer->set_is_key_frame(true); return buffer; } @@ -259,4 +266,10 @@ void CallbackPairChecker::RecordBCalled() { expecting_b_ = false; } +void AddLogEntryForTest(MediaLog::MediaLogLevel level, + const std::string& message) { + DVLOG(1) << "Media log (" << MediaLog::MediaLogLevelToString(level) + << "): " << message; +} + } // namespace media |