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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 StreamDeviceInfoArray video_devices_; | 113 StreamDeviceInfoArray video_devices_; |
114 StreamDeviceInfo opened_device_; | 114 StreamDeviceInfo opened_device_; |
115 StreamDeviceInfoArray enumerated_devices_; | 115 StreamDeviceInfoArray enumerated_devices_; |
116 | 116 |
117 private: | 117 private: |
118 virtual ~MockMediaStreamDispatcherHost() {} | 118 virtual ~MockMediaStreamDispatcherHost() {} |
119 | 119 |
120 // This method is used to dispatch IPC messages to the renderer. We intercept | 120 // This method is used to dispatch IPC messages to the renderer. We intercept |
121 // these messages here and dispatch to our mock methods to verify the | 121 // these messages here and dispatch to our mock methods to verify the |
122 // conversation between this object and the renderer. | 122 // conversation between this object and the renderer. |
123 virtual bool Send(IPC::Message* message) OVERRIDE { | 123 virtual bool Send(IPC::Message* message) override { |
124 CHECK(message); | 124 CHECK(message); |
125 current_ipc_ = message; | 125 current_ipc_ = message; |
126 | 126 |
127 // In this method we dispatch the messages to the according handlers as if | 127 // In this method we dispatch the messages to the according handlers as if |
128 // we are the renderer. | 128 // we are the renderer. |
129 bool handled = true; | 129 bool handled = true; |
130 IPC_BEGIN_MESSAGE_MAP(MockMediaStreamDispatcherHost, *message) | 130 IPC_BEGIN_MESSAGE_MAP(MockMediaStreamDispatcherHost, *message) |
131 IPC_MESSAGE_HANDLER(MediaStreamMsg_StreamGenerated, | 131 IPC_MESSAGE_HANDLER(MediaStreamMsg_StreamGenerated, |
132 OnStreamGeneratedInternal) | 132 OnStreamGeneratedInternal) |
133 IPC_MESSAGE_HANDLER(MediaStreamMsg_StreamGenerationFailed, | 133 IPC_MESSAGE_HANDLER(MediaStreamMsg_StreamGenerationFailed, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 chromeos::CrasAudioHandler::InitializeForTesting(); | 253 chromeos::CrasAudioHandler::InitializeForTesting(); |
254 #endif | 254 #endif |
255 } | 255 } |
256 | 256 |
257 virtual ~MediaStreamDispatcherHostTest() { | 257 virtual ~MediaStreamDispatcherHostTest() { |
258 #if defined(OS_CHROMEOS) | 258 #if defined(OS_CHROMEOS) |
259 chromeos::CrasAudioHandler::Shutdown(); | 259 chromeos::CrasAudioHandler::Shutdown(); |
260 #endif | 260 #endif |
261 } | 261 } |
262 | 262 |
263 virtual void SetUp() OVERRIDE { | 263 virtual void SetUp() override { |
264 video_capture_device_factory_->GetDeviceNames(&physical_video_devices_); | 264 video_capture_device_factory_->GetDeviceNames(&physical_video_devices_); |
265 ASSERT_GT(physical_video_devices_.size(), 0u); | 265 ASSERT_GT(physical_video_devices_.size(), 0u); |
266 | 266 |
267 media_stream_manager_->audio_input_device_manager()->GetFakeDeviceNames( | 267 media_stream_manager_->audio_input_device_manager()->GetFakeDeviceNames( |
268 &physical_audio_devices_); | 268 &physical_audio_devices_); |
269 ASSERT_GT(physical_audio_devices_.size(), 0u); | 269 ASSERT_GT(physical_audio_devices_.size(), 0u); |
270 } | 270 } |
271 | 271 |
272 virtual void TearDown() OVERRIDE { | 272 virtual void TearDown() override { |
273 host_->OnChannelClosing(); | 273 host_->OnChannelClosing(); |
274 } | 274 } |
275 | 275 |
276 protected: | 276 protected: |
277 virtual void SetupFakeUI(bool expect_started) { | 277 virtual void SetupFakeUI(bool expect_started) { |
278 stream_ui_ = new MockMediaStreamUIProxy(); | 278 stream_ui_ = new MockMediaStreamUIProxy(); |
279 if (expect_started) { | 279 if (expect_started) { |
280 EXPECT_CALL(*stream_ui_, OnStarted(_, _)); | 280 EXPECT_CALL(*stream_ui_, OnStarted(_, _)); |
281 } | 281 } |
282 media_stream_manager_->UseFakeUI( | 282 media_stream_manager_->UseFakeUI( |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 | 915 |
916 TEST_F(MediaStreamDispatcherHostTest, EnumerateVideoDevicesNoAccess) { | 916 TEST_F(MediaStreamDispatcherHostTest, EnumerateVideoDevicesNoAccess) { |
917 SetupFakeUI(false); | 917 SetupFakeUI(false); |
918 stream_ui_->SetCameraAccess(false); | 918 stream_ui_->SetCameraAccess(false); |
919 EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId, | 919 EnumerateDevicesAndWaitForResult(kRenderId, kPageRequestId, |
920 MEDIA_DEVICE_VIDEO_CAPTURE); | 920 MEDIA_DEVICE_VIDEO_CAPTURE); |
921 EXPECT_TRUE(DoesNotContainLabels(host_->enumerated_devices_)); | 921 EXPECT_TRUE(DoesNotContainLabels(host_->enumerated_devices_)); |
922 } | 922 } |
923 | 923 |
924 }; // namespace content | 924 }; // namespace content |
OLD | NEW |