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 20 matching lines...) Expand all Loading... |
31 static const char kVideoCallConstraintsVGA[]; | 31 static const char kVideoCallConstraintsVGA[]; |
32 static const char kVideoCallConstraints720p[]; | 32 static const char kVideoCallConstraints720p[]; |
33 static const char kVideoCallConstraints1080p[]; | 33 static const char kVideoCallConstraints1080p[]; |
34 static const char kAudioVideoCallConstraints360p[]; | 34 static const char kAudioVideoCallConstraints360p[]; |
35 static const char kAudioVideoCallConstraints720p[]; | 35 static const char kAudioVideoCallConstraints720p[]; |
36 | 36 |
37 static const char kOkGotStream[]; | 37 static const char kOkGotStream[]; |
38 static const char kFailedWithPermissionDeniedError[]; | 38 static const char kFailedWithPermissionDeniedError[]; |
39 static const char kFailedWithPermissionDismissedError[]; | 39 static const char kFailedWithPermissionDismissedError[]; |
40 | 40 |
| 41 enum ExpectedPromptBehaviour { |
| 42 IGNORE_PROMPT_BEHAVIOUR, |
| 43 EXPECT_PROMPT_SHOWN, |
| 44 EXPECT_PROMPT_NOT_SHOWN |
| 45 }; |
| 46 |
41 protected: | 47 protected: |
42 WebRtcTestBase(); | 48 WebRtcTestBase(); |
43 ~WebRtcTestBase() override; | 49 ~WebRtcTestBase() override; |
44 | 50 |
45 // These all require that the loaded page fulfills the public interface in | 51 // These all require that the loaded page fulfills the public interface in |
46 // chrome/test/data/webrtc/getusermedia.js. | 52 // chrome/test/data/webrtc/getusermedia.js. |
47 // If an error is reported back from the getUserMedia call, these functions | 53 // If an error is reported back from the getUserMedia call, these functions |
48 // will return false. | 54 // will return false. |
49 bool GetUserMediaAndAccept(content::WebContents* tab_contents) const; | 55 bool GetUserMediaAndAccept( |
| 56 content::WebContents* tab_contents, |
| 57 ExpectedPromptBehaviour expected_prompt_behaviour) const; |
50 bool GetUserMediaWithSpecificConstraintsAndAccept( | 58 bool GetUserMediaWithSpecificConstraintsAndAccept( |
51 content::WebContents* tab_contents, | 59 content::WebContents* tab_contents, |
52 const std::string& constraints) const; | 60 const std::string& constraints, |
53 void GetUserMediaAndDeny(content::WebContents* tab_contents); | 61 ExpectedPromptBehaviour expected_prompt_behaviour) const; |
| 62 void GetUserMediaAndDeny(content::WebContents* tab_contents, |
| 63 ExpectedPromptBehaviour expected_prompt_behaviour); |
54 void GetUserMediaWithSpecificConstraintsAndDeny( | 64 void GetUserMediaWithSpecificConstraintsAndDeny( |
55 content::WebContents* tab_contents, | 65 content::WebContents* tab_contents, |
56 const std::string& constraints) const; | 66 const std::string& constraints, |
57 void GetUserMediaAndDismiss(content::WebContents* tab_contents) const; | 67 ExpectedPromptBehaviour expected_prompt_behaviour) const; |
| 68 void GetUserMediaAndDismiss( |
| 69 content::WebContents* tab_contents, |
| 70 ExpectedPromptBehaviour expected_prompt_behaviour) const; |
58 void GetUserMedia(content::WebContents* tab_contents, | 71 void GetUserMedia(content::WebContents* tab_contents, |
59 const std::string& constraints) const; | 72 const std::string& constraints, |
| 73 ExpectedPromptBehaviour expected_prompt_behaviour) const; |
60 | 74 |
61 // Convenience method which opens the page at url, calls GetUserMediaAndAccept | 75 // Convenience method which opens the page at url, calls GetUserMediaAndAccept |
62 // and returns the new tab. | 76 // and returns the new tab. |
63 content::WebContents* OpenPageAndGetUserMediaInNewTab(const GURL& url) const; | 77 content::WebContents* OpenPageAndGetUserMediaInNewTab(const GURL& url) const; |
64 | 78 |
65 // Convenience method which opens the page at url, calls | 79 // Convenience method which opens the page at url, calls |
66 // GetUserMediaAndAcceptWithSpecificConstraints and returns the new tab. | 80 // GetUserMediaAndAcceptWithSpecificConstraints and returns the new tab. |
67 content::WebContents* OpenPageAndGetUserMediaInNewTabWithConstraints( | 81 content::WebContents* OpenPageAndGetUserMediaInNewTabWithConstraints( |
68 const GURL& url, const std::string& constraints) const; | 82 const GURL& url, const std::string& constraints) const; |
69 | 83 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 infobars::InfoBar* GetUserMediaAndWaitForInfoBar( | 152 infobars::InfoBar* GetUserMediaAndWaitForInfoBar( |
139 content::WebContents* tab_contents, | 153 content::WebContents* tab_contents, |
140 const std::string& constraints) const; | 154 const std::string& constraints) const; |
141 | 155 |
142 bool detect_errors_in_javascript_; | 156 bool detect_errors_in_javascript_; |
143 | 157 |
144 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); | 158 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); |
145 }; | 159 }; |
146 | 160 |
147 #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_BASE_H_ | 161 #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_BASE_H_ |
OLD | NEW |