| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/json/json_reader.h" | 6 #include "base/json/json_reader.h" |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "chrome/browser/media/webrtc_browsertest_base.h" | 8 #include "chrome/browser/media/webrtc_browsertest_base.h" |
| 9 #include "chrome/browser/media/webrtc_browsertest_common.h" | 9 #include "chrome/browser/media/webrtc_browsertest_common.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 bool has_audio_output_devices_initialized_; | 175 bool has_audio_output_devices_initialized_; |
| 176 bool has_audio_output_devices_; | 176 bool has_audio_output_devices_; |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 static const bool kParamsToRunTestsWith[] = { false, true }; | 179 static const bool kParamsToRunTestsWith[] = { false, true }; |
| 180 INSTANTIATE_TEST_CASE_P(WebRtcGetMediaDevicesBrowserTests, | 180 INSTANTIATE_TEST_CASE_P(WebRtcGetMediaDevicesBrowserTests, |
| 181 WebRtcGetMediaDevicesBrowserTest, | 181 WebRtcGetMediaDevicesBrowserTest, |
| 182 testing::ValuesIn(kParamsToRunTestsWith)); | 182 testing::ValuesIn(kParamsToRunTestsWith)); |
| 183 | 183 |
| 184 // getMediaDevices has been removed and will be replaced |
| 185 // MediaDevices.enumerateDevices. http://crbug.com/388648. |
| 184 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, | 186 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, |
| 185 GetMediaDevicesWithoutAccess) { | 187 DISABLED_GetMediaDevicesWithoutAccess) { |
| 186 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 188 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 187 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 189 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 188 ui_test_utils::NavigateToURL(browser(), url); | 190 ui_test_utils::NavigateToURL(browser(), url); |
| 189 content::WebContents* tab = | 191 content::WebContents* tab = |
| 190 browser()->tab_strip_model()->GetActiveWebContents(); | 192 browser()->tab_strip_model()->GetActiveWebContents(); |
| 191 | 193 |
| 192 std::vector<MediaDeviceInfo> devices; | 194 std::vector<MediaDeviceInfo> devices; |
| 193 GetMediaDevices(tab, &devices); | 195 GetMediaDevices(tab, &devices); |
| 194 | 196 |
| 195 // Labels should be empty if access has not been allowed. | 197 // Labels should be empty if access has not been allowed. |
| 196 for (std::vector<MediaDeviceInfo>::iterator it = devices.begin(); | 198 for (std::vector<MediaDeviceInfo>::iterator it = devices.begin(); |
| 197 it != devices.end(); ++it) { | 199 it != devices.end(); ++it) { |
| 198 EXPECT_TRUE(it->label.empty()); | 200 EXPECT_TRUE(it->label.empty()); |
| 199 } | 201 } |
| 200 } | 202 } |
| 201 | 203 |
| 204 // getMediaDevices has been removed and will be replaced |
| 205 // MediaDevices.enumerateDevices. http://crbug.com/388648. |
| 202 // Disabled, fails due to http://crbug.com/382391. | 206 // Disabled, fails due to http://crbug.com/382391. |
| 203 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, | 207 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, |
| 204 DISABLED_GetMediaDevicesWithAccess) { | 208 DISABLED_GetMediaDevicesWithAccess) { |
| 205 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 209 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 206 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 210 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 207 ui_test_utils::NavigateToURL(browser(), url); | 211 ui_test_utils::NavigateToURL(browser(), url); |
| 208 content::WebContents* tab = | 212 content::WebContents* tab = |
| 209 browser()->tab_strip_model()->GetActiveWebContents(); | 213 browser()->tab_strip_model()->GetActiveWebContents(); |
| 210 | 214 |
| 211 GetUserMediaAndAccept(tab); | 215 GetUserMediaAndAccept(tab); |
| 212 | 216 |
| 213 std::vector<MediaDeviceInfo> devices; | 217 std::vector<MediaDeviceInfo> devices; |
| 214 GetMediaDevices(tab, &devices); | 218 GetMediaDevices(tab, &devices); |
| 215 | 219 |
| 216 // Labels should be non-empty if access has been allowed. | 220 // Labels should be non-empty if access has been allowed. |
| 217 for (std::vector<MediaDeviceInfo>::iterator it = devices.begin(); | 221 for (std::vector<MediaDeviceInfo>::iterator it = devices.begin(); |
| 218 it != devices.end(); ++it) { | 222 it != devices.end(); ++it) { |
| 219 EXPECT_TRUE(!it->label.empty()); | 223 EXPECT_TRUE(!it->label.empty()); |
| 220 } | 224 } |
| 221 } | 225 } |
| 222 | 226 |
| 227 // getMediaDevices has been removed and will be replaced |
| 228 // MediaDevices.enumerateDevices. http://crbug.com/388648. |
| 223 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, | 229 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, |
| 224 GetMediaDevicesEqualsGetSourcesWithoutAccess) { | 230 DISABLED_GetMediaDevicesEqualsGetSourcesWithoutAccess) { |
| 225 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 231 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 226 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 232 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 227 ui_test_utils::NavigateToURL(browser(), url); | 233 ui_test_utils::NavigateToURL(browser(), url); |
| 228 content::WebContents* tab = | 234 content::WebContents* tab = |
| 229 browser()->tab_strip_model()->GetActiveWebContents(); | 235 browser()->tab_strip_model()->GetActiveWebContents(); |
| 230 | 236 |
| 231 std::vector<MediaDeviceInfo> devices; | 237 std::vector<MediaDeviceInfo> devices; |
| 232 GetMediaDevices(tab, &devices); | 238 GetMediaDevices(tab, &devices); |
| 233 | 239 |
| 234 std::vector<MediaDeviceInfo> sources; | 240 std::vector<MediaDeviceInfo> sources; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 245 } else { | 251 } else { |
| 246 EXPECT_STREQ(kSourceKindVideoInput, sources_it->kind.c_str()); | 252 EXPECT_STREQ(kSourceKindVideoInput, sources_it->kind.c_str()); |
| 247 } | 253 } |
| 248 EXPECT_TRUE(devices_it->label.empty()); | 254 EXPECT_TRUE(devices_it->label.empty()); |
| 249 EXPECT_TRUE(sources_it->label.empty()); | 255 EXPECT_TRUE(sources_it->label.empty()); |
| 250 ++sources_it; | 256 ++sources_it; |
| 251 } | 257 } |
| 252 EXPECT_EQ(sources.end(), sources_it); | 258 EXPECT_EQ(sources.end(), sources_it); |
| 253 } | 259 } |
| 254 | 260 |
| 261 // getMediaDevices has been removed and will be replaced |
| 262 // MediaDevices.enumerateDevices. http://crbug.com/388648. |
| 255 // Disabled, fails due to http://crbug.com/382391. | 263 // Disabled, fails due to http://crbug.com/382391. |
| 256 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, | 264 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, |
| 257 DISABLED_GetMediaDevicesEqualsGetSourcesWithAccess) { | 265 DISABLED_GetMediaDevicesEqualsGetSourcesWithAccess) { |
| 258 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 266 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 259 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 267 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 260 ui_test_utils::NavigateToURL(browser(), url); | 268 ui_test_utils::NavigateToURL(browser(), url); |
| 261 content::WebContents* tab = | 269 content::WebContents* tab = |
| 262 browser()->tab_strip_model()->GetActiveWebContents(); | 270 browser()->tab_strip_model()->GetActiveWebContents(); |
| 263 | 271 |
| 264 GetUserMediaAndAccept(tab); | 272 GetUserMediaAndAccept(tab); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 279 EXPECT_STREQ(kSourceKindAudioInput, sources_it->kind.c_str()); | 287 EXPECT_STREQ(kSourceKindAudioInput, sources_it->kind.c_str()); |
| 280 } else { | 288 } else { |
| 281 EXPECT_STREQ(kSourceKindVideoInput, sources_it->kind.c_str()); | 289 EXPECT_STREQ(kSourceKindVideoInput, sources_it->kind.c_str()); |
| 282 } | 290 } |
| 283 EXPECT_TRUE(!devices_it->label.empty()); | 291 EXPECT_TRUE(!devices_it->label.empty()); |
| 284 EXPECT_STREQ(devices_it->label.c_str(), sources_it->label.c_str()); | 292 EXPECT_STREQ(devices_it->label.c_str(), sources_it->label.c_str()); |
| 285 ++sources_it; | 293 ++sources_it; |
| 286 } | 294 } |
| 287 EXPECT_EQ(sources.end(), sources_it); | 295 EXPECT_EQ(sources.end(), sources_it); |
| 288 } | 296 } |
| OLD | NEW |