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