Chromium Code Reviews

Side by Side Diff: media/audio/linux/alsa_output_unittest.cc

Issue 2966005: Add recording capability to AudioManager, and implemented on windows using the WaveIn APIs. (Closed)
Patch Set: Patch Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
« no previous file with comments | « media/audio/audio_io.h ('k') | media/audio/linux/audio_manager_linux.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/logging.h" 5 #include "base/logging.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "media/audio/linux/alsa_output.h" 8 #include "media/audio/linux/alsa_output.h"
9 #include "media/audio/linux/alsa_wrapper.h" 9 #include "media/audio/linux/alsa_wrapper.h"
10 #include "media/audio/linux/audio_manager_linux.h" 10 #include "media/audio/linux/audio_manager_linux.h"
(...skipping 53 matching lines...)
64 MOCK_METHOD4(OnMoreData, uint32(AudioOutputStream* stream, void* dest, 64 MOCK_METHOD4(OnMoreData, uint32(AudioOutputStream* stream, void* dest,
65 uint32 max_size, uint32 pending_bytes)); 65 uint32 max_size, uint32 pending_bytes));
66 MOCK_METHOD1(OnClose, void(AudioOutputStream* stream)); 66 MOCK_METHOD1(OnClose, void(AudioOutputStream* stream));
67 MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code)); 67 MOCK_METHOD2(OnError, void(AudioOutputStream* stream, int code));
68 }; 68 };
69 69
70 class MockAudioManagerLinux : public AudioManagerLinux { 70 class MockAudioManagerLinux : public AudioManagerLinux {
71 public: 71 public:
72 MOCK_METHOD0(Init, void()); 72 MOCK_METHOD0(Init, void());
73 MOCK_METHOD0(HasAudioOutputDevices, bool()); 73 MOCK_METHOD0(HasAudioOutputDevices, bool());
74 MOCK_METHOD0(HasAudioInputDevices, bool());
74 MOCK_METHOD4(MakeAudioOutputStream, AudioOutputStream*(Format format, 75 MOCK_METHOD4(MakeAudioOutputStream, AudioOutputStream*(Format format,
75 int channels, 76 int channels,
76 int sample_rate, 77 int sample_rate,
77 char bits_per_sample)); 78 char bits_per_sample));
79 MOCK_METHOD5(MakeAudioInputStream, AudioInputStream*(
80 Format format,
81 int channels,
82 int sample_rate,
83 char bits_per_sample,
84 uint32 samples_per_packet));
78 MOCK_METHOD0(MuteAll, void()); 85 MOCK_METHOD0(MuteAll, void());
79 MOCK_METHOD0(UnMuteAll, void()); 86 MOCK_METHOD0(UnMuteAll, void());
80 87
81 MOCK_METHOD1(ReleaseOutputStream, void(AlsaPcmOutputStream* stream)); 88 MOCK_METHOD1(ReleaseOutputStream, void(AlsaPcmOutputStream* stream));
82 }; 89 };
83 90
84 class AlsaPcmOutputStreamTest : public testing::Test { 91 class AlsaPcmOutputStreamTest : public testing::Test {
85 protected: 92 protected:
86 AlsaPcmOutputStreamTest() { 93 AlsaPcmOutputStreamTest() {
87 test_stream_ = CreateStreamWithChannels(kTestChannels); 94 test_stream_ = CreateStreamWithChannels(kTestChannels);
(...skipping 687 matching lines...)
775 782
776 test_stream_->stop_stream_ = true; 783 test_stream_->stop_stream_ = true;
777 test_stream_->ScheduleNextWrite(true); 784 test_stream_->ScheduleNextWrite(true);
778 785
779 // TODO(ajwong): Find a way to test whether or not another task has been 786 // TODO(ajwong): Find a way to test whether or not another task has been
780 // posted so we can verify that the Alsa code will indeed break the task 787 // posted so we can verify that the Alsa code will indeed break the task
781 // posting loop. 788 // posting loop.
782 789
783 test_stream_->shared_data_.TransitionTo(AlsaPcmOutputStream::kIsClosed); 790 test_stream_->shared_data_.TransitionTo(AlsaPcmOutputStream::kIsClosed);
784 } 791 }
OLDNEW
« no previous file with comments | « media/audio/audio_io.h ('k') | media/audio/linux/audio_manager_linux.h » ('j') | no next file with comments »

Powered by Google App Engine