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" |
11 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
12 | 12 |
13 namespace infobars { | 13 namespace infobars { |
14 class InfoBar; | 14 class InfoBar; |
15 } | 15 } |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class WebContents; | 18 class WebContents; |
19 } | 19 } |
20 | 20 |
| 21 class JavascriptErrorDetectingListener : logging::LogMessageListener { |
| 22 public: |
| 23 void OnMessage(int severity, |
| 24 const char* file, |
| 25 int line, |
| 26 size_t message_start, |
| 27 const std::string& str) override; |
| 28 }; |
| 29 |
21 // Base class for WebRTC browser tests with useful primitives for interacting | 30 // Base class for WebRTC browser tests with useful primitives for interacting |
22 // getUserMedia. We use inheritance here because it makes the test code look | 31 // getUserMedia. We use inheritance here because it makes the test code look |
23 // as clean as it can be. | 32 // as clean as it can be. |
24 class WebRtcTestBase : public InProcessBrowserTest { | 33 class WebRtcTestBase : public InProcessBrowserTest { |
25 public: | 34 public: |
26 // Typical constraints. | 35 // Typical constraints. |
27 static const char kAudioVideoCallConstraints[]; | 36 static const char kAudioVideoCallConstraints[]; |
28 static const char kAudioOnlyCallConstraints[]; | 37 static const char kAudioOnlyCallConstraints[]; |
29 static const char kVideoOnlyCallConstraints[]; | 38 static const char kVideoOnlyCallConstraints[]; |
30 static const char kVideoCallConstraintsQVGA[]; | 39 static const char kVideoCallConstraintsQVGA[]; |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 std::string default_video_codec = kUseDefaultVideoCodec) const; | 190 std::string default_video_codec = kUseDefaultVideoCodec) const; |
182 void ReceiveAnswer(const std::string& answer, | 191 void ReceiveAnswer(const std::string& answer, |
183 content::WebContents* from_tab) const; | 192 content::WebContents* from_tab) const; |
184 void GatherAndSendIceCandidates(content::WebContents* from_tab, | 193 void GatherAndSendIceCandidates(content::WebContents* from_tab, |
185 content::WebContents* to_tab) const; | 194 content::WebContents* to_tab) const; |
186 | 195 |
187 infobars::InfoBar* GetUserMediaAndWaitForInfoBar( | 196 infobars::InfoBar* GetUserMediaAndWaitForInfoBar( |
188 content::WebContents* tab_contents, | 197 content::WebContents* tab_contents, |
189 const std::string& constraints) const; | 198 const std::string& constraints) const; |
190 | 199 |
| 200 JavascriptErrorDetectingListener log_listener_; |
191 bool detect_errors_in_javascript_; | 201 bool detect_errors_in_javascript_; |
192 | 202 |
193 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); | 203 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); |
194 }; | 204 }; |
195 | 205 |
196 #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_BASE_H_ | 206 #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_BASE_H_ |
OLD | NEW |