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

Side by Side Diff: media/base/pipeline_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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/threading/simple_thread.h" 10 #include "base/threading/simple_thread.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 EXPECT_CALL(*mocks_->audio_decoder(), SetPlaybackRate(0.0f)); 149 EXPECT_CALL(*mocks_->audio_decoder(), SetPlaybackRate(0.0f));
150 EXPECT_CALL(*mocks_->audio_decoder(), Seek(base::TimeDelta(), _)) 150 EXPECT_CALL(*mocks_->audio_decoder(), Seek(base::TimeDelta(), _))
151 .WillOnce(Invoke(&RunFilterStatusCB)); 151 .WillOnce(Invoke(&RunFilterStatusCB));
152 EXPECT_CALL(*mocks_->audio_decoder(), Stop(_)) 152 EXPECT_CALL(*mocks_->audio_decoder(), Stop(_))
153 .WillOnce(Invoke(&RunStopFilterCallback)); 153 .WillOnce(Invoke(&RunStopFilterCallback));
154 } 154 }
155 155
156 // Sets up expectations to allow the video renderer to initialize. 156 // Sets up expectations to allow the video renderer to initialize.
157 void InitializeVideoRenderer() { 157 void InitializeVideoRenderer() {
158 EXPECT_CALL(*mocks_->video_renderer(), 158 EXPECT_CALL(*mocks_->video_renderer(),
159 Initialize(mocks_->video_decoder(), _, _)) 159 Initialize(mocks_->video_decoder(), _, _, _))
160 .WillOnce(Invoke(&RunFilterCallback3)); 160 .WillOnce(Invoke(&RunFilterCallback4));
161 EXPECT_CALL(*mocks_->video_renderer(), SetPlaybackRate(0.0f)); 161 EXPECT_CALL(*mocks_->video_renderer(), SetPlaybackRate(0.0f));
162 EXPECT_CALL(*mocks_->video_renderer(), 162 EXPECT_CALL(*mocks_->video_renderer(),
163 Seek(mocks_->demuxer()->GetStartTime(), _)) 163 Seek(mocks_->demuxer()->GetStartTime(), _))
164 .WillOnce(Invoke(&RunFilterStatusCB)); 164 .WillOnce(Invoke(&RunFilterStatusCB));
165 EXPECT_CALL(*mocks_->video_renderer(), Stop(_)) 165 EXPECT_CALL(*mocks_->video_renderer(), Stop(_))
166 .WillOnce(Invoke(&RunStopFilterCallback)); 166 .WillOnce(Invoke(&RunStopFilterCallback));
167 } 167 }
168 168
169 // Sets up expectations to allow the audio renderer to initialize. 169 // Sets up expectations to allow the audio renderer to initialize.
170 void InitializeAudioRenderer(bool disable_after_init_callback = false) { 170 void InitializeAudioRenderer(bool disable_after_init_callback = false) {
171 if (disable_after_init_callback) { 171 if (disable_after_init_callback) {
172 EXPECT_CALL(*mocks_->audio_renderer(), 172 EXPECT_CALL(*mocks_->audio_renderer(),
173 Initialize(mocks_->audio_decoder(), _, _)) 173 Initialize(mocks_->audio_decoder(), _, _, _))
174 .WillOnce(DoAll(Invoke(&RunFilterCallback3), 174 .WillOnce(DoAll(Invoke(&RunFilterCallback4),
175 DisableAudioRenderer(mocks_->audio_renderer()))); 175 DisableAudioRenderer(mocks_->audio_renderer())));
176 } else { 176 } else {
177 EXPECT_CALL(*mocks_->audio_renderer(), 177 EXPECT_CALL(*mocks_->audio_renderer(),
178 Initialize(mocks_->audio_decoder(), _, _)) 178 Initialize(mocks_->audio_decoder(), _, _, _))
179 .WillOnce(Invoke(&RunFilterCallback3)); 179 .WillOnce(Invoke(&RunFilterCallback4));
180 } 180 }
181 EXPECT_CALL(*mocks_->audio_renderer(), SetPlaybackRate(0.0f)); 181 EXPECT_CALL(*mocks_->audio_renderer(), SetPlaybackRate(0.0f));
182 EXPECT_CALL(*mocks_->audio_renderer(), SetVolume(1.0f)); 182 EXPECT_CALL(*mocks_->audio_renderer(), SetVolume(1.0f));
183 EXPECT_CALL(*mocks_->audio_renderer(), Seek(base::TimeDelta(), _)) 183 EXPECT_CALL(*mocks_->audio_renderer(), Seek(base::TimeDelta(), _))
184 .WillOnce(Invoke(&RunFilterStatusCB)); 184 .WillOnce(Invoke(&RunFilterStatusCB));
185 EXPECT_CALL(*mocks_->audio_renderer(), Stop(_)) 185 EXPECT_CALL(*mocks_->audio_renderer(), Stop(_))
186 .WillOnce(Invoke(&RunStopFilterCallback)); 186 .WillOnce(Invoke(&RunStopFilterCallback));
187 } 187 }
188 188
189 // Sets up expectations on the callback and initializes the pipeline. Called 189 // Sets up expectations on the callback and initializes the pipeline. Called
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 TestPipelineStatusNotification(0); 919 TestPipelineStatusNotification(0);
920 } 920 }
921 921
922 // Test that different-thread, some-delay callback (the expected common case) 922 // Test that different-thread, some-delay callback (the expected common case)
923 // works correctly. 923 // works correctly.
924 TEST(PipelineStatusNotificationTest, DelayedCallback) { 924 TEST(PipelineStatusNotificationTest, DelayedCallback) {
925 TestPipelineStatusNotification(20); 925 TestPipelineStatusNotification(20);
926 } 926 }
927 927
928 } // namespace media 928 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698