OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCPEERCONNECTIONHANDLER_H_ | 5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCPEERCONNECTIONHANDLER_H_ |
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCPEERCONNECTIONHANDLER_H_ | 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCPEERCONNECTIONHANDLER_H_ |
7 | 7 |
| 8 #include <map> |
| 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "content/shell/renderer/test_runner/web_task.h" | 11 #include "content/shell/renderer/test_runner/web_task.h" |
10 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandler.h" | 12 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandler.h" |
11 #include "third_party/WebKit/public/platform/WebRTCSessionDescription.h" | 13 #include "third_party/WebKit/public/platform/WebRTCSessionDescription.h" |
12 #include "third_party/WebKit/public/platform/WebRTCSessionDescriptionRequest.h" | 14 #include "third_party/WebKit/public/platform/WebRTCSessionDescriptionRequest.h" |
13 #include "third_party/WebKit/public/platform/WebRTCStatsRequest.h" | 15 #include "third_party/WebKit/public/platform/WebRTCStatsRequest.h" |
14 | 16 |
15 namespace blink { | 17 namespace blink { |
16 class WebRTCPeerConnectionHandlerClient; | 18 class WebRTCPeerConnectionHandlerClient; |
17 }; | 19 }; |
18 | 20 |
19 namespace content { | 21 namespace content { |
20 | 22 |
21 class TestInterfaces; | 23 class TestInterfaces; |
22 | 24 |
23 class MockWebRTCPeerConnectionHandler | 25 class MockWebRTCPeerConnectionHandler |
24 : public blink::WebRTCPeerConnectionHandler { | 26 : public blink::WebRTCPeerConnectionHandler { |
25 public: | 27 public: |
26 MockWebRTCPeerConnectionHandler( | 28 MockWebRTCPeerConnectionHandler( |
27 blink::WebRTCPeerConnectionHandlerClient* client, | 29 blink::WebRTCPeerConnectionHandlerClient* client, |
28 TestInterfaces* interfaces); | 30 TestInterfaces* interfaces); |
| 31 virtual ~MockWebRTCPeerConnectionHandler(); |
29 | 32 |
30 // WebRTCPeerConnectionHandler related methods | 33 // WebRTCPeerConnectionHandler related methods |
31 virtual bool initialize( | 34 virtual bool initialize( |
32 const blink::WebRTCConfiguration& configuration, | 35 const blink::WebRTCConfiguration& configuration, |
33 const blink::WebMediaConstraints& constraints) OVERRIDE; | 36 const blink::WebMediaConstraints& constraints) OVERRIDE; |
34 | 37 |
35 virtual void createOffer( | 38 virtual void createOffer( |
36 const blink::WebRTCSessionDescriptionRequest& request, | 39 const blink::WebRTCSessionDescriptionRequest& request, |
37 const blink::WebMediaConstraints& constraints) OVERRIDE; | 40 const blink::WebMediaConstraints& constraints) OVERRIDE; |
38 virtual void createOffer( | 41 virtual void createOffer( |
(...skipping 29 matching lines...) Expand all Loading... |
68 virtual blink::WebRTCDTMFSenderHandler* createDTMFSender( | 71 virtual blink::WebRTCDTMFSenderHandler* createDTMFSender( |
69 const blink::WebMediaStreamTrack& track) OVERRIDE; | 72 const blink::WebMediaStreamTrack& track) OVERRIDE; |
70 virtual void stop() OVERRIDE; | 73 virtual void stop() OVERRIDE; |
71 | 74 |
72 // WebTask related methods | 75 // WebTask related methods |
73 WebTaskList* mutable_task_list() { return &task_list_; } | 76 WebTaskList* mutable_task_list() { return &task_list_; } |
74 | 77 |
75 private: | 78 private: |
76 MockWebRTCPeerConnectionHandler(); | 79 MockWebRTCPeerConnectionHandler(); |
77 | 80 |
| 81 // UpdateRemoteStreams uses the collection of |local_streams_| to create |
| 82 // remote MediaStreams with the same number of tracks and notifies |client_| |
| 83 // about added and removed streams. It's triggered when setRemoteDescription |
| 84 // is called. |
| 85 void UpdateRemoteStreams(); |
| 86 |
78 blink::WebRTCPeerConnectionHandlerClient* client_; | 87 blink::WebRTCPeerConnectionHandlerClient* client_; |
79 bool stopped_; | 88 bool stopped_; |
80 WebTaskList task_list_; | 89 WebTaskList task_list_; |
81 blink::WebRTCSessionDescription local_description_; | 90 blink::WebRTCSessionDescription local_description_; |
82 blink::WebRTCSessionDescription remote_description_; | 91 blink::WebRTCSessionDescription remote_description_; |
83 int stream_count_; | 92 int stream_count_; |
84 TestInterfaces* interfaces_; | 93 TestInterfaces* interfaces_; |
| 94 typedef std::map<std::string, blink::WebMediaStream> StreamMap; |
| 95 StreamMap local_streams_; |
| 96 StreamMap remote_streams_; |
85 | 97 |
86 DISALLOW_COPY_AND_ASSIGN(MockWebRTCPeerConnectionHandler); | 98 DISALLOW_COPY_AND_ASSIGN(MockWebRTCPeerConnectionHandler); |
87 }; | 99 }; |
88 | 100 |
89 } // namespace content | 101 } // namespace content |
90 | 102 |
91 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCPEERCONNECTIONHANDLER_H_ | 103 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCPEERCONNECTIONHANDLER_H_ |
OLD | NEW |