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

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

Issue 2852803002: Remove base::SharedMemory::ShareToProcess. (Closed)
Patch Set: Compile error. Created 3 years, 7 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
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 <vector> 7 #include <vector>
8 8
9 #include "base/at_exit.h" 9 #include "base/at_exit.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 ASSERT_TRUE(CancelableSyncSocket::CreatePair(&browser_socket_, 221 ASSERT_TRUE(CancelableSyncSocket::CreatePair(&browser_socket_,
222 &renderer_socket_)); 222 &renderer_socket_));
223 223
224 // Create duplicates of the handles we pass to AudioOutputDevice since 224 // Create duplicates of the handles we pass to AudioOutputDevice since
225 // ownership will be transferred and AudioOutputDevice is responsible for 225 // ownership will be transferred and AudioOutputDevice is responsible for
226 // freeing. 226 // freeing.
227 SyncSocket::TransitDescriptor audio_device_socket_descriptor; 227 SyncSocket::TransitDescriptor audio_device_socket_descriptor;
228 ASSERT_TRUE(renderer_socket_.PrepareTransitDescriptor( 228 ASSERT_TRUE(renderer_socket_.PrepareTransitDescriptor(
229 base::GetCurrentProcessHandle(), &audio_device_socket_descriptor)); 229 base::GetCurrentProcessHandle(), &audio_device_socket_descriptor));
230 base::SharedMemoryHandle duplicated_memory_handle; 230 base::SharedMemoryHandle duplicated_memory_handle =
231 ASSERT_TRUE(shared_memory_.ShareToProcess(base::GetCurrentProcessHandle(), 231 shared_memory_.handle().Duplicate();
232 &duplicated_memory_handle)); 232 ASSERT_TRUE(duplicated_memory_handle.IsValid());
233 233
234 // TODO(erikchen): This appears to leak the SharedMemoryHandle.
235 // https://crbug.com/640840.
234 audio_device_->OnStreamCreated( 236 audio_device_->OnStreamCreated(
235 duplicated_memory_handle, 237 duplicated_memory_handle,
236 SyncSocket::UnwrapHandle(audio_device_socket_descriptor), kMemorySize); 238 SyncSocket::UnwrapHandle(audio_device_socket_descriptor), kMemorySize);
237 base::RunLoop().RunUntilIdle(); 239 base::RunLoop().RunUntilIdle();
238 } 240 }
239 241
240 void AudioOutputDeviceTest::ExpectRenderCallback() { 242 void AudioOutputDeviceTest::ExpectRenderCallback() {
241 // We should get a 'play' notification when we call OnStreamCreated(). 243 // We should get a 'play' notification when we call OnStreamCreated().
242 // Respond by asking for some audio data. This should ask our callback 244 // Respond by asking for some audio data. This should ask our callback
243 // to provide some audio data that AudioOutputDevice then writes into the 245 // to provide some audio data that AudioOutputDevice then writes into the
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // Runs the loop and waits for |thread| to call event's closure. 380 // Runs the loop and waits for |thread| to call event's closure.
379 event.RunAndWait(); 381 event.RunAndWait();
380 382
381 audio_device_->Stop(); 383 audio_device_->Stop();
382 base::RunLoop().RunUntilIdle(); 384 base::RunLoop().RunUntilIdle();
383 } 385 }
384 386
385 INSTANTIATE_TEST_CASE_P(Render, AudioOutputDeviceTest, Values(false)); 387 INSTANTIATE_TEST_CASE_P(Render, AudioOutputDeviceTest, Values(false));
386 388
387 } // namespace media. 389 } // namespace media.
OLDNEW
« no previous file with comments | « media/audio/audio_input_device_unittest.cc ('k') | media/gpu/video_decode_accelerator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698