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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 static const char kUseDefaultVideoCodec[]; | 48 static const char kUseDefaultVideoCodec[]; |
49 | 49 |
50 static const char kUndefined[]; | 50 static const char kUndefined[]; |
51 | 51 |
52 enum class StreamArgumentType { | 52 enum class StreamArgumentType { |
53 NO_STREAM, | 53 NO_STREAM, |
54 SHARED_STREAM, | 54 SHARED_STREAM, |
55 INDIVIDUAL_STREAMS | 55 INDIVIDUAL_STREAMS |
56 }; | 56 }; |
57 | 57 |
| 58 struct TrackEvent { |
| 59 explicit TrackEvent(const std::string& track_id); |
| 60 TrackEvent(const TrackEvent&); |
| 61 ~TrackEvent(); |
| 62 |
| 63 std::string track_id; |
| 64 std::vector<std::string> stream_ids; |
| 65 }; |
| 66 |
58 protected: | 67 protected: |
59 WebRtcTestBase(); | 68 WebRtcTestBase(); |
60 ~WebRtcTestBase() override; | 69 ~WebRtcTestBase() override; |
61 | 70 |
62 // These all require that the loaded page fulfills the public interface in | 71 // These all require that the loaded page fulfills the public interface in |
63 // chrome/test/data/webrtc/getusermedia.js. | 72 // chrome/test/data/webrtc/getusermedia.js. |
64 // If an error is reported back from the getUserMedia call, these functions | 73 // If an error is reported back from the getUserMedia call, these functions |
65 // will return false. | 74 // will return false. |
66 // The ...AndAccept()/...AndDeny()/...AndDismiss() functions expect that a | 75 // The ...AndAccept()/...AndDeny()/...AndDismiss() functions expect that a |
67 // prompt will be shown (i.e. the current origin in the tab_contents doesn't | 76 // prompt will be shown (i.e. the current origin in the tab_contents doesn't |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 const std::string& stream_id, | 224 const std::string& stream_id, |
216 const std::string& track_id) const; | 225 const std::string& track_id) const; |
217 bool HasRemoteStreamWithTrack(content::WebContents* tab, | 226 bool HasRemoteStreamWithTrack(content::WebContents* tab, |
218 const std::string& stream_id, | 227 const std::string& stream_id, |
219 const std::string& track_id) const; | 228 const std::string& track_id) const; |
220 bool HasSenderWithTrack(content::WebContents* tab, | 229 bool HasSenderWithTrack(content::WebContents* tab, |
221 std::string track_id) const; | 230 std::string track_id) const; |
222 bool HasReceiverWithTrack(content::WebContents* tab, | 231 bool HasReceiverWithTrack(content::WebContents* tab, |
223 std::string track_id) const; | 232 std::string track_id) const; |
224 size_t GetNegotiationNeededCount(content::WebContents* tab) const; | 233 size_t GetNegotiationNeededCount(content::WebContents* tab) const; |
| 234 void SetupOnTrackListener(content::WebContents* tab) const; |
| 235 std::vector<TrackEvent> GetTrackEvents(content::WebContents* tab) const; |
225 | 236 |
226 private: | 237 private: |
227 void CloseInfoBarInTab(content::WebContents* tab_contents, | 238 void CloseInfoBarInTab(content::WebContents* tab_contents, |
228 infobars::InfoBar* infobar) const; | 239 infobars::InfoBar* infobar) const; |
229 | 240 |
230 std::string CreateLocalOffer(content::WebContents* from_tab) const; | 241 std::string CreateLocalOffer(content::WebContents* from_tab) const; |
231 std::string CreateAnswer(std::string local_offer, | 242 std::string CreateAnswer(std::string local_offer, |
232 content::WebContents* to_tab) const; | 243 content::WebContents* to_tab) const; |
233 void ReceiveAnswer(const std::string& answer, | 244 void ReceiveAnswer(const std::string& answer, |
234 content::WebContents* from_tab) const; | 245 content::WebContents* from_tab) const; |
235 void GatherAndSendIceCandidates(content::WebContents* from_tab, | 246 void GatherAndSendIceCandidates(content::WebContents* from_tab, |
236 content::WebContents* to_tab) const; | 247 content::WebContents* to_tab) const; |
237 bool HasStreamWithTrack(content::WebContents* tab, | 248 bool HasStreamWithTrack(content::WebContents* tab, |
238 const char* function_name, | 249 const char* function_name, |
239 std::string stream_id, | 250 std::string stream_id, |
240 std::string track_id) const; | 251 std::string track_id) const; |
241 | 252 |
242 infobars::InfoBar* GetUserMediaAndWaitForInfoBar( | 253 infobars::InfoBar* GetUserMediaAndWaitForInfoBar( |
243 content::WebContents* tab_contents, | 254 content::WebContents* tab_contents, |
244 const std::string& constraints) const; | 255 const std::string& constraints) const; |
245 | 256 |
246 bool detect_errors_in_javascript_; | 257 bool detect_errors_in_javascript_; |
247 | 258 |
248 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); | 259 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); |
249 }; | 260 }; |
250 | 261 |
251 #endif // CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_BROWSERTEST_BASE_H_ | 262 #endif // CHROME_BROWSER_MEDIA_WEBRTC_WEBRTC_BROWSERTEST_BASE_H_ |
OLD | NEW |