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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" |
8 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 11 #include "base/single_thread_task_runner.h" |
11 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
12 #include "content/browser/browser_thread_impl.h" | 13 #include "content/browser/browser_thread_impl.h" |
13 #include "content/browser/renderer_host/media/audio_input_device_manager.h" | 14 #include "content/browser/renderer_host/media/audio_input_device_manager.h" |
14 #include "content/public/common/media_stream_request.h" | 15 #include "content/public/common/media_stream_request.h" |
15 #include "media/audio/audio_manager_base.h" | 16 #include "media/audio/audio_manager_base.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 using testing::_; | 20 using testing::_; |
20 using testing::InSequence; | 21 using testing::InSequence; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // Wait for audio thread initialization to complete. Otherwise the | 65 // Wait for audio thread initialization to complete. Otherwise the |
65 // enumeration type may not have been set yet. | 66 // enumeration type may not have been set yet. |
66 base::WaitableEvent event(false, false); | 67 base::WaitableEvent event(false, false); |
67 audio_manager_->GetTaskRunner()->PostTask(FROM_HERE, base::Bind( | 68 audio_manager_->GetTaskRunner()->PostTask(FROM_HERE, base::Bind( |
68 &base::WaitableEvent::Signal, base::Unretained(&event))); | 69 &base::WaitableEvent::Signal, base::Unretained(&event))); |
69 event.Wait(); | 70 event.Wait(); |
70 manager_ = new AudioInputDeviceManager(audio_manager_.get()); | 71 manager_ = new AudioInputDeviceManager(audio_manager_.get()); |
71 manager_->UseFakeDevice(); | 72 manager_->UseFakeDevice(); |
72 audio_input_listener_.reset(new MockAudioInputDeviceManagerListener()); | 73 audio_input_listener_.reset(new MockAudioInputDeviceManagerListener()); |
73 manager_->Register(audio_input_listener_.get(), | 74 manager_->Register(audio_input_listener_.get(), |
74 message_loop_->message_loop_proxy().get()); | 75 message_loop_->task_runner().get()); |
75 | 76 |
76 // Gets the enumerated device list from the AudioInputDeviceManager. | 77 // Gets the enumerated device list from the AudioInputDeviceManager. |
77 manager_->EnumerateDevices(MEDIA_DEVICE_AUDIO_CAPTURE); | 78 manager_->EnumerateDevices(MEDIA_DEVICE_AUDIO_CAPTURE); |
78 EXPECT_CALL(*audio_input_listener_, | 79 EXPECT_CALL(*audio_input_listener_, |
79 DevicesEnumerated(MEDIA_DEVICE_AUDIO_CAPTURE, _)) | 80 DevicesEnumerated(MEDIA_DEVICE_AUDIO_CAPTURE, _)) |
80 .Times(1) | 81 .Times(1) |
81 .WillOnce(SaveArg<1>(&devices_)); | 82 .WillOnce(SaveArg<1>(&devices_)); |
82 | 83 |
83 // Wait until we get the list. | 84 // Wait until we get the list. |
84 message_loop_->RunUntilIdle(); | 85 message_loop_->RunUntilIdle(); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 DCHECK(!info); | 280 DCHECK(!info); |
280 | 281 |
281 manager_->Close(session_id); | 282 manager_->Close(session_id); |
282 EXPECT_CALL(*audio_input_listener_, | 283 EXPECT_CALL(*audio_input_listener_, |
283 Closed(MEDIA_DEVICE_AUDIO_CAPTURE, session_id)) | 284 Closed(MEDIA_DEVICE_AUDIO_CAPTURE, session_id)) |
284 .Times(1); | 285 .Times(1); |
285 message_loop_->RunUntilIdle(); | 286 message_loop_->RunUntilIdle(); |
286 } | 287 } |
287 | 288 |
288 } // namespace content | 289 } // namespace content |
OLD | NEW |