diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 17:06:43 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-21 17:06:43 +0000 |
commit | a5c9c5758bd83b035323493a5f46d18c9335b91d (patch) | |
tree | 337a89ae05b865a7993dcf75d97f8f57e2956473 /media/base | |
parent | bef59426532a5823b90fcaaade7e7504708e23f2 (diff) | |
download | chromium_src-a5c9c5758bd83b035323493a5f46d18c9335b91d.zip chromium_src-a5c9c5758bd83b035323493a5f46d18c9335b91d.tar.gz chromium_src-a5c9c5758bd83b035323493a5f46d18c9335b91d.tar.bz2 |
Fixes FFmpegDemuxerTest.ReadAndSeek test flakiness by using a WaitableEvent.
Turns out it was the test code that was flaky and not a threading bug in our actual code. Under heavy load it was possible for a thread holding onto a reference to get time sliced long enough that the unit test continued executing until it asserted that the object was deleted when in fact it was not.
BUG=10653
Review URL: http://codereview.chromium.org/88010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14113 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r-- | media/base/mock_pipeline.h | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/media/base/mock_pipeline.h b/media/base/mock_pipeline.h index d320301..e317a5d 100644 --- a/media/base/mock_pipeline.h +++ b/media/base/mock_pipeline.h @@ -14,6 +14,7 @@ #include <deque> #include <string> +#include "base/message_loop.h" #include "media/base/media_format.h" #include "media/base/pipeline.h" #include "testing/gtest/include/gtest/gtest.h" @@ -135,17 +136,11 @@ class MockPipeline : public media::Pipeline { // pipeline is request/pull-based, only enough tasks to satisfy the request // should ever be executed. void RunAllTasks() { - while (!task_queue_.empty()) { - Task* task = task_queue_.front(); - task_queue_.pop_front(); - task->Run(); - delete task; - } + message_loop_.RunAllPending(); } void PostTask(Task* task) { - EXPECT_TRUE(task); - task_queue_.push_back(task); + message_loop_.PostTask(FROM_HERE, task); } void Error(media::PipelineError error) { @@ -191,8 +186,7 @@ class MockPipeline : public media::Pipeline { int64 buffered_bytes_; int64 total_bytes_; - typedef std::deque<Task*> TaskQueue; - TaskQueue task_queue_; + MessageLoop message_loop_; DISALLOW_COPY_AND_ASSIGN(MockPipeline); }; |