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 #include "content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler
.h" | 5 #include "content/shell/renderer/test_runner/mock_webrtc_peer_connection_handler
.h" |
6 | 6 |
7 #include "content/shell/renderer/test_runner/mock_constraints.h" | 7 #include "content/shell/renderer/test_runner/mock_constraints.h" |
8 #include "content/shell/renderer/test_runner/mock_webrtc_data_channel_handler.h" | 8 #include "content/shell/renderer/test_runner/mock_webrtc_data_channel_handler.h" |
9 #include "content/shell/renderer/test_runner/mock_webrtc_dtmf_sender_handler.h" | 9 #include "content/shell/renderer/test_runner/mock_webrtc_dtmf_sender_handler.h" |
10 #include "content/shell/renderer/test_runner/test_interfaces.h" | 10 #include "content/shell/renderer/test_runner/test_interfaces.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 : public WebMethodTask<MockWebRTCPeerConnectionHandler> { | 27 : public WebMethodTask<MockWebRTCPeerConnectionHandler> { |
28 public: | 28 public: |
29 RTCSessionDescriptionRequestSuccededTask( | 29 RTCSessionDescriptionRequestSuccededTask( |
30 MockWebRTCPeerConnectionHandler* object, | 30 MockWebRTCPeerConnectionHandler* object, |
31 const WebRTCSessionDescriptionRequest& request, | 31 const WebRTCSessionDescriptionRequest& request, |
32 const WebRTCSessionDescription& result) | 32 const WebRTCSessionDescription& result) |
33 : WebMethodTask<MockWebRTCPeerConnectionHandler>(object), | 33 : WebMethodTask<MockWebRTCPeerConnectionHandler>(object), |
34 request_(request), | 34 request_(request), |
35 result_(result) {} | 35 result_(result) {} |
36 | 36 |
37 virtual void RunIfValid() OVERRIDE { request_.requestSucceeded(result_); } | 37 virtual void RunIfValid() override { request_.requestSucceeded(result_); } |
38 | 38 |
39 private: | 39 private: |
40 WebRTCSessionDescriptionRequest request_; | 40 WebRTCSessionDescriptionRequest request_; |
41 WebRTCSessionDescription result_; | 41 WebRTCSessionDescription result_; |
42 }; | 42 }; |
43 | 43 |
44 class RTCSessionDescriptionRequestFailedTask | 44 class RTCSessionDescriptionRequestFailedTask |
45 : public WebMethodTask<MockWebRTCPeerConnectionHandler> { | 45 : public WebMethodTask<MockWebRTCPeerConnectionHandler> { |
46 public: | 46 public: |
47 RTCSessionDescriptionRequestFailedTask( | 47 RTCSessionDescriptionRequestFailedTask( |
48 MockWebRTCPeerConnectionHandler* object, | 48 MockWebRTCPeerConnectionHandler* object, |
49 const WebRTCSessionDescriptionRequest& request) | 49 const WebRTCSessionDescriptionRequest& request) |
50 : WebMethodTask<MockWebRTCPeerConnectionHandler>(object), | 50 : WebMethodTask<MockWebRTCPeerConnectionHandler>(object), |
51 request_(request) {} | 51 request_(request) {} |
52 | 52 |
53 virtual void RunIfValid() OVERRIDE { request_.requestFailed("TEST_ERROR"); } | 53 virtual void RunIfValid() override { request_.requestFailed("TEST_ERROR"); } |
54 | 54 |
55 private: | 55 private: |
56 WebRTCSessionDescriptionRequest request_; | 56 WebRTCSessionDescriptionRequest request_; |
57 }; | 57 }; |
58 | 58 |
59 class RTCStatsRequestSucceededTask | 59 class RTCStatsRequestSucceededTask |
60 : public WebMethodTask<MockWebRTCPeerConnectionHandler> { | 60 : public WebMethodTask<MockWebRTCPeerConnectionHandler> { |
61 public: | 61 public: |
62 RTCStatsRequestSucceededTask(MockWebRTCPeerConnectionHandler* object, | 62 RTCStatsRequestSucceededTask(MockWebRTCPeerConnectionHandler* object, |
63 const blink::WebRTCStatsRequest& request, | 63 const blink::WebRTCStatsRequest& request, |
64 const blink::WebRTCStatsResponse& response) | 64 const blink::WebRTCStatsResponse& response) |
65 : WebMethodTask<MockWebRTCPeerConnectionHandler>(object), | 65 : WebMethodTask<MockWebRTCPeerConnectionHandler>(object), |
66 request_(request), | 66 request_(request), |
67 response_(response) {} | 67 response_(response) {} |
68 | 68 |
69 virtual void RunIfValid() OVERRIDE { request_.requestSucceeded(response_); } | 69 virtual void RunIfValid() override { request_.requestSucceeded(response_); } |
70 | 70 |
71 private: | 71 private: |
72 blink::WebRTCStatsRequest request_; | 72 blink::WebRTCStatsRequest request_; |
73 blink::WebRTCStatsResponse response_; | 73 blink::WebRTCStatsResponse response_; |
74 }; | 74 }; |
75 | 75 |
76 class RTCVoidRequestTask | 76 class RTCVoidRequestTask |
77 : public WebMethodTask<MockWebRTCPeerConnectionHandler> { | 77 : public WebMethodTask<MockWebRTCPeerConnectionHandler> { |
78 public: | 78 public: |
79 RTCVoidRequestTask(MockWebRTCPeerConnectionHandler* object, | 79 RTCVoidRequestTask(MockWebRTCPeerConnectionHandler* object, |
80 const WebRTCVoidRequest& request, | 80 const WebRTCVoidRequest& request, |
81 bool succeeded) | 81 bool succeeded) |
82 : WebMethodTask<MockWebRTCPeerConnectionHandler>(object), | 82 : WebMethodTask<MockWebRTCPeerConnectionHandler>(object), |
83 request_(request), | 83 request_(request), |
84 succeeded_(succeeded) {} | 84 succeeded_(succeeded) {} |
85 | 85 |
86 virtual void RunIfValid() OVERRIDE { | 86 virtual void RunIfValid() override { |
87 if (succeeded_) | 87 if (succeeded_) |
88 request_.requestSucceeded(); | 88 request_.requestSucceeded(); |
89 else | 89 else |
90 request_.requestFailed("TEST_ERROR"); | 90 request_.requestFailed("TEST_ERROR"); |
91 } | 91 } |
92 | 92 |
93 private: | 93 private: |
94 WebRTCVoidRequest request_; | 94 WebRTCVoidRequest request_; |
95 bool succeeded_; | 95 bool succeeded_; |
96 }; | 96 }; |
97 | 97 |
98 class RTCPeerConnectionStateTask | 98 class RTCPeerConnectionStateTask |
99 : public WebMethodTask<MockWebRTCPeerConnectionHandler> { | 99 : public WebMethodTask<MockWebRTCPeerConnectionHandler> { |
100 public: | 100 public: |
101 RTCPeerConnectionStateTask( | 101 RTCPeerConnectionStateTask( |
102 MockWebRTCPeerConnectionHandler* object, | 102 MockWebRTCPeerConnectionHandler* object, |
103 WebRTCPeerConnectionHandlerClient* client, | 103 WebRTCPeerConnectionHandlerClient* client, |
104 WebRTCPeerConnectionHandlerClient::ICEConnectionState connection_state, | 104 WebRTCPeerConnectionHandlerClient::ICEConnectionState connection_state, |
105 WebRTCPeerConnectionHandlerClient::ICEGatheringState gathering_state) | 105 WebRTCPeerConnectionHandlerClient::ICEGatheringState gathering_state) |
106 : WebMethodTask<MockWebRTCPeerConnectionHandler>(object), | 106 : WebMethodTask<MockWebRTCPeerConnectionHandler>(object), |
107 client_(client), | 107 client_(client), |
108 connection_state_(connection_state), | 108 connection_state_(connection_state), |
109 gathering_state_(gathering_state) {} | 109 gathering_state_(gathering_state) {} |
110 | 110 |
111 virtual void RunIfValid() OVERRIDE { | 111 virtual void RunIfValid() override { |
112 client_->didChangeICEGatheringState(gathering_state_); | 112 client_->didChangeICEGatheringState(gathering_state_); |
113 client_->didChangeICEConnectionState(connection_state_); | 113 client_->didChangeICEConnectionState(connection_state_); |
114 } | 114 } |
115 | 115 |
116 private: | 116 private: |
117 WebRTCPeerConnectionHandlerClient* client_; | 117 WebRTCPeerConnectionHandlerClient* client_; |
118 WebRTCPeerConnectionHandlerClient::ICEConnectionState connection_state_; | 118 WebRTCPeerConnectionHandlerClient::ICEConnectionState connection_state_; |
119 WebRTCPeerConnectionHandlerClient::ICEGatheringState gathering_state_; | 119 WebRTCPeerConnectionHandlerClient::ICEGatheringState gathering_state_; |
120 }; | 120 }; |
121 | 121 |
122 class RemoteDataChannelTask | 122 class RemoteDataChannelTask |
123 : public WebMethodTask<MockWebRTCPeerConnectionHandler> { | 123 : public WebMethodTask<MockWebRTCPeerConnectionHandler> { |
124 public: | 124 public: |
125 RemoteDataChannelTask(MockWebRTCPeerConnectionHandler* object, | 125 RemoteDataChannelTask(MockWebRTCPeerConnectionHandler* object, |
126 WebRTCPeerConnectionHandlerClient* client, | 126 WebRTCPeerConnectionHandlerClient* client, |
127 WebTestDelegate* delegate) | 127 WebTestDelegate* delegate) |
128 : WebMethodTask<MockWebRTCPeerConnectionHandler>(object), | 128 : WebMethodTask<MockWebRTCPeerConnectionHandler>(object), |
129 client_(client), | 129 client_(client), |
130 delegate_(delegate) {} | 130 delegate_(delegate) {} |
131 | 131 |
132 virtual void RunIfValid() OVERRIDE { | 132 virtual void RunIfValid() override { |
133 WebRTCDataChannelInit init; | 133 WebRTCDataChannelInit init; |
134 WebRTCDataChannelHandler* remote_data_channel = | 134 WebRTCDataChannelHandler* remote_data_channel = |
135 new MockWebRTCDataChannelHandler( | 135 new MockWebRTCDataChannelHandler( |
136 "MockRemoteDataChannel", init, delegate_); | 136 "MockRemoteDataChannel", init, delegate_); |
137 client_->didAddRemoteDataChannel(remote_data_channel); | 137 client_->didAddRemoteDataChannel(remote_data_channel); |
138 } | 138 } |
139 | 139 |
140 private: | 140 private: |
141 WebRTCPeerConnectionHandlerClient* client_; | 141 WebRTCPeerConnectionHandlerClient* client_; |
142 WebTestDelegate* delegate_; | 142 WebTestDelegate* delegate_; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 const WebMediaStreamTrack& track) { | 311 const WebMediaStreamTrack& track) { |
312 return new MockWebRTCDTMFSenderHandler(track, interfaces_->GetDelegate()); | 312 return new MockWebRTCDTMFSenderHandler(track, interfaces_->GetDelegate()); |
313 } | 313 } |
314 | 314 |
315 void MockWebRTCPeerConnectionHandler::stop() { | 315 void MockWebRTCPeerConnectionHandler::stop() { |
316 stopped_ = true; | 316 stopped_ = true; |
317 task_list_.RevokeAll(); | 317 task_list_.RevokeAll(); |
318 } | 318 } |
319 | 319 |
320 } // namespace content | 320 } // namespace content |
OLD | NEW |