| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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. |
| OLD | NEW |