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

Side by Side Diff: media/audio/alsa/alsa_output_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 | « content/common/view_messages.h ('k') | media/audio/android/audio_android_unittest.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/strings/stringprintf.h" 5 #include "base/strings/stringprintf.h"
6 #include "media/audio/alsa/alsa_output.h" 6 #include "media/audio/alsa/alsa_output.h"
7 #include "media/audio/alsa/alsa_wrapper.h" 7 #include "media/audio/alsa/alsa_wrapper.h"
8 #include "media/audio/alsa/audio_manager_alsa.h" 8 #include "media/audio/alsa/audio_manager_alsa.h"
9 #include "media/audio/fake_audio_log_factory.h" 9 #include "media/audio/fake_audio_log_factory.h"
10 #include "media/audio/mock_audio_source_callback.h" 10 #include "media/audio/mock_audio_source_callback.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 // Bad bits per sample. 228 // Bad bits per sample.
229 AudioParameters bad_bps_params(kTestFormat, kTestChannelLayout, 229 AudioParameters bad_bps_params(kTestFormat, kTestChannelLayout,
230 kTestSampleRate, kTestBitsPerSample - 1, 230 kTestSampleRate, kTestBitsPerSample - 1,
231 kTestFramesPerPacket); 231 kTestFramesPerPacket);
232 test_stream = new AlsaPcmOutputStream(kTestDeviceName, 232 test_stream = new AlsaPcmOutputStream(kTestDeviceName,
233 bad_bps_params, 233 bad_bps_params,
234 &mock_alsa_wrapper_, 234 &mock_alsa_wrapper_,
235 mock_manager_.get()); 235 mock_manager_.get());
236 EXPECT_EQ(AlsaPcmOutputStream::kInError, test_stream->state()); 236 EXPECT_EQ(AlsaPcmOutputStream::kInError, test_stream->state());
237 test_stream->Close(); 237 test_stream->Close();
238
239 // Bad format.
240 AudioParameters bad_format_params(
241 AudioParameters::AUDIO_LAST_FORMAT, kTestChannelLayout, kTestSampleRate,
242 kTestBitsPerSample, kTestFramesPerPacket);
243 test_stream = new AlsaPcmOutputStream(kTestDeviceName,
244 bad_format_params,
245 &mock_alsa_wrapper_,
246 mock_manager_.get());
247 EXPECT_EQ(AlsaPcmOutputStream::kInError, test_stream->state());
248 test_stream->Close();
249 } 238 }
250 239
251 TEST_F(AlsaPcmOutputStreamTest, LatencyFloor) { 240 TEST_F(AlsaPcmOutputStreamTest, LatencyFloor) {
252 const double kMicrosPerFrame = 241 const double kMicrosPerFrame =
253 static_cast<double>(1000000) / kTestSampleRate; 242 static_cast<double>(1000000) / kTestSampleRate;
254 const double kPacketFramesInMinLatency = 243 const double kPacketFramesInMinLatency =
255 AlsaPcmOutputStream::kMinLatencyMicros / kMicrosPerFrame / 2.0; 244 AlsaPcmOutputStream::kMinLatencyMicros / kMicrosPerFrame / 2.0;
256 245
257 // Test that packets which would cause a latency under less than 246 // Test that packets which would cause a latency under less than
258 // AlsaPcmOutputStream::kMinLatencyMicros will get clipped to 247 // AlsaPcmOutputStream::kMinLatencyMicros will get clipped to
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 848
860 // TODO(ajwong): Find a way to test whether or not another task has been 849 // TODO(ajwong): Find a way to test whether or not another task has been
861 // posted so we can verify that the Alsa code will indeed break the task 850 // posted so we can verify that the Alsa code will indeed break the task
862 // posting loop. 851 // posting loop.
863 852
864 test_stream->TransitionTo(AlsaPcmOutputStream::kIsClosed); 853 test_stream->TransitionTo(AlsaPcmOutputStream::kIsClosed);
865 test_stream->Close(); 854 test_stream->Close();
866 } 855 }
867 856
868 } // namespace media 857 } // namespace media
OLDNEW
« no previous file with comments | « content/common/view_messages.h ('k') | media/audio/android/audio_android_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698