X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmedia%2Faudio%2Faudio_output_device_unittest.cc;h=363ee3894070eb0c025520c3fa6b05091c273bb3;hb=3545e9f2671f595d2a2f3ee75ca0393b01e35ef6;hp=92d94250b4aa14e09b20424993433bdb0b3618e6;hpb=7d210d4c7e9ba36e635eabc5b5780495f8a63292;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/media/audio/audio_output_device_unittest.cc b/src/media/audio/audio_output_device_unittest.cc index 92d9425..363ee38 100644 --- a/src/media/audio/audio_output_device_unittest.cc +++ b/src/media/audio/audio_output_device_unittest.cc @@ -54,25 +54,6 @@ class MockAudioOutputIPC : public AudioOutputIPC { MOCK_METHOD1(SetVolume, void(double volume)); }; -// Creates a copy of a SyncSocket handle that we can give to AudioOutputDevice. -// On Windows this means duplicating the pipe handle so that AudioOutputDevice -// can call CloseHandle() (since ownership has been transferred), but on other -// platforms, we just copy the same socket handle since AudioOutputDevice on -// those platforms won't actually own the socket (FileDescriptor.auto_close is -// false). -bool DuplicateSocketHandle(SyncSocket::Handle socket_handle, - SyncSocket::Handle* copy) { -#if defined(OS_WIN) - HANDLE process = GetCurrentProcess(); - ::DuplicateHandle(process, socket_handle, process, copy, - 0, FALSE, DUPLICATE_SAME_ACCESS); - return *copy != NULL; -#else - *copy = socket_handle; - return *copy != -1; -#endif -} - ACTION_P2(SendPendingBytes, socket, pending_bytes) { socket->Send(&pending_bytes, sizeof(pending_bytes)); } @@ -120,13 +101,13 @@ class AudioOutputDeviceTest int AudioOutputDeviceTest::CalculateMemorySize() { // Calculate output memory size. - return AudioBus::CalculateMemorySize(default_audio_parameters_); + return AudioBus::CalculateMemorySize(default_audio_parameters_); } AudioOutputDeviceTest::AudioOutputDeviceTest() { default_audio_parameters_.Reset( AudioParameters::AUDIO_PCM_LINEAR, - CHANNEL_LAYOUT_STEREO, 2, 0, 48000, 16, 1024); + CHANNEL_LAYOUT_STEREO, 2, 48000, 16, 1024); audio_output_ipc_ = new MockAudioOutputIPC(); audio_device_ = new AudioOutputDevice( @@ -163,15 +144,16 @@ void AudioOutputDeviceTest::CreateStream() { // Create duplicates of the handles we pass to AudioOutputDevice since // ownership will be transferred and AudioOutputDevice is responsible for // freeing. - SyncSocket::Handle audio_device_socket = SyncSocket::kInvalidHandle; - ASSERT_TRUE(DuplicateSocketHandle(renderer_socket_.handle(), - &audio_device_socket)); + SyncSocket::TransitDescriptor audio_device_socket_descriptor; + ASSERT_TRUE(renderer_socket_.PrepareTransitDescriptor( + base::GetCurrentProcessHandle(), &audio_device_socket_descriptor)); base::SharedMemoryHandle duplicated_memory_handle; ASSERT_TRUE(shared_memory_.ShareToProcess(base::GetCurrentProcessHandle(), &duplicated_memory_handle)); - audio_device_->OnStreamCreated(duplicated_memory_handle, audio_device_socket, - kMemorySize); + audio_device_->OnStreamCreated( + duplicated_memory_handle, + SyncSocket::UnwrapHandle(audio_device_socket_descriptor), kMemorySize); io_loop_.RunUntilIdle(); }