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

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: fix mac tests 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') | no next file with comments »
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/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/process_util.h" 8 #include "base/process_util.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 TEST_F(AudioRendererImplTest, SetVolume) { 161 TEST_F(AudioRendererImplTest, SetVolume) {
162 // Execute SetVolume() codepath. 162 // Execute SetVolume() codepath.
163 // This method will be called on the pipeline thread IRL. 163 // This method will be called on the pipeline thread IRL.
164 // Tasks will be posted internally on the IO thread. 164 // Tasks will be posted internally on the IO thread.
165 renderer_->SetVolume(0.5f); 165 renderer_->SetVolume(0.5f);
166 166
167 renderer_->Stop(media::NewExpectedClosure()); 167 renderer_->Stop(media::NewExpectedClosure());
168 WaitForIOThreadCompletion(); 168 WaitForIOThreadCompletion();
169 } 169 }
170 170
171 TEST_F(AudioRendererImplTest, Stop) {
172 // Execute Stop() codepath.
173 // Tasks will be posted internally on the IO thread.
174 renderer_->Stop(media::NewExpectedClosure());
175
176 WaitForIOThreadCompletion();
177
178 // It's possible that the upstream decoder replies right after being stopped.
179 scoped_refptr<media::Buffer> buffer(new media::DataBuffer(kSize));
180 renderer_->ConsumeAudioSamples(buffer);
181 }
182
183 TEST_F(AudioRendererImplTest, UpdateEarliestEndTime) { 171 TEST_F(AudioRendererImplTest, UpdateEarliestEndTime) {
184 renderer_->SetPlaybackRate(1.0f); 172 renderer_->SetPlaybackRate(1.0f);
185 WaitForIOThreadCompletion(); 173 WaitForIOThreadCompletion();
186 base::Time time_now = base::Time(); // Null time by default. 174 base::Time time_now = base::Time(); // Null time by default.
187 renderer_->set_earliest_end_time(time_now); 175 renderer_->set_earliest_end_time(time_now);
188 renderer_->UpdateEarliestEndTime(renderer_->bytes_per_second(), 176 renderer_->UpdateEarliestEndTime(renderer_->bytes_per_second(),
189 base::TimeDelta::FromMilliseconds(100), 177 base::TimeDelta::FromMilliseconds(100),
190 time_now); 178 time_now);
191 int time_delta = (renderer_->earliest_end_time() - time_now).InMilliseconds(); 179 int time_delta = (renderer_->earliest_end_time() - time_now).InMilliseconds();
192 EXPECT_EQ(1100, time_delta); 180 EXPECT_EQ(1100, time_delta);
193 renderer_->Stop(media::NewExpectedClosure()); 181 renderer_->Stop(media::NewExpectedClosure());
194 WaitForIOThreadCompletion(); 182 WaitForIOThreadCompletion();
195 } 183 }
OLDNEW
« no previous file with comments | « no previous file | media/base/filters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698