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

Side by Side Diff: trunk/src/media/audio/audio_input_unittest.cc

Issue 335343004: Revert 277794 "Modifies AudioInputCallback::OnData and use media..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 6 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
« no previous file with comments | « trunk/src/media/audio/audio_input_device.cc ('k') | trunk/src/media/audio/audio_io.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/environment.h" 6 #include "base/environment.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
11 #include "base/threading/platform_thread.h" 11 #include "base/threading/platform_thread.h"
12 #include "media/audio/audio_io.h" 12 #include "media/audio/audio_io.h"
13 #include "media/audio/audio_manager_base.h" 13 #include "media/audio/audio_manager_base.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 namespace media { 16 namespace media {
17 17
18 // This class allows to find out if the callbacks are occurring as 18 // This class allows to find out if the callbacks are occurring as
19 // expected and if any error has been reported. 19 // expected and if any error has been reported.
20 class TestInputCallback : public AudioInputStream::AudioInputCallback { 20 class TestInputCallback : public AudioInputStream::AudioInputCallback {
21 public: 21 public:
22 explicit TestInputCallback() 22 explicit TestInputCallback()
23 : callback_count_(0), 23 : callback_count_(0),
24 had_error_(0) { 24 had_error_(0) {
25 } 25 }
26 virtual void OnData(AudioInputStream* stream, 26 virtual void OnData(AudioInputStream* stream,
27 const AudioBus* source, 27 const uint8* data,
28 uint32 size,
28 uint32 hardware_delay_bytes, 29 uint32 hardware_delay_bytes,
29 double volume) OVERRIDE { 30 double volume) OVERRIDE {
30 ++callback_count_; 31 ++callback_count_;
31 } 32 }
32 virtual void OnError(AudioInputStream* stream) OVERRIDE { 33 virtual void OnError(AudioInputStream* stream) OVERRIDE {
33 ++had_error_; 34 ++had_error_;
34 } 35 }
35 // Returns how many times OnData() has been called. 36 // Returns how many times OnData() has been called.
36 int callback_count() const { 37 int callback_count() const {
37 return callback_count_; 38 return callback_count_;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 base::MessageLoop::QuitClosure(), 235 base::MessageLoop::QuitClosure(),
235 base::TimeDelta::FromMilliseconds(500)); 236 base::TimeDelta::FromMilliseconds(500));
236 message_loop_.Run(); 237 message_loop_.Run();
237 EXPECT_GE(test_callback.callback_count(), 2); 238 EXPECT_GE(test_callback.callback_count(), 2);
238 EXPECT_FALSE(test_callback.had_error()); 239 EXPECT_FALSE(test_callback.had_error());
239 240
240 StopAndCloseAudioInputStreamOnAudioThread(); 241 StopAndCloseAudioInputStreamOnAudioThread();
241 } 242 }
242 243
243 } // namespace media 244 } // namespace media
OLDNEW
« no previous file with comments | « trunk/src/media/audio/audio_input_device.cc ('k') | trunk/src/media/audio/audio_io.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698