| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 // 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 |
| 100 // (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). |
| 101 // Optionally, |certificate_keygen_algorithm| is JavaScript for an | 101 // Optionally, |certificate_keygen_algorithm| is JavaScript for an |
| 102 // |AlgorithmIdentifier| to be used as parameter to | 102 // |AlgorithmIdentifier| to be used as parameter to |
| 103 // |RTCPeerConnection.generateCertificate|. The resulting certificate will be | 103 // |RTCPeerConnection.generateCertificate|. The resulting certificate will be |
| 104 // used by the peer connection. Or use |kUseDefaultCertKeygen| to use a | 104 // used by the peer connection. Or use |kUseDefaultCertKeygen| to use a |
| 105 // certificate. | 105 // certificate. |
| 106 void SetupPeerconnectionWithLocalStream( | 106 void SetupPeerconnectionWithLocalStream( |
| 107 content::WebContents* tab, | 107 content::WebContents* tab, |
| 108 std::string certificate_keygen_algorithm = kUseDefaultCertKeygen) const; | 108 const std::string& certificate_keygen_algorithm = |
| 109 | 109 kUseDefaultCertKeygen) const; |
| 110 // Same as above but does not add the local stream. | 110 // Same as above but does not add the local stream. |
| 111 void SetupPeerconnectionWithoutLocalStream( | 111 void SetupPeerconnectionWithoutLocalStream( |
| 112 content::WebContents* tab, | 112 content::WebContents* tab, |
| 113 std::string certificate_keygen_algorithm = kUseDefaultCertKeygen) const; | 113 const std::string& certificate_keygen_algorithm = |
| 114 kUseDefaultCertKeygen) const; |
| 115 // Same as |SetupPeerconnectionWithLocalStream| except a certificate is |
| 116 // specified, which is a reference to an |RTCCertificate| object. |
| 117 void SetupPeerconnectionWithCertificateAndLocalStream( |
| 118 content::WebContents* tab, |
| 119 const std::string& certificate) const; |
| 120 // Same as above but does not add the local stream. |
| 121 void SetupPeerconnectionWithCertificateWithoutLocalStream( |
| 122 content::WebContents* tab, |
| 123 const std::string& certificate) const; |
| 114 | 124 |
| 115 // Exchanges offers and answers between the peer connections in the | 125 // Exchanges offers and answers between the peer connections in the |
| 116 // respective tabs. Before calling this, you must have prepared peer | 126 // respective tabs. Before calling this, you must have prepared peer |
| 117 // connections in both tabs and configured them as you like (for instance by | 127 // connections in both tabs and configured them as you like (for instance by |
| 118 // calling SetupPeerconnectionWithLocalStream). | 128 // calling SetupPeerconnectionWithLocalStream). |
| 119 // If |video_codec| is not |kUseDefaultVideoCodec|, the SDP offer is modified | 129 // If |video_codec| is not |kUseDefaultVideoCodec|, the SDP offer is modified |
| 120 // (and SDP answer verified) so that the specified video codec (case-sensitive | 130 // (and SDP answer verified) so that the specified video codec (case-sensitive |
| 121 // name) is used during the call instead of the default one. | 131 // name) is used during the call instead of the default one. |
| 122 void NegotiateCall( | 132 void NegotiateCall( |
| 123 content::WebContents* from_tab, | 133 content::WebContents* from_tab, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 145 | 155 |
| 146 // Methods to check what devices we have on the system. | 156 // Methods to check what devices we have on the system. |
| 147 bool HasWebcamAvailableOnSystem(content::WebContents* tab_contents) const; | 157 bool HasWebcamAvailableOnSystem(content::WebContents* tab_contents) const; |
| 148 | 158 |
| 149 // Returns true if we're on WinXP, that lovely operating system of bliss. | 159 // Returns true if we're on WinXP, that lovely operating system of bliss. |
| 150 bool OnWinXp() const; | 160 bool OnWinXp() const; |
| 151 | 161 |
| 152 // Returns true if we're on win 8. | 162 // Returns true if we're on win 8. |
| 153 bool OnWin8() const; | 163 bool OnWin8() const; |
| 154 | 164 |
| 165 void OpenDatabase(content::WebContents* tab) const; |
| 166 void CloseDatabase(content::WebContents* tab) const; |
| 167 void DeleteDatabase(content::WebContents* tab) const; |
| 168 |
| 169 void GenerateAndCloneCertificate(content::WebContents* tab, |
| 170 const std::string& keygen_algorithm) const; |
| 171 |
| 155 private: | 172 private: |
| 156 void CloseInfoBarInTab(content::WebContents* tab_contents, | 173 void CloseInfoBarInTab(content::WebContents* tab_contents, |
| 157 infobars::InfoBar* infobar) const; | 174 infobars::InfoBar* infobar) const; |
| 158 | 175 |
| 159 std::string CreateLocalOffer( | 176 std::string CreateLocalOffer( |
| 160 content::WebContents* from_tab, | 177 content::WebContents* from_tab, |
| 161 std::string default_video_codec = kUseDefaultVideoCodec) const; | 178 std::string default_video_codec = kUseDefaultVideoCodec) const; |
| 162 std::string CreateAnswer( | 179 std::string CreateAnswer( |
| 163 std::string local_offer, | 180 std::string local_offer, |
| 164 content::WebContents* to_tab, | 181 content::WebContents* to_tab, |
| 165 std::string default_video_codec = kUseDefaultVideoCodec) const; | 182 std::string default_video_codec = kUseDefaultVideoCodec) const; |
| 166 void ReceiveAnswer(const std::string& answer, | 183 void ReceiveAnswer(const std::string& answer, |
| 167 content::WebContents* from_tab) const; | 184 content::WebContents* from_tab) const; |
| 168 void GatherAndSendIceCandidates(content::WebContents* from_tab, | 185 void GatherAndSendIceCandidates(content::WebContents* from_tab, |
| 169 content::WebContents* to_tab) const; | 186 content::WebContents* to_tab) const; |
| 170 | 187 |
| 171 infobars::InfoBar* GetUserMediaAndWaitForInfoBar( | 188 infobars::InfoBar* GetUserMediaAndWaitForInfoBar( |
| 172 content::WebContents* tab_contents, | 189 content::WebContents* tab_contents, |
| 173 const std::string& constraints) const; | 190 const std::string& constraints) const; |
| 174 | 191 |
| 175 bool detect_errors_in_javascript_; | 192 bool detect_errors_in_javascript_; |
| 176 | 193 |
| 177 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); | 194 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); |
| 178 }; | 195 }; |
| 179 | 196 |
| 180 #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_BASE_H_ | 197 #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_BASE_H_ |
| OLD | NEW |