OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "content/browser/renderer_host/media/render_frame_audio_output_stream_f
actory.h" | 5 #include "content/browser/renderer_host/media/render_frame_audio_output_stream_f
actory.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 | 232 |
233 provider->Acquire( | 233 provider->Acquire( |
234 mojo::MakeRequest<AudioOutputStream>(&output_stream), params, | 234 mojo::MakeRequest<AudioOutputStream>(&output_stream), params, |
235 base::Bind(&MockClient::StreamCreated, base::Unretained(&client))); | 235 base::Bind(&MockClient::StreamCreated, base::Unretained(&client))); |
236 base::RunLoop().RunUntilIdle(); | 236 base::RunLoop().RunUntilIdle(); |
237 ASSERT_NE(event_handler, nullptr); | 237 ASSERT_NE(event_handler, nullptr); |
238 | 238 |
239 base::SharedMemory shared_memory; | 239 base::SharedMemory shared_memory; |
240 ASSERT_TRUE(shared_memory.CreateAndMapAnonymous(100)); | 240 ASSERT_TRUE(shared_memory.CreateAndMapAnonymous(100)); |
241 | 241 |
242 base::CancelableSyncSocket local, remote; | 242 auto local = base::MakeUnique<base::CancelableSyncSocket>(); |
243 ASSERT_TRUE(base::CancelableSyncSocket::CreatePair(&local, &remote)); | 243 auto remote = base::MakeUnique<base::CancelableSyncSocket>(); |
244 event_handler->OnStreamCreated(kStreamId, &shared_memory, &remote); | 244 ASSERT_TRUE( |
| 245 base::CancelableSyncSocket::CreatePair(local.get(), remote.get())); |
| 246 event_handler->OnStreamCreated(kStreamId, &shared_memory, std::move(remote)); |
245 | 247 |
246 base::RunLoop().RunUntilIdle(); | 248 base::RunLoop().RunUntilIdle(); |
247 // Make sure we got the callback from creating stream. | 249 // Make sure we got the callback from creating stream. |
248 EXPECT_TRUE(client.was_called()); | 250 EXPECT_TRUE(client.was_called()); |
249 } | 251 } |
250 | 252 |
251 TEST(RenderFrameAudioOutputStreamFactoryTest, NotAuthorized_Denied) { | 253 TEST(RenderFrameAudioOutputStreamFactoryTest, NotAuthorized_Denied) { |
252 content::TestBrowserThreadBundle thread_bundle; | 254 content::TestBrowserThreadBundle thread_bundle; |
253 AudioOutputStreamProviderPtr output_provider; | 255 AudioOutputStreamProviderPtr output_provider; |
254 auto factory_context = base::MakeUnique<MockContext>(false); | 256 auto factory_context = base::MakeUnique<MockContext>(false); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 EXPECT_FALSE(got_bad_message); | 364 EXPECT_FALSE(got_bad_message); |
363 factory_ptr->RequestDeviceAuthorization( | 365 factory_ptr->RequestDeviceAuthorization( |
364 mojo::MakeRequest(&output_provider), session_id, "default", | 366 mojo::MakeRequest(&output_provider), session_id, "default", |
365 base::Bind([](media::OutputDeviceStatus, const media::AudioParameters&, | 367 base::Bind([](media::OutputDeviceStatus, const media::AudioParameters&, |
366 const std::string&) {})); | 368 const std::string&) {})); |
367 base::RunLoop().RunUntilIdle(); | 369 base::RunLoop().RunUntilIdle(); |
368 EXPECT_TRUE(got_bad_message); | 370 EXPECT_TRUE(got_bad_message); |
369 } | 371 } |
370 | 372 |
371 } // namespace content | 373 } // namespace content |
OLD | NEW |