| OLD | NEW |
| 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 "content/browser/renderer_host/media/audio_renderer_host.h" | 5 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 base::SharedMemoryHandle handle, | 206 base::SharedMemoryHandle handle, |
| 207 base::SyncSocket::TransitDescriptor socket_descriptor, | 207 base::SyncSocket::TransitDescriptor socket_descriptor, |
| 208 uint32_t length) { | 208 uint32_t length) { |
| 209 // Maps the shared memory. | 209 // Maps the shared memory. |
| 210 shared_memory_.reset(new base::SharedMemory(handle, false)); | 210 shared_memory_.reset(new base::SharedMemory(handle, false)); |
| 211 CHECK(shared_memory_->Map(length)); | 211 CHECK(shared_memory_->Map(length)); |
| 212 CHECK(shared_memory_->memory()); | 212 CHECK(shared_memory_->memory()); |
| 213 shared_memory_length_ = length; | 213 shared_memory_length_ = length; |
| 214 | 214 |
| 215 // Create the SyncSocket using the handle. | 215 // Create the SyncSocket using the handle. |
| 216 base::SyncSocket::Handle sync_socket_handle = | 216 // base::SyncSocket::Handle sync_socket_handle = |
| 217 base::SyncSocket::UnwrapHandle(socket_descriptor); | 217 base::SyncSocket::UnwrapHandle(socket_descriptor); |
| 218 sync_socket_.reset(new base::SyncSocket(sync_socket_handle)); | 218 // sync_socket_.reset(new base::SyncSocket(sync_socket_handle)); |
| 219 | 219 |
| 220 // And then delegate the call to the mock method. | 220 // And then delegate the call to the mock method. |
| 221 WasNotifiedOfCreation(stream_id, length); | 221 WasNotifiedOfCreation(stream_id, length); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void OnNotifyStreamError(int stream_id) { WasNotifiedOfError(stream_id); } | 224 void OnNotifyStreamError(int stream_id) { WasNotifiedOfError(stream_id); } |
| 225 | 225 |
| 226 std::unique_ptr<base::SharedMemory> shared_memory_; | 226 std::unique_ptr<base::SharedMemory> shared_memory_; |
| 227 std::unique_ptr<base::SyncSocket> sync_socket_; | 227 // std::unique_ptr<base::SyncSocket> sync_socket_; |
| 228 uint32_t shared_memory_length_; | 228 uint32_t shared_memory_length_; |
| 229 base::RunLoop* auth_run_loop_; // Used to wait for authorization. | 229 base::RunLoop* auth_run_loop_; // Used to wait for authorization. |
| 230 | 230 |
| 231 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererHost); | 231 DISALLOW_COPY_AND_ASSIGN(MockAudioRendererHost); |
| 232 }; | 232 }; |
| 233 | 233 |
| 234 class AudioRendererHostTest : public testing::Test { | 234 class AudioRendererHostTest : public testing::Test { |
| 235 public: | 235 public: |
| 236 AudioRendererHostTest() | 236 AudioRendererHostTest() |
| 237 : log_factory(base::MakeUnique<media::FakeAudioLogFactory>()), | 237 : log_factory(base::MakeUnique<media::FakeAudioLogFactory>()), |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 } | 623 } |
| 624 | 624 |
| 625 TEST_F(AudioRendererHostTest, CreateFailsForInvalidRenderFrame) { | 625 TEST_F(AudioRendererHostTest, CreateFailsForInvalidRenderFrame) { |
| 626 CreateWithInvalidRenderFrameId(); | 626 CreateWithInvalidRenderFrameId(); |
| 627 Close(); | 627 Close(); |
| 628 } | 628 } |
| 629 | 629 |
| 630 // TODO(hclam): Add tests for data conversation in low latency mode. | 630 // TODO(hclam): Add tests for data conversation in low latency mode. |
| 631 | 631 |
| 632 } // namespace content | 632 } // namespace content |
| OLD | NEW |