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

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

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 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
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"
6 #include "base/bind.h" 5 #include "base/bind.h"
7 #include "base/environment.h" 6 #include "base/environment.h"
8 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 9 #include "base/run_loop.h"
11 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
12 #include "base/threading/platform_thread.h" 11 #include "base/threading/platform_thread.h"
13 #include "media/audio/audio_io.h" 12 #include "media/audio/audio_io.h"
14 #include "media/audio/audio_manager_base.h" 13 #include "media/audio/audio_manager_base.h"
15 #include "media/audio/audio_unittest_util.h" 14 #include "media/audio/audio_unittest_util.h"
16 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
17 16
18 namespace media { 17 namespace media {
19 18
20 // This class allows to find out if the callbacks are occurring as 19 // This class allows to find out if the callbacks are occurring as
21 // expected and if any error has been reported. 20 // expected and if any error has been reported.
22 class TestInputCallback : public AudioInputStream::AudioInputCallback { 21 class TestInputCallback : public AudioInputStream::AudioInputCallback {
23 public: 22 public:
24 explicit TestInputCallback() 23 explicit TestInputCallback()
25 : callback_count_(0), 24 : callback_count_(0),
26 had_error_(0) { 25 had_error_(0) {
27 } 26 }
28 void OnData(AudioInputStream* stream, 27 void OnData(AudioInputStream* stream,
29 const AudioBus* source, 28 const AudioBus* source,
30 uint32 hardware_delay_bytes, 29 uint32_t hardware_delay_bytes,
31 double volume) override { 30 double volume) override {
32 ++callback_count_; 31 ++callback_count_;
33 } 32 }
34 void OnError(AudioInputStream* stream) override { ++had_error_; } 33 void OnError(AudioInputStream* stream) override { ++had_error_; }
35 // Returns how many times OnData() has been called. 34 // Returns how many times OnData() has been called.
36 int callback_count() const { 35 int callback_count() const {
37 return callback_count_; 36 return callback_count_;
38 } 37 }
39 // Returns how many times the OnError callback was called. 38 // Returns how many times the OnError callback was called.
40 int had_error() const { 39 int had_error() const {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 base::MessageLoop::QuitWhenIdleClosure(), 222 base::MessageLoop::QuitWhenIdleClosure(),
224 base::TimeDelta::FromMilliseconds(500)); 223 base::TimeDelta::FromMilliseconds(500));
225 message_loop_.Run(); 224 message_loop_.Run();
226 EXPECT_GE(test_callback.callback_count(), 2); 225 EXPECT_GE(test_callback.callback_count(), 2);
227 EXPECT_FALSE(test_callback.had_error()); 226 EXPECT_FALSE(test_callback.had_error());
228 227
229 StopAndCloseAudioInputStreamOnAudioThread(); 228 StopAndCloseAudioInputStreamOnAudioThread();
230 } 229 }
231 230
232 } // namespace media 231 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_input_ipc.h ('k') | media/audio/audio_io.h » ('j') | media/cdm/stub/stub_cdm.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698