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 #include <queue> | 6 #include <queue> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "content/test/test_content_browser_client.h" | 26 #include "content/test/test_content_browser_client.h" |
27 #include "content/test/test_content_client.h" | 27 #include "content/test/test_content_client.h" |
28 #include "ipc/ipc_message_macros.h" | 28 #include "ipc/ipc_message_macros.h" |
29 #include "media/audio/mock_audio_manager.h" | 29 #include "media/audio/mock_audio_manager.h" |
30 #include "media/base/media_switches.h" | 30 #include "media/base/media_switches.h" |
31 #include "media/video/capture/fake_video_capture_device_factory.h" | 31 #include "media/video/capture/fake_video_capture_device_factory.h" |
32 #include "net/url_request/url_request_context.h" | 32 #include "net/url_request/url_request_context.h" |
33 #include "testing/gmock/include/gmock/gmock.h" | 33 #include "testing/gmock/include/gmock/gmock.h" |
34 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
35 | 35 |
| 36 #if defined(OS_CHROMEOS) |
| 37 #include "chromeos/audio/cras_audio_handler.h" |
| 38 #endif |
| 39 |
36 using ::testing::_; | 40 using ::testing::_; |
37 using ::testing::DeleteArg; | 41 using ::testing::DeleteArg; |
38 using ::testing::DoAll; | 42 using ::testing::DoAll; |
39 using ::testing::InSequence; | 43 using ::testing::InSequence; |
40 using ::testing::Return; | 44 using ::testing::Return; |
41 using ::testing::SaveArg; | 45 using ::testing::SaveArg; |
42 | 46 |
43 const int kProcessId = 5; | 47 const int kProcessId = 5; |
44 const int kRenderId = 6; | 48 const int kRenderId = 6; |
45 const int kPageRequestId = 7; | 49 const int kPageRequestId = 7; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 241 |
238 host_ = new MockMediaStreamDispatcherHost( | 242 host_ = new MockMediaStreamDispatcherHost( |
239 mock_resource_context->GetMediaDeviceIDSalt(), | 243 mock_resource_context->GetMediaDeviceIDSalt(), |
240 base::MessageLoopProxy::current(), | 244 base::MessageLoopProxy::current(), |
241 media_stream_manager_.get()); | 245 media_stream_manager_.get()); |
242 | 246 |
243 // Use the fake content client and browser. | 247 // Use the fake content client and browser. |
244 content_client_.reset(new TestContentClient()); | 248 content_client_.reset(new TestContentClient()); |
245 SetContentClient(content_client_.get()); | 249 SetContentClient(content_client_.get()); |
246 old_browser_client_ = SetBrowserClientForTesting(host_.get()); | 250 old_browser_client_ = SetBrowserClientForTesting(host_.get()); |
| 251 |
| 252 #if defined(OS_CHROMEOS) |
| 253 chromeos::CrasAudioHandler::InitializeForTesting(); |
| 254 #endif |
247 } | 255 } |
248 | 256 |
249 virtual ~MediaStreamDispatcherHostTest() { | 257 virtual ~MediaStreamDispatcherHostTest() { |
| 258 #if defined(OS_CHROMEOS) |
| 259 chromeos::CrasAudioHandler::Shutdown(); |
| 260 #endif |
250 } | 261 } |
251 | 262 |
252 virtual void SetUp() OVERRIDE { | 263 virtual void SetUp() OVERRIDE { |
253 video_capture_device_factory_->GetDeviceNames(&physical_video_devices_); | 264 video_capture_device_factory_->GetDeviceNames(&physical_video_devices_); |
254 ASSERT_GT(physical_video_devices_.size(), 0u); | 265 ASSERT_GT(physical_video_devices_.size(), 0u); |
255 | 266 |
256 media_stream_manager_->audio_input_device_manager()->GetFakeDeviceNames( | 267 media_stream_manager_->audio_input_device_manager()->GetFakeDeviceNames( |
257 &physical_audio_devices_); | 268 &physical_audio_devices_); |
258 ASSERT_GT(physical_audio_devices_.size(), 0u); | 269 ASSERT_GT(physical_audio_devices_.size(), 0u); |
259 } | 270 } |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 | 912 |
902 TEST_F(MediaStreamDispatcherHostTest, EnumerateVideoDevicesNoAccess) { | 913 TEST_F(MediaStreamDispatcherHostTest, EnumerateVideoDevicesNoAccess) { |
903 SetupFakeUI(false); | 914 SetupFakeUI(false); |
904 stream_ui_->SetCameraAccess(false); | 915 stream_ui_->SetCameraAccess(false); |
905 EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId, | 916 EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId, |
906 MEDIA_DEVICE_VIDEO_CAPTURE); | 917 MEDIA_DEVICE_VIDEO_CAPTURE); |
907 EXPECT_TRUE(DoesNotContainLabels(host_->enumerated_devices_)); | 918 EXPECT_TRUE(DoesNotContainLabels(host_->enumerated_devices_)); |
908 } | 919 } |
909 | 920 |
910 }; // namespace content | 921 }; // namespace content |
OLD | NEW |