| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_WEBRTC_PEER_CONNECTION_HANDLER_H
_ | |
| 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_WEBRTC_PEER_CONNECTION_HANDLER_H
_ | |
| 7 | |
| 8 #include <map> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "content/shell/renderer/test_runner/web_task.h" | |
| 12 #include "third_party/WebKit/public/platform/WebRTCPeerConnectionHandler.h" | |
| 13 #include "third_party/WebKit/public/platform/WebRTCSessionDescription.h" | |
| 14 #include "third_party/WebKit/public/platform/WebRTCSessionDescriptionRequest.h" | |
| 15 #include "third_party/WebKit/public/platform/WebRTCStatsRequest.h" | |
| 16 | |
| 17 namespace blink { | |
| 18 class WebRTCPeerConnectionHandlerClient; | |
| 19 }; | |
| 20 | |
| 21 namespace content { | |
| 22 | |
| 23 class TestInterfaces; | |
| 24 | |
| 25 class MockWebRTCPeerConnectionHandler | |
| 26 : public blink::WebRTCPeerConnectionHandler { | |
| 27 public: | |
| 28 MockWebRTCPeerConnectionHandler( | |
| 29 blink::WebRTCPeerConnectionHandlerClient* client, | |
| 30 TestInterfaces* interfaces); | |
| 31 virtual ~MockWebRTCPeerConnectionHandler(); | |
| 32 | |
| 33 // WebRTCPeerConnectionHandler related methods | |
| 34 virtual bool initialize( | |
| 35 const blink::WebRTCConfiguration& configuration, | |
| 36 const blink::WebMediaConstraints& constraints) override; | |
| 37 | |
| 38 virtual void createOffer( | |
| 39 const blink::WebRTCSessionDescriptionRequest& request, | |
| 40 const blink::WebMediaConstraints& constraints) override; | |
| 41 virtual void createOffer( | |
| 42 const blink::WebRTCSessionDescriptionRequest& request, | |
| 43 const blink::WebRTCOfferOptions& options) override; | |
| 44 virtual void createAnswer( | |
| 45 const blink::WebRTCSessionDescriptionRequest& request, | |
| 46 const blink::WebMediaConstraints& constraints) override; | |
| 47 virtual void setLocalDescription( | |
| 48 const blink::WebRTCVoidRequest& request, | |
| 49 const blink::WebRTCSessionDescription& local_description) override; | |
| 50 virtual void setRemoteDescription( | |
| 51 const blink::WebRTCVoidRequest& request, | |
| 52 const blink::WebRTCSessionDescription& remote_description) override; | |
| 53 virtual blink::WebRTCSessionDescription localDescription() override; | |
| 54 virtual blink::WebRTCSessionDescription remoteDescription() override; | |
| 55 virtual bool updateICE( | |
| 56 const blink::WebRTCConfiguration& configuration, | |
| 57 const blink::WebMediaConstraints& constraints) override; | |
| 58 virtual bool addICECandidate( | |
| 59 const blink::WebRTCICECandidate& ice_candidate) override; | |
| 60 virtual bool addICECandidate( | |
| 61 const blink::WebRTCVoidRequest& request, | |
| 62 const blink::WebRTCICECandidate& ice_candidate) override; | |
| 63 virtual bool addStream( | |
| 64 const blink::WebMediaStream& stream, | |
| 65 const blink::WebMediaConstraints& constraints) override; | |
| 66 virtual void removeStream(const blink::WebMediaStream& stream) override; | |
| 67 virtual void getStats(const blink::WebRTCStatsRequest& request) override; | |
| 68 virtual blink::WebRTCDataChannelHandler* createDataChannel( | |
| 69 const blink::WebString& label, | |
| 70 const blink::WebRTCDataChannelInit& init) override; | |
| 71 virtual blink::WebRTCDTMFSenderHandler* createDTMFSender( | |
| 72 const blink::WebMediaStreamTrack& track) override; | |
| 73 virtual void stop() override; | |
| 74 | |
| 75 // WebTask related methods | |
| 76 WebTaskList* mutable_task_list() { return &task_list_; } | |
| 77 | |
| 78 private: | |
| 79 MockWebRTCPeerConnectionHandler(); | |
| 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 | |
| 87 blink::WebRTCPeerConnectionHandlerClient* client_; | |
| 88 bool stopped_; | |
| 89 WebTaskList task_list_; | |
| 90 blink::WebRTCSessionDescription local_description_; | |
| 91 blink::WebRTCSessionDescription remote_description_; | |
| 92 int stream_count_; | |
| 93 TestInterfaces* interfaces_; | |
| 94 typedef std::map<std::string, blink::WebMediaStream> StreamMap; | |
| 95 StreamMap local_streams_; | |
| 96 StreamMap remote_streams_; | |
| 97 | |
| 98 DISALLOW_COPY_AND_ASSIGN(MockWebRTCPeerConnectionHandler); | |
| 99 }; | |
| 100 | |
| 101 } // namespace content | |
| 102 | |
| 103 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_MOCK_WEBRTC_PEER_CONNECTION_HANDLE
R_H_ | |
| OLD | NEW |