| 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/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "content/public/common/media_stream_request.h" | 8 #include "content/public/common/media_stream_request.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 MockMediaStreamDispatcher::MockMediaStreamDispatcher() | 13 MockMediaStreamDispatcher::MockMediaStreamDispatcher() |
| 14 : MediaStreamDispatcher(NULL), | 14 : MediaStreamDispatcher(NULL), |
| 15 request_id_(-1), | 15 request_id_(-1), |
| 16 request_stream_counter_(0), | 16 request_stream_counter_(0), |
| 17 stop_stream_counter_(0) { | 17 stop_stream_counter_(0) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 MockMediaStreamDispatcher::~MockMediaStreamDispatcher() {} | 20 MockMediaStreamDispatcher::~MockMediaStreamDispatcher() {} |
| 21 | 21 |
| 22 void MockMediaStreamDispatcher::GenerateStream( | 22 void MockMediaStreamDispatcher::GenerateStream( |
| 23 int request_id, | 23 int request_id, |
| 24 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, | 24 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, |
| 25 const StreamOptions& components, | 25 const StreamOptions& components, |
| 26 const GURL& url) { | 26 const GURL& url) { |
| 27 request_id_ = request_id; | 27 request_id_ = request_id; |
| 28 | 28 |
| 29 stream_label_ = StringPrintf("%s%d","local_stream",request_id); | 29 stream_label_ = base::StringPrintf("%s%d","local_stream",request_id); |
| 30 audio_array_.clear(); | 30 audio_array_.clear(); |
| 31 video_array_.clear(); | 31 video_array_.clear(); |
| 32 | 32 |
| 33 if (IsAudioMediaType(components.audio_type)) { | 33 if (IsAudioMediaType(components.audio_type)) { |
| 34 StreamDeviceInfo audio; | 34 StreamDeviceInfo audio; |
| 35 audio.device.id = "audio_device_id"; | 35 audio.device.id = "audio_device_id"; |
| 36 audio.device.name = "microphone"; | 36 audio.device.name = "microphone"; |
| 37 audio.device.type = components.audio_type; | 37 audio.device.type = components.audio_type; |
| 38 audio.session_id = request_id; | 38 audio.session_id = request_id; |
| 39 audio_array_.push_back(audio); | 39 audio_array_.push_back(audio); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 65 int index) { | 65 int index) { |
| 66 return -1; | 66 return -1; |
| 67 } | 67 } |
| 68 | 68 |
| 69 int MockMediaStreamDispatcher::audio_session_id(const std::string& label, | 69 int MockMediaStreamDispatcher::audio_session_id(const std::string& label, |
| 70 int index) { | 70 int index) { |
| 71 return -1; | 71 return -1; |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace content | 74 } // namespace content |
| OLD | NEW |