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

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

Issue 2043303004: More WaitableEvent stragglers migrated to enum-based constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@d_4_misc
Patch Set: Created 4 years, 6 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 | « components/exo/wayland/server_unittest.cc ('k') | media/audio/cras/cras_unified_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 (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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 unsigned int duration_ms) { 95 unsigned int duration_ms) {
96 CrasInputStream* test_stream = new CrasInputStream( 96 CrasInputStream* test_stream = new CrasInputStream(
97 params, mock_manager_.get(), AudioDeviceDescription::kDefaultDeviceId); 97 params, mock_manager_.get(), AudioDeviceDescription::kDefaultDeviceId);
98 98
99 ASSERT_TRUE(test_stream->Open()); 99 ASSERT_TRUE(test_stream->Open());
100 100
101 // Allow 8 frames variance for SRC in the callback. Different numbers of 101 // Allow 8 frames variance for SRC in the callback. Different numbers of
102 // samples can be provided when doing non-integer SRC. For example 102 // samples can be provided when doing non-integer SRC. For example
103 // converting from 192k to 44.1k is a ratio of 4.35 to 1. 103 // converting from 192k to 44.1k is a ratio of 4.35 to 1.
104 MockAudioInputCallback mock_callback; 104 MockAudioInputCallback mock_callback;
105 base::WaitableEvent event(false, false); 105 base::WaitableEvent event(base::WaitableEvent::ResetPolicy::AUTOMATIC,
106 base::WaitableEvent::InitialState::NOT_SIGNALED);
106 107
107 EXPECT_CALL(mock_callback, OnData(test_stream, _, _, _)) 108 EXPECT_CALL(mock_callback, OnData(test_stream, _, _, _))
108 .WillOnce(InvokeWithoutArgs(&event, &base::WaitableEvent::Signal)); 109 .WillOnce(InvokeWithoutArgs(&event, &base::WaitableEvent::Signal));
109 110
110 test_stream->Start(&mock_callback); 111 test_stream->Start(&mock_callback);
111 112
112 // Wait for samples to be captured. 113 // Wait for samples to be captured.
113 EXPECT_TRUE(event.TimedWait(TestTimeouts::action_timeout())); 114 EXPECT_TRUE(event.TimedWait(TestTimeouts::action_timeout()));
114 115
115 test_stream->Stop(); 116 test_stream->Stop();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 223
223 TEST_F(CrasInputStreamTest, CaptureLoopback) { 224 TEST_F(CrasInputStreamTest, CaptureLoopback) {
224 CrasInputStream* test_stream = 225 CrasInputStream* test_stream =
225 CreateStream(CHANNEL_LAYOUT_STEREO, kTestFramesPerPacket, 226 CreateStream(CHANNEL_LAYOUT_STEREO, kTestFramesPerPacket,
226 AudioDeviceDescription::kLoopbackInputDeviceId); 227 AudioDeviceDescription::kLoopbackInputDeviceId);
227 EXPECT_TRUE(test_stream->Open()); 228 EXPECT_TRUE(test_stream->Open());
228 test_stream->Close(); 229 test_stream->Close();
229 } 230 }
230 231
231 } // namespace media 232 } // namespace media
OLDNEW
« no previous file with comments | « components/exo/wayland/server_unittest.cc ('k') | media/audio/cras/cras_unified_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698