| 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" |
| 11 | 11 |
| 12 class InfoBar; |
| 13 |
| 12 namespace content { | 14 namespace content { |
| 13 class WebContents; | 15 class WebContents; |
| 14 } | 16 } |
| 15 | 17 |
| 16 class MediaStreamInfoBarDelegate; | |
| 17 | |
| 18 // Base class for WebRTC browser tests with useful primitives for interacting | 18 // Base class for WebRTC browser tests with useful primitives for interacting |
| 19 // getUserMedia. We use inheritance here because it makes the test code look | 19 // getUserMedia. We use inheritance here because it makes the test code look |
| 20 // as clean as it can be. | 20 // as clean as it can be. |
| 21 class WebRtcTestBase : public InProcessBrowserTest { | 21 class WebRtcTestBase : public InProcessBrowserTest { |
| 22 protected: | 22 protected: |
| 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 void GetUserMediaAndAccept(content::WebContents* tab_contents); | 33 void GetUserMediaAndAccept(content::WebContents* tab_contents); |
| 34 void GetUserMediaWithSpecificConstraintsAndAccept( | 34 void GetUserMediaWithSpecificConstraintsAndAccept( |
| 35 content::WebContents* tab_contents, | 35 content::WebContents* tab_contents, |
| 36 const std::string& constraints); | 36 const std::string& constraints); |
| 37 void GetUserMediaAndDeny(content::WebContents* tab_contents); | 37 void GetUserMediaAndDeny(content::WebContents* tab_contents); |
| 38 void GetUserMediaWithSpecificConstraintsAndDeny( | 38 void GetUserMediaWithSpecificConstraintsAndDeny( |
| 39 content::WebContents* tab_contents, | 39 content::WebContents* tab_contents, |
| 40 const std::string& constraints); | 40 const std::string& constraints); |
| 41 void GetUserMediaAndDismiss(content::WebContents* tab_contents); | 41 void GetUserMediaAndDismiss(content::WebContents* tab_contents); |
| 42 void GetUserMedia(content::WebContents* tab_contents, | 42 void GetUserMedia(content::WebContents* tab_contents, |
| 43 const std::string& constraints); | 43 const std::string& constraints); |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 MediaStreamInfoBarDelegate* GetUserMediaAndWaitForInfoBar( | 46 InfoBar* GetUserMediaAndWaitForInfoBar(content::WebContents* tab_contents, |
| 47 content::WebContents* tab_contents, | 47 const std::string& constraints); |
| 48 const std::string& constraints); | 48 void CloseInfoBarInTab(content::WebContents* tab_contents, InfoBar* infobar); |
| 49 void CloseInfoBarInTab(content::WebContents* tab_contents, | |
| 50 MediaStreamInfoBarDelegate* infobar); | |
| 51 | 49 |
| 52 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); | 50 DISALLOW_COPY_AND_ASSIGN(WebRtcTestBase); |
| 53 }; | 51 }; |
| 54 | 52 |
| 55 #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_BASE_H_ | 53 #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_BASE_H_ |
| OLD | NEW |