| 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_BROWSERTEST_BASE_H_ | 5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_BASE_H_ |
| 6 #define CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_BASE_H_ | 6 #define CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_BASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 static const char kVideoCallConstraintsVGA[]; | 32 static const char kVideoCallConstraintsVGA[]; |
| 33 static const char kVideoCallConstraints720p[]; | 33 static const char kVideoCallConstraints720p[]; |
| 34 static const char kVideoCallConstraints1080p[]; | 34 static const char kVideoCallConstraints1080p[]; |
| 35 static const char kAudioVideoCallConstraints360p[]; | 35 static const char kAudioVideoCallConstraints360p[]; |
| 36 static const char kAudioVideoCallConstraints720p[]; | 36 static const char kAudioVideoCallConstraints720p[]; |
| 37 | 37 |
| 38 static const char kOkGotStream[]; | 38 static const char kOkGotStream[]; |
| 39 static const char kFailedWithPermissionDeniedError[]; | 39 static const char kFailedWithPermissionDeniedError[]; |
| 40 static const char kFailedWithPermissionDismissedError[]; | 40 static const char kFailedWithPermissionDismissedError[]; |
| 41 | 41 |
| 42 static const char kUseDefaultCertKeygen[]; |
| 43 static const char kUseDefaultVideoCodec[]; |
| 44 |
| 42 protected: | 45 protected: |
| 43 WebRtcTestBase(); | 46 WebRtcTestBase(); |
| 44 ~WebRtcTestBase() override; | 47 ~WebRtcTestBase() override; |
| 45 | 48 |
| 46 // These all require that the loaded page fulfills the public interface in | 49 // These all require that the loaded page fulfills the public interface in |
| 47 // chrome/test/data/webrtc/getusermedia.js. | 50 // chrome/test/data/webrtc/getusermedia.js. |
| 48 // If an error is reported back from the getUserMedia call, these functions | 51 // If an error is reported back from the getUserMedia call, these functions |
| 49 // will return false. | 52 // will return false. |
| 50 // The ...AndAccept()/...AndDeny()/...AndDismiss() functions expect that a | 53 // The ...AndAccept()/...AndDeny()/...AndDismiss() functions expect that a |
| 51 // prompt will be shown (i.e. the current origin in the tab_contents doesn't | 54 // prompt will be shown (i.e. the current origin in the tab_contents doesn't |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 content::WebContents* OpenPageAndAcceptUserMedia(const GURL& url) const; | 91 content::WebContents* OpenPageAndAcceptUserMedia(const GURL& url) const; |
| 89 | 92 |
| 90 // Closes the last local stream acquired by the GetUserMedia* methods. | 93 // Closes the last local stream acquired by the GetUserMedia* methods. |
| 91 void CloseLastLocalStream(content::WebContents* tab_contents) const; | 94 void CloseLastLocalStream(content::WebContents* tab_contents) const; |
| 92 | 95 |
| 93 std::string ExecuteJavascript(const std::string& javascript, | 96 std::string ExecuteJavascript(const std::string& javascript, |
| 94 content::WebContents* tab_contents) const; | 97 content::WebContents* tab_contents) const; |
| 95 | 98 |
| 96 // Sets up a peer connection in the tab and adds the current local stream | 99 // Sets up a peer connection in the tab and adds the current local stream |
| 97 // (which you can prepare by calling one of the GetUserMedia* methods above). | 100 // (which you can prepare by calling one of the GetUserMedia* methods above). |
| 98 void SetupPeerconnectionWithLocalStream(content::WebContents* tab) const; | 101 // Optionally, |certificate_keygen_algorithm| is JavaScript for an |
| 102 // |AlgorithmIdentifier| to be used as parameter to |
| 103 // |RTCPeerConnection.generateCertificate|. The resulting certificate will be |
| 104 // used by the peer connection. Or use |kUseDefaultCertKeygen| to use a |
| 105 // certificate. |
| 106 void SetupPeerconnectionWithLocalStream( |
| 107 content::WebContents* tab, |
| 108 std::string certificate_keygen_algorithm = kUseDefaultCertKeygen) const; |
| 99 | 109 |
| 100 // Same as above but does not add the local stream. | 110 // Same as above but does not add the local stream. |
| 101 void SetupPeerconnectionWithoutLocalStream(content::WebContents* tab) const; | 111 void SetupPeerconnectionWithoutLocalStream( |
| 112 content::WebContents* tab, |
| 113 std::string certificate_keygen_algorithm = kUseDefaultCertKeygen) const; |
| 102 | 114 |
| 103 // Exchanges offers and answers between the peer connections in the | 115 // Exchanges offers and answers between the peer connections in the |
| 104 // respective tabs. Before calling this, you must have prepared peer | 116 // respective tabs. Before calling this, you must have prepared peer |
| 105 // connections in both tabs and configured them as you like (for instance by | 117 // connections in both tabs and configured them as you like (for instance by |
| 106 // calling SetupPeerconnectionWithLocalStream). | 118 // calling SetupPeerconnectionWithLocalStream). |
| 107 // If |video_codec| is a non-empty string, the SDP offer is modified (and SDP | 119 // If |video_codec| is not |kUseDefaultVideoCodec|, the SDP offer is modified |
| 108 // answer verified) so that the specified video codec (case-sensitive name) is | 120 // (and SDP answer verified) so that the specified video codec (case-sensitive |
| 109 // used during the call instead of the default one. | 121 // name) is used during the call instead of the default one. |
| 110 void NegotiateCall(content::WebContents* from_tab, | 122 void NegotiateCall( |
| 111 content::WebContents* to_tab, | 123 content::WebContents* from_tab, |
| 112 const std::string& video_codec = "") const; | 124 content::WebContents* to_tab, |
| 125 const std::string& video_codec = kUseDefaultVideoCodec) const; |
| 113 | 126 |
| 114 // Hangs up a negotiated call. | 127 // Hangs up a negotiated call. |
| 115 void HangUp(content::WebContents* from_tab) const; | 128 void HangUp(content::WebContents* from_tab) const; |
| 116 | 129 |
| 117 // Call this to enable monitoring of javascript errors for this test method. | 130 // Call this to enable monitoring of javascript errors for this test method. |
| 118 // This will only work if the tests are run sequentially by the test runner | 131 // This will only work if the tests are run sequentially by the test runner |
| 119 // (i.e. with --test-launcher-developer-mode or --test-launcher-jobs=1). | 132 // (i.e. with --test-launcher-developer-mode or --test-launcher-jobs=1). |
| 120 void DetectErrorsInJavaScript(); | 133 void DetectErrorsInJavaScript(); |
| 121 | 134 |
| 122 // Methods for detecting if video is playing (the loaded page must have | 135 // Methods for detecting if video is playing (the loaded page must have |
| (...skipping 13 matching lines...) Expand all Loading... |
| 136 // Returns true if we're on WinXP, that lovely operating system of bliss. | 149 // Returns true if we're on WinXP, that lovely operating system of bliss. |
| 137 bool OnWinXp() const; | 150 bool OnWinXp() const; |
| 138 | 151 |
| 139 // Returns true if we're on win 8. | 152 // Returns true if we're on win 8. |
| 140 bool OnWin8() const; | 153 bool OnWin8() const; |
| 141 | 154 |
| 142 private: | 155 private: |
| 143 void CloseInfoBarInTab(content::WebContents* tab_contents, | 156 void CloseInfoBarInTab(content::WebContents* tab_contents, |
| 144 infobars::InfoBar* infobar) const; | 157 infobars::InfoBar* infobar) const; |
| 145 | 158 |
| 146 std::string CreateLocalOffer(content::WebContents* from_tab, | 159 std::string CreateLocalOffer( |
| 147 std::string default_video_codec = "") const; | 160 content::WebContents* from_tab, |
| 148 std::string CreateAnswer(std::string local_offer, | 161 std::string default_video_codec = kUseDefaultVideoCodec) const; |
| 149 content::WebContents* to_tab, | 162 std::string CreateAnswer( |
| 150 std::string default_video_codec = "") const; | 163 std::string local_offer, |
| 164 content::WebContents* to_tab, |
| 165 std::string default_video_codec = kUseDefaultVideoCodec) const; |
| 151 void ReceiveAnswer(const std::string& answer, | 166 void ReceiveAnswer(const std::string& answer, |
| 152 content::WebContents* from_tab) const; | 167 content::WebContents* from_tab) const; |
| 153 void GatherAndSendIceCandidates(content::WebContents* from_tab, | 168 void GatherAndSendIceCandidates(content::WebContents* from_tab, |
| 154 content::WebContents* to_tab) const; | 169 content::WebContents* to_tab) const; |
| 155 | 170 |
| 156 infobars::InfoBar* GetUserMediaAndWaitForInfoBar( | 171 infobars::InfoBar* GetUserMediaAndWaitForInfoBar( |
| 157 content::WebContents* tab_contents, | 172 content::WebContents* tab_contents, |
| 158 const std::string& constraints) const; | 173 const std::string& constraints) const; |
| 159 | 174 |
| 160 bool detect_errors_in_javascript_; | 175 bool detect_errors_in_javascript_; |
| 161 | 176 |
| 162 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); | 177 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); |
| 163 }; | 178 }; |
| 164 | 179 |
| 165 #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_BASE_H_ | 180 #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_BASE_H_ |
| OLD | NEW |