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 "content/renderer/media/media_stream_dispatcher.h" | 10 #include "content/renderer/media/media_stream_dispatcher.h" |
11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 // This class is a mock implementation of MediaStreamDispatcher. | 15 // This class is a mock implementation of MediaStreamDispatcher. |
16 class MockMediaStreamDispatcher : public MediaStreamDispatcher { | 16 class MockMediaStreamDispatcher : public MediaStreamDispatcher { |
17 public: | 17 public: |
18 MockMediaStreamDispatcher(); | 18 MockMediaStreamDispatcher(); |
19 virtual ~MockMediaStreamDispatcher(); | 19 virtual ~MockMediaStreamDispatcher(); |
20 | 20 |
21 virtual void GenerateStream( | 21 virtual void GenerateStream( |
22 int request_id, | 22 int request_id, |
23 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, | 23 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, |
24 const media_stream::StreamOptions& components, | 24 const StreamOptions& components, |
25 const GURL& url) OVERRIDE; | 25 const GURL& url) OVERRIDE; |
26 virtual void StopStream(const std::string& label) OVERRIDE; | 26 virtual void StopStream(const std::string& label) OVERRIDE; |
27 virtual bool IsStream(const std::string& label) OVERRIDE; | 27 virtual bool IsStream(const std::string& label) OVERRIDE; |
28 virtual int video_session_id(const std::string& label, int index) OVERRIDE; | 28 virtual int video_session_id(const std::string& label, int index) OVERRIDE; |
29 virtual int audio_session_id(const std::string& label, int index) OVERRIDE; | 29 virtual int audio_session_id(const std::string& label, int index) OVERRIDE; |
30 | 30 |
31 int request_id() const { return request_id_; } | 31 int request_id() const { return request_id_; } |
32 int request_stream_counter() const { return request_stream_counter_; } | 32 int request_stream_counter() const { return request_stream_counter_; } |
33 int stop_stream_counter() const { return stop_stream_counter_; } | 33 int stop_stream_counter() const { return stop_stream_counter_; } |
34 const std::string& stream_label() const { return stream_label_;} | 34 const std::string& stream_label() const { return stream_label_;} |
35 media_stream::StreamDeviceInfoArray audio_array() const { | 35 StreamDeviceInfoArray audio_array() const { return audio_array_; } |
36 return audio_array_; | 36 StreamDeviceInfoArray video_array() const { return video_array_; } |
37 } | |
38 media_stream::StreamDeviceInfoArray video_array() const { | |
39 return video_array_; | |
40 } | |
41 | 37 |
42 private: | 38 private: |
43 int request_id_; | 39 int request_id_; |
44 base::WeakPtr<MediaStreamDispatcherEventHandler> event_handler_; | 40 base::WeakPtr<MediaStreamDispatcherEventHandler> event_handler_; |
45 int request_stream_counter_; | 41 int request_stream_counter_; |
46 int stop_stream_counter_; | 42 int stop_stream_counter_; |
47 | 43 |
48 std::string stream_label_; | 44 std::string stream_label_; |
49 media_stream::StreamDeviceInfoArray audio_array_; | 45 StreamDeviceInfoArray audio_array_; |
50 media_stream::StreamDeviceInfoArray video_array_; | 46 StreamDeviceInfoArray video_array_; |
51 | 47 |
52 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDispatcher); | 48 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamDispatcher); |
53 }; | 49 }; |
54 | 50 |
55 } // namespace content | 51 } // namespace content |
56 | 52 |
57 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DISPATCHER_H_ | 53 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_DISPATCHER_H_ |
OLD | NEW |