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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 static const bool kParamsToRunTestsWith[] = { false, true }; | 178 static const bool kParamsToRunTestsWith[] = { false, true }; |
179 INSTANTIATE_TEST_CASE_P(WebRtcGetMediaDevicesBrowserTests, | 179 INSTANTIATE_TEST_CASE_P(WebRtcGetMediaDevicesBrowserTests, |
180 WebRtcGetMediaDevicesBrowserTest, | 180 WebRtcGetMediaDevicesBrowserTest, |
181 testing::ValuesIn(kParamsToRunTestsWith)); | 181 testing::ValuesIn(kParamsToRunTestsWith)); |
182 | 182 |
183 // getMediaDevices has been removed and will be replaced | 183 // getMediaDevices has been removed and will be replaced |
184 // MediaDevices.enumerateDevices. http://crbug.com/388648. | 184 // MediaDevices.enumerateDevices. http://crbug.com/388648. |
185 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, | 185 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, |
186 DISABLED_GetMediaDevicesWithoutAccess) { | 186 DISABLED_GetMediaDevicesWithoutAccess) { |
187 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 187 ASSERT_TRUE(embedded_test_server()->Start()); |
188 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 188 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
189 ui_test_utils::NavigateToURL(browser(), url); | 189 ui_test_utils::NavigateToURL(browser(), url); |
190 content::WebContents* tab = | 190 content::WebContents* tab = |
191 browser()->tab_strip_model()->GetActiveWebContents(); | 191 browser()->tab_strip_model()->GetActiveWebContents(); |
192 | 192 |
193 std::vector<MediaDeviceInfo> devices; | 193 std::vector<MediaDeviceInfo> devices; |
194 GetMediaDevices(tab, &devices); | 194 GetMediaDevices(tab, &devices); |
195 | 195 |
196 // Labels should be empty if access has not been allowed. | 196 // Labels should be empty if access has not been allowed. |
197 for (std::vector<MediaDeviceInfo>::iterator it = devices.begin(); | 197 for (std::vector<MediaDeviceInfo>::iterator it = devices.begin(); |
198 it != devices.end(); ++it) { | 198 it != devices.end(); ++it) { |
199 EXPECT_TRUE(it->label.empty()); | 199 EXPECT_TRUE(it->label.empty()); |
200 } | 200 } |
201 } | 201 } |
202 | 202 |
203 // getMediaDevices has been removed and will be replaced | 203 // getMediaDevices has been removed and will be replaced |
204 // MediaDevices.enumerateDevices. http://crbug.com/388648. | 204 // MediaDevices.enumerateDevices. http://crbug.com/388648. |
205 // Disabled, fails due to http://crbug.com/382391. | 205 // Disabled, fails due to http://crbug.com/382391. |
206 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, | 206 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, |
207 DISABLED_GetMediaDevicesWithAccess) { | 207 DISABLED_GetMediaDevicesWithAccess) { |
208 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 208 ASSERT_TRUE(embedded_test_server()->Start()); |
209 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 209 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
210 ui_test_utils::NavigateToURL(browser(), url); | 210 ui_test_utils::NavigateToURL(browser(), url); |
211 content::WebContents* tab = | 211 content::WebContents* tab = |
212 browser()->tab_strip_model()->GetActiveWebContents(); | 212 browser()->tab_strip_model()->GetActiveWebContents(); |
213 | 213 |
214 EXPECT_TRUE(GetUserMediaAndAccept(tab)); | 214 EXPECT_TRUE(GetUserMediaAndAccept(tab)); |
215 | 215 |
216 std::vector<MediaDeviceInfo> devices; | 216 std::vector<MediaDeviceInfo> devices; |
217 GetMediaDevices(tab, &devices); | 217 GetMediaDevices(tab, &devices); |
218 | 218 |
219 // Labels should be non-empty if access has been allowed. | 219 // Labels should be non-empty if access has been allowed. |
220 for (std::vector<MediaDeviceInfo>::iterator it = devices.begin(); | 220 for (std::vector<MediaDeviceInfo>::iterator it = devices.begin(); |
221 it != devices.end(); ++it) { | 221 it != devices.end(); ++it) { |
222 EXPECT_TRUE(!it->label.empty()); | 222 EXPECT_TRUE(!it->label.empty()); |
223 } | 223 } |
224 } | 224 } |
225 | 225 |
226 // getMediaDevices has been removed and will be replaced | 226 // getMediaDevices has been removed and will be replaced |
227 // MediaDevices.enumerateDevices. http://crbug.com/388648. | 227 // MediaDevices.enumerateDevices. http://crbug.com/388648. |
228 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, | 228 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, |
229 DISABLED_GetMediaDevicesEqualsGetSourcesWithoutAccess) { | 229 DISABLED_GetMediaDevicesEqualsGetSourcesWithoutAccess) { |
230 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 230 ASSERT_TRUE(embedded_test_server()->Start()); |
231 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 231 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
232 ui_test_utils::NavigateToURL(browser(), url); | 232 ui_test_utils::NavigateToURL(browser(), url); |
233 content::WebContents* tab = | 233 content::WebContents* tab = |
234 browser()->tab_strip_model()->GetActiveWebContents(); | 234 browser()->tab_strip_model()->GetActiveWebContents(); |
235 | 235 |
236 std::vector<MediaDeviceInfo> devices; | 236 std::vector<MediaDeviceInfo> devices; |
237 GetMediaDevices(tab, &devices); | 237 GetMediaDevices(tab, &devices); |
238 | 238 |
239 std::vector<MediaDeviceInfo> sources; | 239 std::vector<MediaDeviceInfo> sources; |
240 GetSources(tab, &sources); | 240 GetSources(tab, &sources); |
(...skipping 14 matching lines...) Expand all Loading... |
255 ++sources_it; | 255 ++sources_it; |
256 } | 256 } |
257 EXPECT_EQ(sources.end(), sources_it); | 257 EXPECT_EQ(sources.end(), sources_it); |
258 } | 258 } |
259 | 259 |
260 // getMediaDevices has been removed and will be replaced | 260 // getMediaDevices has been removed and will be replaced |
261 // MediaDevices.enumerateDevices. http://crbug.com/388648. | 261 // MediaDevices.enumerateDevices. http://crbug.com/388648. |
262 // Disabled, fails due to http://crbug.com/382391. | 262 // Disabled, fails due to http://crbug.com/382391. |
263 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, | 263 IN_PROC_BROWSER_TEST_P(WebRtcGetMediaDevicesBrowserTest, |
264 DISABLED_GetMediaDevicesEqualsGetSourcesWithAccess) { | 264 DISABLED_GetMediaDevicesEqualsGetSourcesWithAccess) { |
265 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 265 ASSERT_TRUE(embedded_test_server()->Start()); |
266 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 266 GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
267 ui_test_utils::NavigateToURL(browser(), url); | 267 ui_test_utils::NavigateToURL(browser(), url); |
268 content::WebContents* tab = | 268 content::WebContents* tab = |
269 browser()->tab_strip_model()->GetActiveWebContents(); | 269 browser()->tab_strip_model()->GetActiveWebContents(); |
270 | 270 |
271 EXPECT_TRUE(GetUserMediaAndAccept(tab)); | 271 EXPECT_TRUE(GetUserMediaAndAccept(tab)); |
272 | 272 |
273 std::vector<MediaDeviceInfo> devices; | 273 std::vector<MediaDeviceInfo> devices; |
274 GetMediaDevices(tab, &devices); | 274 GetMediaDevices(tab, &devices); |
275 | 275 |
(...skipping 10 matching lines...) Expand all Loading... |
286 EXPECT_STREQ(kSourceKindAudioInput, sources_it->kind.c_str()); | 286 EXPECT_STREQ(kSourceKindAudioInput, sources_it->kind.c_str()); |
287 } else { | 287 } else { |
288 EXPECT_STREQ(kSourceKindVideoInput, sources_it->kind.c_str()); | 288 EXPECT_STREQ(kSourceKindVideoInput, sources_it->kind.c_str()); |
289 } | 289 } |
290 EXPECT_TRUE(!devices_it->label.empty()); | 290 EXPECT_TRUE(!devices_it->label.empty()); |
291 EXPECT_STREQ(devices_it->label.c_str(), sources_it->label.c_str()); | 291 EXPECT_STREQ(devices_it->label.c_str(), sources_it->label.c_str()); |
292 ++sources_it; | 292 ++sources_it; |
293 } | 293 } |
294 EXPECT_EQ(sources.end(), sources_it); | 294 EXPECT_EQ(sources.end(), sources_it); |
295 } | 295 } |
OLD | NEW |