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