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

Side by Side Diff: media/audio/mac/audio_low_latency_input_mac_unittest.cc

Issue 12611030: Remove unused parameter to OnError() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits + rebase Created 7 years, 9 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
« no previous file with comments | « media/audio/mac/audio_low_latency_input_mac.cc ('k') | media/audio/pulse/pulse_input.cc » ('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/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/test/test_timeouts.h" 8 #include "base/test/test_timeouts.h"
9 #include "base/threading/platform_thread.h" 9 #include "base/threading/platform_thread.h"
10 #include "media/audio/audio_io.h" 10 #include "media/audio/audio_io.h"
(...skipping 16 matching lines...) Expand all
27 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 27 loop->PostTask(FROM_HERE, MessageLoop::QuitClosure());
28 } 28 }
29 } 29 }
30 30
31 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback { 31 class MockAudioInputCallback : public AudioInputStream::AudioInputCallback {
32 public: 32 public:
33 MOCK_METHOD5(OnData, void(AudioInputStream* stream, 33 MOCK_METHOD5(OnData, void(AudioInputStream* stream,
34 const uint8* src, uint32 size, 34 const uint8* src, uint32 size,
35 uint32 hardware_delay_bytes, double volume)); 35 uint32 hardware_delay_bytes, double volume));
36 MOCK_METHOD1(OnClose, void(AudioInputStream* stream)); 36 MOCK_METHOD1(OnClose, void(AudioInputStream* stream));
37 MOCK_METHOD2(OnError, void(AudioInputStream* stream, int code)); 37 MOCK_METHOD1(OnError, void(AudioInputStream* stream));
38 }; 38 };
39 39
40 // This audio sink implementation should be used for manual tests only since 40 // This audio sink implementation should be used for manual tests only since
41 // the recorded data is stored on a raw binary data file. 41 // the recorded data is stored on a raw binary data file.
42 // The last test (WriteToFileAudioSink) - which is disabled by default - 42 // The last test (WriteToFileAudioSink) - which is disabled by default -
43 // can use this audio sink to store the captured data on a file for offline 43 // can use this audio sink to store the captured data on a file for offline
44 // analysis. 44 // analysis.
45 class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback { 45 class WriteToFileAudioSink : public AudioInputStream::AudioInputCallback {
46 public: 46 public:
47 // Allocate space for ~10 seconds of data @ 48kHz in stereo: 47 // Allocate space for ~10 seconds of data @ 48kHz in stereo:
(...skipping 30 matching lines...) Expand all
78 uint32 hardware_delay_bytes, double volume) OVERRIDE { 78 uint32 hardware_delay_bytes, double volume) OVERRIDE {
79 // Store data data in a temporary buffer to avoid making blocking 79 // Store data data in a temporary buffer to avoid making blocking
80 // fwrite() calls in the audio callback. The complete buffer will be 80 // fwrite() calls in the audio callback. The complete buffer will be
81 // written to file in the destructor. 81 // written to file in the destructor.
82 if (buffer_.Append(src, size)) { 82 if (buffer_.Append(src, size)) {
83 bytes_to_write_ += size; 83 bytes_to_write_ += size;
84 } 84 }
85 } 85 }
86 86
87 virtual void OnClose(AudioInputStream* stream) OVERRIDE {} 87 virtual void OnClose(AudioInputStream* stream) OVERRIDE {}
88 virtual void OnError(AudioInputStream* stream, int code) OVERRIDE {} 88 virtual void OnError(AudioInputStream* stream) OVERRIDE {}
89 89
90 private: 90 private:
91 media::SeekableBuffer buffer_; 91 media::SeekableBuffer buffer_;
92 FILE* file_; 92 FILE* file_;
93 int bytes_to_write_; 93 int bytes_to_write_;
94 }; 94 };
95 95
96 class MacAudioInputTest : public testing::Test { 96 class MacAudioInputTest : public testing::Test {
97 protected: 97 protected:
98 MacAudioInputTest() : audio_manager_(AudioManager::Create()) {} 98 MacAudioInputTest() : audio_manager_(AudioManager::Create()) {}
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 WriteToFileAudioSink file_sink(file_name); 308 WriteToFileAudioSink file_sink(file_name);
309 fprintf(stderr, " >> Speak into the mic while recording...\n"); 309 fprintf(stderr, " >> Speak into the mic while recording...\n");
310 ais->Start(&file_sink); 310 ais->Start(&file_sink);
311 base::PlatformThread::Sleep(TestTimeouts::action_timeout()); 311 base::PlatformThread::Sleep(TestTimeouts::action_timeout());
312 ais->Stop(); 312 ais->Stop();
313 fprintf(stderr, " >> Recording has stopped.\n"); 313 fprintf(stderr, " >> Recording has stopped.\n");
314 ais->Close(); 314 ais->Close();
315 } 315 }
316 316
317 } // namespace media 317 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/mac/audio_low_latency_input_mac.cc ('k') | media/audio/pulse/pulse_input.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698