| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // MediaDevices.enumerateDevices. http://crbug.com/388648. | 205 // MediaDevices.enumerateDevices. http://crbug.com/388648. |
| 206 // Disabled, fails due to http://crbug.com/382391. | 206 // Disabled, fails due to http://crbug.com/382391. |
| 207 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, | 207 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, |
| 208 DISABLED_GetMediaDevicesWithAccess) { | 208 DISABLED_GetMediaDevicesWithAccess) { |
| 209 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 209 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 210 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 210 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 211 ui_test_utils::NavigateToURL(browser(), url); | 211 ui_test_utils::NavigateToURL(browser(), url); |
| 212 content::WebContents* tab = | 212 content::WebContents* tab = |
| 213 browser()->tab_strip_model()->GetActiveWebContents(); | 213 browser()->tab_strip_model()->GetActiveWebContents(); |
| 214 | 214 |
| 215 GetUserMediaAndAccept(tab); | 215 EXPECT_TRUE(GetUserMediaAndAccept(tab)); |
| 216 | 216 |
| 217 std::vector<MediaDeviceInfo> devices; | 217 std::vector<MediaDeviceInfo> devices; |
| 218 GetMediaDevices(tab, &devices); | 218 GetMediaDevices(tab, &devices); |
| 219 | 219 |
| 220 // Labels should be non-empty if access has been allowed. | 220 // Labels should be non-empty if access has been allowed. |
| 221 for (std::vector<MediaDeviceInfo>::iterator it = devices.begin(); | 221 for (std::vector<MediaDeviceInfo>::iterator it = devices.begin(); |
| 222 it != devices.end(); ++it) { | 222 it != devices.end(); ++it) { |
| 223 EXPECT_TRUE(!it->label.empty()); | 223 EXPECT_TRUE(!it->label.empty()); |
| 224 } | 224 } |
| 225 } | 225 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 // MediaDevices.enumerateDevices. http://crbug.com/388648. | 262 // MediaDevices.enumerateDevices. http://crbug.com/388648. |
| 263 // Disabled, fails due to http://crbug.com/382391. | 263 // Disabled, fails due to http://crbug.com/382391. |
| 264 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, | 264 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, |
| 265 DISABLED_GetMediaDevicesEqualsGetSourcesWithAccess) { | 265 DISABLED_GetMediaDevicesEqualsGetSourcesWithAccess) { |
| 266 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 266 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 267 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 267 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 268 ui_test_utils::NavigateToURL(browser(), url); | 268 ui_test_utils::NavigateToURL(browser(), url); |
| 269 content::WebContents* tab = | 269 content::WebContents* tab = |
| 270 browser()->tab_strip_model()->GetActiveWebContents(); | 270 browser()->tab_strip_model()->GetActiveWebContents(); |
| 271 | 271 |
| 272 GetUserMediaAndAccept(tab); | 272 EXPECT_TRUE(GetUserMediaAndAccept(tab)); |
| 273 | 273 |
| 274 std::vector<MediaDeviceInfo> devices; | 274 std::vector<MediaDeviceInfo> devices; |
| 275 GetMediaDevices(tab, &devices); | 275 GetMediaDevices(tab, &devices); |
| 276 | 276 |
| 277 std::vector<MediaDeviceInfo> sources; | 277 std::vector<MediaDeviceInfo> sources; |
| 278 GetSources(tab, &sources); | 278 GetSources(tab, &sources); |
| 279 | 279 |
| 280 std::vector<MediaDeviceInfo>::iterator sources_it = sources.begin(); | 280 std::vector<MediaDeviceInfo>::iterator sources_it = sources.begin(); |
| 281 for (std::vector<MediaDeviceInfo>::iterator devices_it = devices.begin(); | 281 for (std::vector<MediaDeviceInfo>::iterator devices_it = devices.begin(); |
| 282 devices_it != devices.end(); ++devices_it) { | 282 devices_it != devices.end(); ++devices_it) { |
| 283 if (devices_it->kind == kDeviceKindAudioOutput) | 283 if (devices_it->kind == kDeviceKindAudioOutput) |
| 284 continue; | 284 continue; |
| 285 EXPECT_STREQ(devices_it->device_id.c_str(), sources_it->device_id.c_str()); | 285 EXPECT_STREQ(devices_it->device_id.c_str(), sources_it->device_id.c_str()); |
| 286 if (devices_it->kind == kDeviceKindAudioInput) { | 286 if (devices_it->kind == kDeviceKindAudioInput) { |
| 287 EXPECT_STREQ(kSourceKindAudioInput, sources_it->kind.c_str()); | 287 EXPECT_STREQ(kSourceKindAudioInput, sources_it->kind.c_str()); |
| 288 } else { | 288 } else { |
| 289 EXPECT_STREQ(kSourceKindVideoInput, sources_it->kind.c_str()); | 289 EXPECT_STREQ(kSourceKindVideoInput, sources_it->kind.c_str()); |
| 290 } | 290 } |
| 291 EXPECT_TRUE(!devices_it->label.empty()); | 291 EXPECT_TRUE(!devices_it->label.empty()); |
| 292 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()); |
| 293 ++sources_it; | 293 ++sources_it; |
| 294 } | 294 } |
| 295 EXPECT_EQ(sources.end(), sources_it); | 295 EXPECT_EQ(sources.end(), sources_it); |
| 296 } | 296 } |
| OLD | NEW |