| 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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "chrome/browser/media/media_stream_devices_controller.h" | 10 #include "chrome/browser/media/media_stream_devices_controller.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 | 30 |
| 31 // MediaStreamInfoBarTest ----------------------------------------------------- | 31 // MediaStreamInfoBarTest ----------------------------------------------------- |
| 32 | 32 |
| 33 class MediaStreamInfoBarTest : public WebRtcTestBase { | 33 class MediaStreamInfoBarTest : public WebRtcTestBase { |
| 34 public: | 34 public: |
| 35 MediaStreamInfoBarTest() {} | 35 MediaStreamInfoBarTest() {} |
| 36 ~MediaStreamInfoBarTest() override {} | 36 ~MediaStreamInfoBarTest() override {} |
| 37 | 37 |
| 38 // InProcessBrowserTest: | 38 // InProcessBrowserTest: |
| 39 void SetUpCommandLine(CommandLine* command_line) override { | 39 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 40 // This test expects to run with fake devices but real UI. | 40 // This test expects to run with fake devices but real UI. |
| 41 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 41 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
| 42 EXPECT_FALSE(command_line->HasSwitch(switches::kUseFakeUIForMediaStream)) | 42 EXPECT_FALSE(command_line->HasSwitch(switches::kUseFakeUIForMediaStream)) |
| 43 << "Since this test tests the UI we want the real UI!"; | 43 << "Since this test tests the UI we want the real UI!"; |
| 44 } | 44 } |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 content::WebContents* LoadTestPageInTab() { | 47 content::WebContents* LoadTestPageInTab() { |
| 48 return LoadTestPageInBrowser(browser()); | 48 return LoadTestPageInBrowser(browser()); |
| 49 } | 49 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 IN_PROC_BROWSER_TEST_F(MediaStreamInfoBarTest, TestDenyingUserMediaIncognito) { | 122 IN_PROC_BROWSER_TEST_F(MediaStreamInfoBarTest, TestDenyingUserMediaIncognito) { |
| 123 content::WebContents* tab_contents = LoadTestPageInIncognitoTab(); | 123 content::WebContents* tab_contents = LoadTestPageInIncognitoTab(); |
| 124 GetUserMediaAndDeny(tab_contents); | 124 GetUserMediaAndDeny(tab_contents); |
| 125 } | 125 } |
| 126 | 126 |
| 127 IN_PROC_BROWSER_TEST_F(MediaStreamInfoBarTest, | 127 IN_PROC_BROWSER_TEST_F(MediaStreamInfoBarTest, |
| 128 TestAcceptThenDenyWhichShouldBeSticky) { | 128 TestAcceptThenDenyWhichShouldBeSticky) { |
| 129 #if defined(OS_WIN) && defined(USE_ASH) | 129 #if defined(OS_WIN) && defined(USE_ASH) |
| 130 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 130 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 131 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 131 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 132 switches::kAshBrowserTests)) |
| 132 return; | 133 return; |
| 133 #endif | 134 #endif |
| 134 | 135 |
| 135 content::WebContents* tab_contents = LoadTestPageInTab(); | 136 content::WebContents* tab_contents = LoadTestPageInTab(); |
| 136 | 137 |
| 137 GetUserMediaAndAccept(tab_contents); | 138 GetUserMediaAndAccept(tab_contents); |
| 138 GetUserMediaAndDeny(tab_contents); | 139 GetUserMediaAndDeny(tab_contents); |
| 139 | 140 |
| 140 // Should fail with permission denied right away with no infobar popping up. | 141 // Should fail with permission denied right away with no infobar popping up. |
| 141 GetUserMedia(tab_contents, kAudioVideoCallConstraints); | 142 GetUserMedia(tab_contents, kAudioVideoCallConstraints); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 IN_PROC_BROWSER_TEST_F(MediaStreamInfoBarTest, | 205 IN_PROC_BROWSER_TEST_F(MediaStreamInfoBarTest, |
| 205 DenyingCameraDoesNotCauseStickyDenyForMics) { | 206 DenyingCameraDoesNotCauseStickyDenyForMics) { |
| 206 content::WebContents* tab_contents = LoadTestPageInTab(); | 207 content::WebContents* tab_contents = LoadTestPageInTab(); |
| 207 | 208 |
| 208 // If camera blocking also blocked mics, the second call here would hang. | 209 // If camera blocking also blocked mics, the second call here would hang. |
| 209 GetUserMediaWithSpecificConstraintsAndDeny(tab_contents, | 210 GetUserMediaWithSpecificConstraintsAndDeny(tab_contents, |
| 210 kVideoOnlyCallConstraints); | 211 kVideoOnlyCallConstraints); |
| 211 GetUserMediaWithSpecificConstraintsAndAccept(tab_contents, | 212 GetUserMediaWithSpecificConstraintsAndAccept(tab_contents, |
| 212 kAudioOnlyCallConstraints); | 213 kAudioOnlyCallConstraints); |
| 213 } | 214 } |
| OLD | NEW |