| 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 #ifndef CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DISPATCHER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 void GenerateStream( | 22 void 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 StreamControls& controls, | 25 const StreamControls& controls, |
| 26 const url::Origin& url) override; | 26 const url::Origin& url) override; |
| 27 void CancelGenerateStream( | 27 void CancelGenerateStream( |
| 28 int request_id, | 28 int request_id, |
| 29 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler) | 29 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler) |
| 30 override; | 30 override; |
| 31 void EnumerateDevices( | |
| 32 int request_id, | |
| 33 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, | |
| 34 MediaStreamType type, | |
| 35 const url::Origin& security_origin) override; | |
| 36 void StopStreamDevice(const StreamDeviceInfo& device_info) override; | 31 void StopStreamDevice(const StreamDeviceInfo& device_info) override; |
| 37 bool IsStream(const std::string& label) override; | 32 bool IsStream(const std::string& label) override; |
| 38 int video_session_id(const std::string& label, int index) override; | 33 int video_session_id(const std::string& label, int index) override; |
| 39 int audio_session_id(const std::string& label, int index) override; | 34 int audio_session_id(const std::string& label, int index) override; |
| 40 | 35 |
| 41 int audio_input_request_id() const { return audio_input_request_id_; } | 36 int audio_input_request_id() const { return audio_input_request_id_; } |
| 42 int audio_output_request_id() const { return audio_output_request_id_; } | |
| 43 int video_request_id() const { return video_request_id_; } | |
| 44 int request_stream_counter() const { return request_stream_counter_; } | 37 int request_stream_counter() const { return request_stream_counter_; } |
| 45 void IncrementSessionId() { ++session_id_; } | 38 void IncrementSessionId() { ++session_id_; } |
| 46 void TestSameId() { test_same_id_ = true; } | 39 void TestSameId() { test_same_id_ = true; } |
| 47 | 40 |
| 48 int stop_audio_device_counter() const { return stop_audio_device_counter_; } | 41 int stop_audio_device_counter() const { return stop_audio_device_counter_; } |
| 49 int stop_video_device_counter() const { return stop_video_device_counter_; } | 42 int stop_video_device_counter() const { return stop_video_device_counter_; } |
| 50 | 43 |
| 51 const std::string& stream_label() const { return stream_label_;} | 44 const std::string& stream_label() const { return stream_label_;} |
| 52 const StreamDeviceInfoArray& audio_input_array() const { | 45 const StreamDeviceInfoArray& audio_input_array() const { |
| 53 return audio_input_array_; | 46 return audio_input_array_; |
| 54 } | 47 } |
| 55 const StreamDeviceInfoArray& audio_output_array() const { | |
| 56 return audio_output_array_; | |
| 57 } | |
| 58 const StreamDeviceInfoArray& video_array() const { return video_array_; } | 48 const StreamDeviceInfoArray& video_array() const { return video_array_; } |
| 59 size_t NumDeviceChangeSubscribers() const { | |
| 60 return MediaStreamDispatcher::NumDeviceChangeSubscribers(); | |
| 61 } | |
| 62 | 49 |
| 63 private: | 50 private: |
| 64 void AddAudioInputDeviceToArray(bool matched_output); | 51 void AddAudioInputDeviceToArray(bool matched_output); |
| 65 void AddAudioOutputDeviceToArray(); | |
| 66 void AddVideoDeviceToArray(bool facing_user); | 52 void AddVideoDeviceToArray(bool facing_user); |
| 67 | 53 |
| 68 int audio_input_request_id_; | 54 int audio_input_request_id_; |
| 69 int audio_output_request_id_; // Only used for EnumerateDevices. | |
| 70 int video_request_id_; // Only used for EnumerateDevices. | |
| 71 base::WeakPtr<MediaStreamDispatcherEventHandler> event_handler_; | 55 base::WeakPtr<MediaStreamDispatcherEventHandler> event_handler_; |
| 72 int request_stream_counter_; | 56 int request_stream_counter_; |
| 73 int stop_audio_device_counter_; | 57 int stop_audio_device_counter_; |
| 74 int stop_video_device_counter_; | 58 int stop_video_device_counter_; |
| 75 | 59 |
| 76 std::string stream_label_; | 60 std::string stream_label_; |
| 77 int session_id_; | 61 int session_id_; |
| 78 bool test_same_id_; | 62 bool test_same_id_; |
| 79 StreamDeviceInfoArray audio_input_array_; | 63 StreamDeviceInfoArray audio_input_array_; |
| 80 StreamDeviceInfoArray audio_output_array_; | |
| 81 StreamDeviceInfoArray video_array_; | 64 StreamDeviceInfoArray video_array_; |
| 82 | 65 |
| 83 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDispatcher); | 66 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDispatcher); |
| 84 }; | 67 }; |
| 85 | 68 |
| 86 } // namespace content | 69 } // namespace content |
| 87 | 70 |
| 88 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DISPATCHER_H_ | 71 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DISPATCHER_H_ |
| OLD | NEW |