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

Side by Side Diff: media/audio/cras/cras_input_unittest.cc

Issue 1211273005: Use safer IPC serializations in media_param_traits.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up unit tests Created 5 years, 5 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/audio_parameters.cc ('k') | media/base/video_capture_types.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 <string> 5 #include <string>
6 6
7 #include "base/synchronization/waitable_event.h" 7 #include "base/synchronization/waitable_event.h"
8 #include "base/test/test_timeouts.h" 8 #include "base/test/test_timeouts.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "media/audio/cras/audio_manager_cras.h" 10 #include "media/audio/cras/audio_manager_cras.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 kTestChannelLayout, 144 kTestChannelLayout,
145 kTestSampleRate, 145 kTestSampleRate,
146 kTestBitsPerSample - 1, 146 kTestBitsPerSample - 1,
147 kTestFramesPerPacket); 147 kTestFramesPerPacket);
148 CrasInputStream* test_stream = new CrasInputStream( 148 CrasInputStream* test_stream = new CrasInputStream(
149 bad_bps_params, mock_manager_.get(), AudioManagerBase::kDefaultDeviceId); 149 bad_bps_params, mock_manager_.get(), AudioManagerBase::kDefaultDeviceId);
150 EXPECT_FALSE(test_stream->Open()); 150 EXPECT_FALSE(test_stream->Open());
151 test_stream->Close(); 151 test_stream->Close();
152 } 152 }
153 153
154 TEST_F(CrasInputStreamTest, BadFormat) {
155 AudioParameters bad_format_params(AudioParameters::AUDIO_LAST_FORMAT,
156 kTestChannelLayout,
157 kTestSampleRate,
158 kTestBitsPerSample,
159 kTestFramesPerPacket);
160 CrasInputStream* test_stream = new CrasInputStream(
161 bad_format_params, mock_manager_.get(),
162 AudioManagerBase::kDefaultDeviceId);
163 EXPECT_FALSE(test_stream->Open());
164 test_stream->Close();
165 }
166
167 TEST_F(CrasInputStreamTest, BadSampleRate) { 154 TEST_F(CrasInputStreamTest, BadSampleRate) {
168 AudioParameters bad_rate_params(kTestFormat, 155 AudioParameters bad_rate_params(kTestFormat,
169 kTestChannelLayout, 156 kTestChannelLayout,
170 0, 157 0,
171 kTestBitsPerSample, 158 kTestBitsPerSample,
172 kTestFramesPerPacket); 159 kTestFramesPerPacket);
173 CrasInputStream* test_stream = new CrasInputStream( 160 CrasInputStream* test_stream = new CrasInputStream(
174 bad_rate_params, mock_manager_.get(), AudioManagerBase::kDefaultDeviceId); 161 bad_rate_params, mock_manager_.get(), AudioManagerBase::kDefaultDeviceId);
175 EXPECT_FALSE(test_stream->Open()); 162 EXPECT_FALSE(test_stream->Open());
176 test_stream->Close(); 163 test_stream->Close();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 TEST_F(CrasInputStreamTest, CaptureLoopback) { 208 TEST_F(CrasInputStreamTest, CaptureLoopback) {
222 CrasInputStream* test_stream = CreateStream( 209 CrasInputStream* test_stream = CreateStream(
223 CHANNEL_LAYOUT_STEREO, 210 CHANNEL_LAYOUT_STEREO,
224 kTestFramesPerPacket, 211 kTestFramesPerPacket,
225 AudioManagerBase::kLoopbackInputDeviceId); 212 AudioManagerBase::kLoopbackInputDeviceId);
226 EXPECT_TRUE(test_stream->Open()); 213 EXPECT_TRUE(test_stream->Open());
227 test_stream->Close(); 214 test_stream->Close();
228 } 215 }
229 216
230 } // namespace media 217 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_parameters.cc ('k') | media/base/video_capture_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698