Chromium Code Reviews| 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" |
| 16 #include "third_party/WebKit/public/platform/WebString.h" | |
| 14 | 17 |
| 15 namespace blink { | 18 namespace blink { |
| 16 class WebRTCPeerConnectionHandlerClient; | 19 class WebRTCPeerConnectionHandlerClient; |
| 17 }; | 20 }; |
| 18 | 21 |
| 19 namespace content { | 22 namespace content { |
| 20 | 23 |
| 21 class TestInterfaces; | 24 class TestInterfaces; |
| 22 | 25 |
| 23 class MockWebRTCPeerConnectionHandler | 26 class MockWebRTCPeerConnectionHandler |
| 24 : public blink::WebRTCPeerConnectionHandler { | 27 : public blink::WebRTCPeerConnectionHandler { |
| 25 public: | 28 public: |
| 26 MockWebRTCPeerConnectionHandler( | 29 MockWebRTCPeerConnectionHandler( |
| 27 blink::WebRTCPeerConnectionHandlerClient* client, | 30 blink::WebRTCPeerConnectionHandlerClient* client, |
| 28 TestInterfaces* interfaces); | 31 TestInterfaces* interfaces); |
| 32 virtual ~MockWebRTCPeerConnectionHandler(); | |
| 29 | 33 |
| 30 // WebRTCPeerConnectionHandler related methods | 34 // WebRTCPeerConnectionHandler related methods |
| 31 virtual bool initialize( | 35 virtual bool initialize( |
| 32 const blink::WebRTCConfiguration& configuration, | 36 const blink::WebRTCConfiguration& configuration, |
| 33 const blink::WebMediaConstraints& constraints) OVERRIDE; | 37 const blink::WebMediaConstraints& constraints) OVERRIDE; |
| 34 | 38 |
| 35 virtual void createOffer( | 39 virtual void createOffer( |
| 36 const blink::WebRTCSessionDescriptionRequest& request, | 40 const blink::WebRTCSessionDescriptionRequest& request, |
| 37 const blink::WebMediaConstraints& constraints) OVERRIDE; | 41 const blink::WebMediaConstraints& constraints) OVERRIDE; |
| 38 virtual void createOffer( | 42 virtual void createOffer( |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 66 const blink::WebString& label, | 70 const blink::WebString& label, |
| 67 const blink::WebRTCDataChannelInit& init) OVERRIDE; | 71 const blink::WebRTCDataChannelInit& init) OVERRIDE; |
| 68 virtual blink::WebRTCDTMFSenderHandler* createDTMFSender( | 72 virtual blink::WebRTCDTMFSenderHandler* createDTMFSender( |
| 69 const blink::WebMediaStreamTrack& track) OVERRIDE; | 73 const blink::WebMediaStreamTrack& track) OVERRIDE; |
| 70 virtual void stop() OVERRIDE; | 74 virtual void stop() OVERRIDE; |
| 71 | 75 |
| 72 // WebTask related methods | 76 // WebTask related methods |
| 73 WebTaskList* mutable_task_list() { return &task_list_; } | 77 WebTaskList* mutable_task_list() { return &task_list_; } |
| 74 | 78 |
| 75 private: | 79 private: |
| 76 MockWebRTCPeerConnectionHandler(); | 80 // UpdateRemoteStreams uses the collection of |local_streams_| to create |
|
hta - Chromium
2014/09/30 09:43:49
Hmm.... I think there was a reason for this existi
| |
| 81 // remote MediaStreams with the same amount of tracks and notifies |client_| | |
|
hta - Chromium
2014/09/30 09:43:49
Nit: amount of tracks -> number of tracks
perkj_chrome
2014/09/30 18:38:31
Done.
| |
| 82 // about added and removed streams. Its triggered when setRemoteDescription | |
|
hta - Chromium
2014/09/30 09:43:50
Nit: Its -> It's
perkj_chrome
2014/09/30 18:38:31
Done.
| |
| 83 // is called. | |
| 84 void UpdateRemoteStreams(); | |
| 77 | 85 |
| 78 blink::WebRTCPeerConnectionHandlerClient* client_; | 86 blink::WebRTCPeerConnectionHandlerClient* client_; |
| 79 bool stopped_; | 87 bool stopped_; |
| 80 WebTaskList task_list_; | 88 WebTaskList task_list_; |
| 81 blink::WebRTCSessionDescription local_description_; | 89 blink::WebRTCSessionDescription local_description_; |
| 82 blink::WebRTCSessionDescription remote_description_; | 90 blink::WebRTCSessionDescription remote_description_; |
| 83 int stream_count_; | 91 int stream_count_; |
| 84 TestInterfaces* interfaces_; | 92 TestInterfaces* interfaces_; |
| 93 typedef std::map<std::string, blink::WebMediaStream> StreamMap; | |
|
hta - Chromium
2014/09/30 09:43:50
Strange question: What is the type of blink::WebMe
perkj_chrome
2014/09/30 18:38:30
They are simple objects around a smart pointers.
| |
| 94 StreamMap local_streams_; | |
| 95 StreamMap remote_streams_; | |
| 85 | 96 |
| 86 DISALLOW_COPY_AND_ASSIGN(MockWebRTCPeerConnectionHandler); | 97 DISALLOW_COPY_AND_ASSIGN(MockWebRTCPeerConnectionHandler); |
| 87 }; | 98 }; |
| 88 | 99 |
| 89 } // namespace content | 100 } // namespace content |
| 90 | 101 |
| 91 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCPEERCONNECTIONHANDLER_H_ | 102 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCKWEBRTCPEERCONNECTIONHANDLER_H_ |
| OLD | NEW |