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 enum class StreamArgumentType { |
| 51 NO_STREAM, |
| 52 SHARED_STREAM, |
| 53 INDIVIDUAL_STREAMS |
| 54 }; |
| 55 |
50 protected: | 56 protected: |
51 WebRtcTestBase(); | 57 WebRtcTestBase(); |
52 ~WebRtcTestBase() override; | 58 ~WebRtcTestBase() override; |
53 | 59 |
54 // These all require that the loaded page fulfills the public interface in | 60 // These all require that the loaded page fulfills the public interface in |
55 // chrome/test/data/webrtc/getusermedia.js. | 61 // chrome/test/data/webrtc/getusermedia.js. |
56 // If an error is reported back from the getUserMedia call, these functions | 62 // If an error is reported back from the getUserMedia call, these functions |
57 // will return false. | 63 // will return false. |
58 // The ...AndAccept()/...AndDeny()/...AndDismiss() functions expect that a | 64 // The ...AndAccept()/...AndDeny()/...AndDismiss() functions expect that a |
59 // prompt will be shown (i.e. the current origin in the tab_contents doesn't | 65 // 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. | 197 // Add 'usedtx=1' to the offer SDP. |
192 void EnableOpusDtx(content::WebContents* tab) const; | 198 void EnableOpusDtx(content::WebContents* tab) const; |
193 | 199 |
194 void CreateAndAddStreams(content::WebContents* tab, size_t count) const; | 200 void CreateAndAddStreams(content::WebContents* tab, size_t count) const; |
195 void VerifyRtpSenders(content::WebContents* tab, | 201 void VerifyRtpSenders(content::WebContents* tab, |
196 base::Optional<size_t> expected_num_tracks = | 202 base::Optional<size_t> expected_num_tracks = |
197 base::Optional<size_t>()) const; | 203 base::Optional<size_t>()) const; |
198 void VerifyRtpReceivers(content::WebContents* tab, | 204 void VerifyRtpReceivers(content::WebContents* tab, |
199 base::Optional<size_t> expected_num_tracks = | 205 base::Optional<size_t> expected_num_tracks = |
200 base::Optional<size_t>()) const; | 206 base::Optional<size_t>()) const; |
| 207 std::vector<std::string> CreateAndAddAudioAndVideoTrack( |
| 208 content::WebContents* tab, |
| 209 StreamArgumentType stream_argument_type) const; |
| 210 void RemoveTrack(content::WebContents* tab, |
| 211 const std::string& track_id) const; |
201 | 212 |
202 private: | 213 private: |
203 void CloseInfoBarInTab(content::WebContents* tab_contents, | 214 void CloseInfoBarInTab(content::WebContents* tab_contents, |
204 infobars::InfoBar* infobar) const; | 215 infobars::InfoBar* infobar) const; |
205 | 216 |
206 std::string CreateLocalOffer(content::WebContents* from_tab) const; | 217 std::string CreateLocalOffer(content::WebContents* from_tab) const; |
207 std::string CreateAnswer(std::string local_offer, | 218 std::string CreateAnswer(std::string local_offer, |
208 content::WebContents* to_tab) const; | 219 content::WebContents* to_tab) const; |
209 void ReceiveAnswer(const std::string& answer, | 220 void ReceiveAnswer(const std::string& answer, |
210 content::WebContents* from_tab) const; | 221 content::WebContents* from_tab) const; |
211 void GatherAndSendIceCandidates(content::WebContents* from_tab, | 222 void GatherAndSendIceCandidates(content::WebContents* from_tab, |
212 content::WebContents* to_tab) const; | 223 content::WebContents* to_tab) const; |
213 | 224 |
214 infobars::InfoBar* GetUserMediaAndWaitForInfoBar( | 225 infobars::InfoBar* GetUserMediaAndWaitForInfoBar( |
215 content::WebContents* tab_contents, | 226 content::WebContents* tab_contents, |
216 const std::string& constraints) const; | 227 const std::string& constraints) const; |
217 | 228 |
218 bool detect_errors_in_javascript_; | 229 bool detect_errors_in_javascript_; |
219 | 230 |
220 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); | 231 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); |
221 }; | 232 }; |
222 | 233 |
223 #endif // CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_BROWSERTEST_BASE_H_ | 234 #endif // CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_BROWSERTEST_BASE_H_ |
OLD | NEW |