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

Side by Side Diff: webkit/media/video_renderer_impl_unittest.cc

Issue 9155003: Fix media timeline so that thumb never exceeds buffered data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/synchronization/waitable_event.h" 6 #include "base/synchronization/waitable_event.h"
7 #include "base/test/test_timeouts.h" 7 #include "base/test/test_timeouts.h"
8 #include "media/base/limits.h" 8 #include "media/base/limits.h"
9 #include "media/base/mock_filters.h" 9 #include "media/base/mock_filters.h"
10 #include "media/base/mock_filter_host.h" 10 #include "media/base/mock_filter_host.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 base::Bind( 69 base::Bind(
70 &VideoRendererImplTest::OnPaint, base::Unretained(this)), 70 &VideoRendererImplTest::OnPaint, base::Unretained(this)),
71 base::Bind( 71 base::Bind(
72 &VideoRendererImplTest::SetOpaque, base::Unretained(this))); 72 &VideoRendererImplTest::SetOpaque, base::Unretained(this)));
73 renderer_->set_host(&host_); 73 renderer_->set_host(&host_);
74 renderer_->SetPlaybackRate(1.0f); 74 renderer_->SetPlaybackRate(1.0f);
75 renderer_->Initialize( 75 renderer_->Initialize(
76 decoder_, 76 decoder_,
77 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event)), 77 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event)),
78 base::Bind(&VideoRendererImplTest::OnStatistics, 78 base::Bind(&VideoRendererImplTest::OnStatistics,
79 base::Unretained(this)),
80 base::Bind(&VideoRendererImplTest::OnTimeUpdate,
79 base::Unretained(this))); 81 base::Unretained(this)));
80 CHECK(event.TimedWait(timeout_)) << "Timed out waiting to initialize."; 82 CHECK(event.TimedWait(timeout_)) << "Timed out waiting to initialize.";
81 } 83 }
82 84
83 virtual ~VideoRendererImplTest() { 85 virtual ~VideoRendererImplTest() {
84 // Stop the renderer. 86 // Stop the renderer.
85 base::WaitableEvent event(false, false); 87 base::WaitableEvent event(false, false);
86 renderer_->Stop( 88 renderer_->Stop(
87 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event))); 89 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&event)));
88 CHECK(event.TimedWait(timeout_)) << "Timed out waiting to stop."; 90 CHECK(event.TimedWait(timeout_)) << "Timed out waiting to stop.";
(...skipping 26 matching lines...) Expand all
115 const DeliverCB& natural_frame_cb() { return natural_frame_cb_; } 117 const DeliverCB& natural_frame_cb() { return natural_frame_cb_; }
116 const DeliverCB& larger_frame_cb() { return larger_frame_cb_; } 118 const DeliverCB& larger_frame_cb() { return larger_frame_cb_; }
117 const DeliverCB& smaller_frame_cb() { return smaller_frame_cb_; } 119 const DeliverCB& smaller_frame_cb() { return smaller_frame_cb_; }
118 const base::Closure& fast_paint_cb() { return fast_paint_cb_; } 120 const base::Closure& fast_paint_cb() { return fast_paint_cb_; }
119 const base::Closure& slow_paint_cb() { return slow_paint_cb_; } 121 const base::Closure& slow_paint_cb() { return slow_paint_cb_; }
120 122
121 private: 123 private:
122 void OnPaint() {} 124 void OnPaint() {}
123 void SetOpaque(bool) {} 125 void SetOpaque(bool) {}
124 void OnStatistics(const PipelineStatistics&) {} 126 void OnStatistics(const PipelineStatistics&) {}
127 void OnTimeUpdate(base::TimeDelta) {}
125 128
126 void StartPrerolling() { 129 void StartPrerolling() {
127 EXPECT_CALL(*decoder_, Read(_)) 130 EXPECT_CALL(*decoder_, Read(_))
128 .WillRepeatedly(Invoke(this, &VideoRendererImplTest::FrameRequested)); 131 .WillRepeatedly(Invoke(this, &VideoRendererImplTest::FrameRequested));
129 132
130 renderer_->Seek(base::TimeDelta::FromMicroseconds(0), 133 renderer_->Seek(base::TimeDelta::FromMicroseconds(0),
131 base::Bind(&VideoRendererImplTest::PrerollDone, 134 base::Bind(&VideoRendererImplTest::PrerollDone,
132 base::Unretained(this), 135 base::Unretained(this),
133 media::PIPELINE_OK)); 136 media::PIPELINE_OK));
134 } 137 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 253
251 TEST_F(VideoRendererImplTest, FastPaint_Smaller) { 254 TEST_F(VideoRendererImplTest, FastPaint_Smaller) {
252 TestPainting(natural_frame_cb(), smaller_frame_cb(), fast_paint_cb()); 255 TestPainting(natural_frame_cb(), smaller_frame_cb(), fast_paint_cb());
253 } 256 }
254 257
255 TEST_F(VideoRendererImplTest, SlowPaint_Smaller) { 258 TEST_F(VideoRendererImplTest, SlowPaint_Smaller) {
256 TestPainting(natural_frame_cb(), smaller_frame_cb(), slow_paint_cb()); 259 TestPainting(natural_frame_cb(), smaller_frame_cb(), slow_paint_cb());
257 } 260 }
258 261
259 } // namespace webkit_media 262 } // namespace webkit_media
OLDNEW
« media/filters/audio_renderer_base.cc ('K') | « media/filters/video_renderer_base_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698