| 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 "content/renderer/media/mock_media_stream_dispatcher.h" | 5 #include "content/renderer/media/mock_media_stream_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "content/public/common/media_stream_request.h" | 8 #include "content/public/common/media_stream_request.h" |
| 9 #include "media/base/audio_parameters.h" | 9 #include "media/base/audio_parameters.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 int request_id, | 54 int request_id, |
| 55 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler) { | 55 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler) { |
| 56 EXPECT_EQ(request_id, audio_input_request_id_); | 56 EXPECT_EQ(request_id, audio_input_request_id_); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void MockMediaStreamDispatcher::EnumerateDevices( | 59 void MockMediaStreamDispatcher::EnumerateDevices( |
| 60 int request_id, | 60 int request_id, |
| 61 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, | 61 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, |
| 62 MediaStreamType type, | 62 MediaStreamType type, |
| 63 const url::Origin& security_origin) { | 63 const url::Origin& security_origin) { |
| 64 if (type == MEDIA_DEVICE_AUDIO_CAPTURE) { | 64 NOTREACHED(); |
| 65 audio_input_request_id_ = request_id; | |
| 66 audio_input_array_.clear(); | |
| 67 AddAudioInputDeviceToArray(true); | |
| 68 AddAudioInputDeviceToArray(false); | |
| 69 } else if (type == MEDIA_DEVICE_AUDIO_OUTPUT) { | |
| 70 audio_output_request_id_ = request_id; | |
| 71 audio_output_array_.clear(); | |
| 72 AddAudioOutputDeviceToArray(); | |
| 73 } else if (type == MEDIA_DEVICE_VIDEO_CAPTURE) { | |
| 74 video_request_id_ = request_id; | |
| 75 video_array_.clear(); | |
| 76 AddVideoDeviceToArray(true); | |
| 77 AddVideoDeviceToArray(false); | |
| 78 } | |
| 79 } | 65 } |
| 80 | 66 |
| 81 void MockMediaStreamDispatcher::StopStreamDevice( | 67 void MockMediaStreamDispatcher::StopStreamDevice( |
| 82 const StreamDeviceInfo& device_info) { | 68 const StreamDeviceInfo& device_info) { |
| 83 if (IsAudioInputMediaType(device_info.device.type)) { | 69 if (IsAudioInputMediaType(device_info.device.type)) { |
| 84 ++stop_audio_device_counter_; | 70 ++stop_audio_device_counter_; |
| 85 return; | 71 return; |
| 86 } | 72 } |
| 87 if (IsVideoMediaType(device_info.device.type)) { | 73 if (IsVideoMediaType(device_info.device.type)) { |
| 88 ++stop_video_device_counter_; | 74 ++stop_video_device_counter_; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 video.device.id = video.device.id + base::IntToString(session_id_); | 132 video.device.id = video.device.id + base::IntToString(session_id_); |
| 147 video.device.name = "usb video camera"; | 133 video.device.name = "usb video camera"; |
| 148 video.device.type = MEDIA_DEVICE_VIDEO_CAPTURE; | 134 video.device.type = MEDIA_DEVICE_VIDEO_CAPTURE; |
| 149 video.device.video_facing = facing_user ? MEDIA_VIDEO_FACING_USER | 135 video.device.video_facing = facing_user ? MEDIA_VIDEO_FACING_USER |
| 150 : MEDIA_VIDEO_FACING_ENVIRONMENT; | 136 : MEDIA_VIDEO_FACING_ENVIRONMENT; |
| 151 video.session_id = session_id_; | 137 video.session_id = session_id_; |
| 152 video_array_.push_back(video); | 138 video_array_.push_back(video); |
| 153 } | 139 } |
| 154 | 140 |
| 155 } // namespace content | 141 } // namespace content |
| OLD | NEW |