OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_BROWSERTEST_BASE_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_BROWSERTEST_BASE_H_ |
6 #define CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_BROWSERTEST_BASE_H_ | 6 #define CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_BROWSERTEST_BASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 static const char kAudioVideoCallConstraints720p[]; | 40 static const char kAudioVideoCallConstraints720p[]; |
41 | 41 |
42 static const char kOkGotStream[]; | 42 static const char kOkGotStream[]; |
43 static const char kFailedWithPermissionDeniedError[]; | 43 static const char kFailedWithPermissionDeniedError[]; |
44 static const char kFailedWithPermissionDismissedError[]; | 44 static const char kFailedWithPermissionDismissedError[]; |
45 | 45 |
46 static const char kUseDefaultCertKeygen[]; | 46 static const char kUseDefaultCertKeygen[]; |
47 static const char kUseDefaultAudioCodec[]; | 47 static const char kUseDefaultAudioCodec[]; |
48 static const char kUseDefaultVideoCodec[]; | 48 static const char kUseDefaultVideoCodec[]; |
49 | 49 |
| 50 static const char kUndefined[]; |
| 51 |
| 52 enum class StreamArgumentType { |
| 53 NO_STREAM, |
| 54 SHARED_STREAM, |
| 55 INDIVIDUAL_STREAMS |
| 56 }; |
| 57 |
50 protected: | 58 protected: |
51 WebRtcTestBase(); | 59 WebRtcTestBase(); |
52 ~WebRtcTestBase() override; | 60 ~WebRtcTestBase() override; |
53 | 61 |
54 // These all require that the loaded page fulfills the public interface in | 62 // These all require that the loaded page fulfills the public interface in |
55 // chrome/test/data/webrtc/getusermedia.js. | 63 // chrome/test/data/webrtc/getusermedia.js. |
56 // If an error is reported back from the getUserMedia call, these functions | 64 // If an error is reported back from the getUserMedia call, these functions |
57 // will return false. | 65 // will return false. |
58 // The ...AndAccept()/...AndDeny()/...AndDismiss() functions expect that a | 66 // The ...AndAccept()/...AndDeny()/...AndDismiss() functions expect that a |
59 // prompt will be shown (i.e. the current origin in the tab_contents doesn't | 67 // prompt will be shown (i.e. the current origin in the tab_contents doesn't |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // Add 'usedtx=1' to the offer SDP. | 199 // Add 'usedtx=1' to the offer SDP. |
192 void EnableOpusDtx(content::WebContents* tab) const; | 200 void EnableOpusDtx(content::WebContents* tab) const; |
193 | 201 |
194 void CreateAndAddStreams(content::WebContents* tab, size_t count) const; | 202 void CreateAndAddStreams(content::WebContents* tab, size_t count) const; |
195 void VerifyRtpSenders(content::WebContents* tab, | 203 void VerifyRtpSenders(content::WebContents* tab, |
196 base::Optional<size_t> expected_num_tracks = | 204 base::Optional<size_t> expected_num_tracks = |
197 base::Optional<size_t>()) const; | 205 base::Optional<size_t>()) const; |
198 void VerifyRtpReceivers(content::WebContents* tab, | 206 void VerifyRtpReceivers(content::WebContents* tab, |
199 base::Optional<size_t> expected_num_tracks = | 207 base::Optional<size_t> expected_num_tracks = |
200 base::Optional<size_t>()) const; | 208 base::Optional<size_t>()) const; |
| 209 std::vector<std::string> CreateAndAddAudioAndVideoTrack( |
| 210 content::WebContents* tab, |
| 211 StreamArgumentType stream_argument_type) const; |
| 212 void RemoveTrack(content::WebContents* tab, |
| 213 const std::string& track_id) const; |
| 214 bool HasLocalStreamWithTrack(content::WebContents* tab, |
| 215 const std::string& stream_id, |
| 216 const std::string& track_id) const; |
| 217 bool HasRemoteStreamWithTrack(content::WebContents* tab, |
| 218 const std::string& stream_id, |
| 219 const std::string& track_id) const; |
| 220 bool HasSenderWithTrack(content::WebContents* tab, |
| 221 std::string track_id) const; |
| 222 bool HasReceiverWithTrack(content::WebContents* tab, |
| 223 std::string track_id) const; |
| 224 void StartCountingOnNegotiationNeeded(content::WebContents* tab) const; |
| 225 void WaitUntilOnNegotiationCountIs(content::WebContents* tab, |
| 226 size_t count) const; |
201 | 227 |
202 private: | 228 private: |
203 void CloseInfoBarInTab(content::WebContents* tab_contents, | 229 void CloseInfoBarInTab(content::WebContents* tab_contents, |
204 infobars::InfoBar* infobar) const; | 230 infobars::InfoBar* infobar) const; |
205 | 231 |
206 std::string CreateLocalOffer(content::WebContents* from_tab) const; | 232 std::string CreateLocalOffer(content::WebContents* from_tab) const; |
207 std::string CreateAnswer(std::string local_offer, | 233 std::string CreateAnswer(std::string local_offer, |
208 content::WebContents* to_tab) const; | 234 content::WebContents* to_tab) const; |
209 void ReceiveAnswer(const std::string& answer, | 235 void ReceiveAnswer(const std::string& answer, |
210 content::WebContents* from_tab) const; | 236 content::WebContents* from_tab) const; |
211 void GatherAndSendIceCandidates(content::WebContents* from_tab, | 237 void GatherAndSendIceCandidates(content::WebContents* from_tab, |
212 content::WebContents* to_tab) const; | 238 content::WebContents* to_tab) const; |
| 239 bool HasStreamWithTrack(content::WebContents* tab, |
| 240 const char* function_name, |
| 241 std::string stream_id, |
| 242 std::string track_id) const; |
213 | 243 |
214 infobars::InfoBar* GetUserMediaAndWaitForInfoBar( | 244 infobars::InfoBar* GetUserMediaAndWaitForInfoBar( |
215 content::WebContents* tab_contents, | 245 content::WebContents* tab_contents, |
216 const std::string& constraints) const; | 246 const std::string& constraints) const; |
217 | 247 |
218 bool detect_errors_in_javascript_; | 248 bool detect_errors_in_javascript_; |
219 | 249 |
220 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); | 250 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); |
221 }; | 251 }; |
222 | 252 |
223 #endif // CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_BROWSERTEST_BASE_H_ | 253 #endif // CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_BROWSERTEST_BASE_H_ |
OLD | NEW |