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

Side by Side Diff: content/renderer/media/audio_renderer_impl_unittest.cc

Issue 8763010: Replace AudioDecoder::ProduceAudioSamples/ConsumeAudioSamples with read callbacks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 9 years 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
« no previous file with comments | « no previous file | media/base/filters.h » ('j') | media/filters/audio_renderer_base.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/process_util.h" 7 #include "base/process_util.h"
8 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "base/test/test_timeouts.h" 9 #include "base/test/test_timeouts.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 TEST_F(AudioRendererImplTest, SetVolume) { 170 TEST_F(AudioRendererImplTest, SetVolume) {
171 // Execute SetVolume() codepath. 171 // Execute SetVolume() codepath.
172 // This method will be called on the pipeline thread IRL. 172 // This method will be called on the pipeline thread IRL.
173 // Tasks will be posted internally on the IO thread. 173 // Tasks will be posted internally on the IO thread.
174 renderer_->SetVolume(0.5f); 174 renderer_->SetVolume(0.5f);
175 175
176 renderer_->Stop(media::NewExpectedClosure()); 176 renderer_->Stop(media::NewExpectedClosure());
177 WaitForIOThreadCompletion(); 177 WaitForIOThreadCompletion();
178 } 178 }
179 179
180 TEST_F(AudioRendererImplTest, Stop) {
181 // Execute Stop() codepath.
182 // Tasks will be posted internally on the IO thread.
183 renderer_->Stop(media::NewExpectedClosure());
184
185 WaitForIOThreadCompletion();
186
187 // It's possible that the upstream decoder replies right after being stopped.
188 scoped_refptr<media::Buffer> buffer(new media::DataBuffer(kSize));
189 renderer_->ConsumeAudioSamples(buffer);
scherkus (not reviewing) 2011/12/19 19:30:13 this should never happen if there wasn't a pending
190 }
191
192 TEST_F(AudioRendererImplTest, UpdateEarliestEndTime) { 180 TEST_F(AudioRendererImplTest, UpdateEarliestEndTime) {
193 renderer_->SetPlaybackRate(1.0f); 181 renderer_->SetPlaybackRate(1.0f);
194 WaitForIOThreadCompletion(); 182 WaitForIOThreadCompletion();
195 base::Time time_now = base::Time(); // Null time by default. 183 base::Time time_now = base::Time(); // Null time by default.
196 renderer_->set_earliest_end_time(time_now); 184 renderer_->set_earliest_end_time(time_now);
197 renderer_->UpdateEarliestEndTime(renderer_->bytes_per_second(), 185 renderer_->UpdateEarliestEndTime(renderer_->bytes_per_second(),
198 base::TimeDelta::FromMilliseconds(100), 186 base::TimeDelta::FromMilliseconds(100),
199 time_now); 187 time_now);
200 int time_delta = (renderer_->earliest_end_time() - time_now).InMilliseconds(); 188 int time_delta = (renderer_->earliest_end_time() - time_now).InMilliseconds();
201 EXPECT_EQ(1100, time_delta); 189 EXPECT_EQ(1100, time_delta);
202 renderer_->Stop(media::NewExpectedClosure()); 190 renderer_->Stop(media::NewExpectedClosure());
203 WaitForIOThreadCompletion(); 191 WaitForIOThreadCompletion();
204 } 192 }
OLDNEW
« no previous file with comments | « no previous file | media/base/filters.h » ('j') | media/filters/audio_renderer_base.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698