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

Side by Side Diff: media/audio/audio_input_device_unittest.cc

Issue 2941773002: Added initial muted state to stream creation callback, to avoid races. (Closed)
Patch Set: Added mute information to DoCompleteCreation log message. Created 3 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 | « media/audio/audio_input_device.cc ('k') | media/audio/audio_input_ipc.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) 2017 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2017 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/memory/ptr_util.h" 5 #include "base/memory/ptr_util.h"
6 #include "base/memory/shared_memory.h" 6 #include "base/memory/shared_memory.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/process/process_handle.h" 8 #include "base/process/process_handle.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 .WillOnce(ReportStateChange(device.get())); 93 .WillOnce(ReportStateChange(device.get()));
94 EXPECT_CALL(callback, OnCaptureError(_)) 94 EXPECT_CALL(callback, OnCaptureError(_))
95 .WillOnce(QuitLoop(io_loop.task_runner())); 95 .WillOnce(QuitLoop(io_loop.task_runner()));
96 base::RunLoop().Run(); 96 base::RunLoop().Run();
97 device->Stop(); 97 device->Stop();
98 base::RunLoop().RunUntilIdle(); 98 base::RunLoop().RunUntilIdle();
99 } 99 }
100 100
101 ACTION_P5(ReportOnStreamCreated, device, handle, socket, length, segments) { 101 ACTION_P5(ReportOnStreamCreated, device, handle, socket, length, segments) {
102 static_cast<AudioInputIPCDelegate*>(device)->OnStreamCreated( 102 static_cast<AudioInputIPCDelegate*>(device)->OnStreamCreated(
103 handle, socket, length, segments); 103 handle, socket, length, segments, false);
104 } 104 }
105 105
106 TEST(AudioInputDeviceTest, CreateStream) { 106 TEST(AudioInputDeviceTest, CreateStream) {
107 AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY, 107 AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
108 CHANNEL_LAYOUT_STEREO, 48000, 16, 480); 108 CHANNEL_LAYOUT_STEREO, 48000, 16, 480);
109 SharedMemory shared_memory; 109 SharedMemory shared_memory;
110 CancelableSyncSocket browser_socket; 110 CancelableSyncSocket browser_socket;
111 CancelableSyncSocket renderer_socket; 111 CancelableSyncSocket renderer_socket;
112 112
113 const int memory_size = sizeof(AudioInputBufferParameters) + 113 const int memory_size = sizeof(AudioInputBufferParameters) +
(...skipping 27 matching lines...) Expand all
141 EXPECT_CALL(*input_ipc, RecordStream()); 141 EXPECT_CALL(*input_ipc, RecordStream());
142 EXPECT_CALL(callback, OnCaptureStarted()) 142 EXPECT_CALL(callback, OnCaptureStarted())
143 .WillOnce(QuitLoop(io_loop.task_runner())); 143 .WillOnce(QuitLoop(io_loop.task_runner()));
144 base::RunLoop().Run(); 144 base::RunLoop().Run();
145 device->Stop(); 145 device->Stop();
146 base::RunLoop().RunUntilIdle(); 146 base::RunLoop().RunUntilIdle();
147 duplicated_memory_handle.Close(); 147 duplicated_memory_handle.Close();
148 } 148 }
149 149
150 } // namespace media. 150 } // namespace media.
OLDNEW
« no previous file with comments | « media/audio/audio_input_device.cc ('k') | media/audio/audio_input_ipc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698