| 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 "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // Typical constraints. | 23 // Typical constraints. |
| 24 static const char kAudioVideoCallConstraints[]; | 24 static const char kAudioVideoCallConstraints[]; |
| 25 static const char kAudioOnlyCallConstraints[]; | 25 static const char kAudioOnlyCallConstraints[]; |
| 26 static const char kVideoOnlyCallConstraints[]; | 26 static const char kVideoOnlyCallConstraints[]; |
| 27 | 27 |
| 28 static const char kFailedWithPermissionDeniedError[]; | 28 static const char kFailedWithPermissionDeniedError[]; |
| 29 | 29 |
| 30 WebRtcTestBase(); | 30 WebRtcTestBase(); |
| 31 virtual ~WebRtcTestBase(); | 31 virtual ~WebRtcTestBase(); |
| 32 | 32 |
| 33 // These all require that the loaded page fulfills the public interface in |
| 34 // chrome/test/data/webrtc/message_handling.js. |
| 33 void GetUserMediaAndAccept(content::WebContents* tab_contents) const; | 35 void GetUserMediaAndAccept(content::WebContents* tab_contents) const; |
| 34 void GetUserMediaWithSpecificConstraintsAndAccept( | 36 void GetUserMediaWithSpecificConstraintsAndAccept( |
| 35 content::WebContents* tab_contents, | 37 content::WebContents* tab_contents, |
| 36 const std::string& constraints) const; | 38 const std::string& constraints) const; |
| 37 void GetUserMediaAndDeny(content::WebContents* tab_contents); | 39 void GetUserMediaAndDeny(content::WebContents* tab_contents); |
| 38 void GetUserMediaWithSpecificConstraintsAndDeny( | 40 void GetUserMediaWithSpecificConstraintsAndDeny( |
| 39 content::WebContents* tab_contents, | 41 content::WebContents* tab_contents, |
| 40 const std::string& constraints) const; | 42 const std::string& constraints) const; |
| 41 void GetUserMediaAndDismiss(content::WebContents* tab_contents) const; | 43 void GetUserMediaAndDismiss(content::WebContents* tab_contents) const; |
| 42 void GetUserMedia(content::WebContents* tab_contents, | 44 void GetUserMedia(content::WebContents* tab_contents, |
| 43 const std::string& constraints) const; | 45 const std::string& constraints) const; |
| 44 | 46 |
| 47 // Convenience method which opens the page at url, calls GetUserMediaAndAccept |
| 48 // and returns the new tab. |
| 49 content::WebContents* OpenPageAndGetUserMediaInNewTab(const GURL& url) const; |
| 50 |
| 51 // Opens the page at |url| where getUserMedia has been invoked through other |
| 52 // means and accepts the user media request. |
| 45 content::WebContents* OpenPageAndAcceptUserMedia(const GURL& url) const; | 53 content::WebContents* OpenPageAndAcceptUserMedia(const GURL& url) const; |
| 46 | 54 |
| 47 void ConnectToPeerConnectionServer(const std::string& peer_name, | 55 void ConnectToPeerConnectionServer(const std::string& peer_name, |
| 48 content::WebContents* tab_contents) const; | 56 content::WebContents* tab_contents) const; |
| 49 std::string ExecuteJavascript(const std::string& javascript, | 57 std::string ExecuteJavascript(const std::string& javascript, |
| 50 content::WebContents* tab_contents) const; | 58 content::WebContents* tab_contents) const; |
| 51 | 59 |
| 52 // Call this to enable monitoring of javascript errors for this test method. | 60 // Call this to enable monitoring of javascript errors for this test method. |
| 53 // This will only work if the tests are run sequentially by the test runner | 61 // This will only work if the tests are run sequentially by the test runner |
| 54 // (i.e. with --test-launcher-developer-mode or --test-launcher-jobs=1). | 62 // (i.e. with --test-launcher-developer-mode or --test-launcher-jobs=1). |
| 55 void DetectErrorsInJavaScript(); | 63 void DetectErrorsInJavaScript(); |
| 56 | 64 |
| 57 private: | 65 private: |
| 58 void CloseInfoBarInTab(content::WebContents* tab_contents, | 66 void CloseInfoBarInTab(content::WebContents* tab_contents, |
| 59 InfoBar* infobar) const; | 67 InfoBar* infobar) const; |
| 60 InfoBar* GetUserMediaAndWaitForInfoBar(content::WebContents* tab_contents, | 68 InfoBar* GetUserMediaAndWaitForInfoBar(content::WebContents* tab_contents, |
| 61 const std::string& constraints) const; | 69 const std::string& constraints) const; |
| 62 | 70 |
| 63 bool detect_errors_in_javascript_; | 71 bool detect_errors_in_javascript_; |
| 64 | 72 |
| 65 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); | 73 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); |
| 66 }; | 74 }; |
| 67 | 75 |
| 68 #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_BASE_H_ | 76 #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_BASE_H_ |
| OLD | NEW |