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/debug/trace_event_impl.h" | 5 #include "base/debug/trace_event_impl.h" |
6 #include "base/json/json_reader.h" | 6 #include "base/json/json_reader.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/test/trace_event_analyzer.h" | 8 #include "base/test/trace_event_analyzer.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "content/browser/media/webrtc_internals.h" | 10 #include "content/browser/media/webrtc_internals.h" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 } | 357 } |
358 | 358 |
359 // This test calls getUserMedia and checks for aspect ratio behavior. | 359 // This test calls getUserMedia and checks for aspect ratio behavior. |
360 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, | 360 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, |
361 TestGetUserMediaAspectRatio4To3) { | 361 TestGetUserMediaAspectRatio4To3) { |
362 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 362 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
363 | 363 |
364 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | 364 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
365 | 365 |
366 std::string constraints_4_3 = GenerateGetUserMediaCall( | 366 std::string constraints_4_3 = GenerateGetUserMediaCall( |
367 kGetUserMediaAndAnalyseAndStop, 640, 640, 480, 480, 30, 30); | 367 kGetUserMediaAndAnalyseAndStop, 640, 640, 480, 480, 30, 10); |
368 | 368 |
369 // TODO(mcasas): add more aspect ratios, in particular 16:10 crbug.com/275594. | 369 // TODO(mcasas): add more aspect ratios, in particular 16:10 crbug.com/275594. |
370 | 370 |
371 NavigateToURL(shell(), url); | 371 NavigateToURL(shell(), url); |
372 ASSERT_EQ("4:3 letterbox", | 372 ASSERT_EQ("4:3 letterbox", |
373 ExecuteJavascriptAndReturnResult(constraints_4_3)); | 373 ExecuteJavascriptAndReturnResult(constraints_4_3)); |
374 } | 374 } |
375 | 375 |
376 // This test calls getUserMedia and checks for aspect ratio behavior. | 376 // This test calls getUserMedia and checks for aspect ratio behavior. |
377 // TODO(perkj): Enable this test as soon as crbug/349450 is fixed. | 377 // TODO(perkj): Enable this test as soon as crbug/349450 is fixed. |
378 // Currently the render pipeline doesn't support cropping where the new cropped | 378 // Currently the render pipeline doesn't support cropping where the new cropped |
379 // frame doesn't have the same top left coordinates as the original frame. | 379 // frame doesn't have the same top left coordinates as the original frame. |
380 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, | 380 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest, |
381 DISABLED_TestGetUserMediaAspectRatio16To9) { | 381 DISABLED_TestGetUserMediaAspectRatio16To9) { |
382 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 382 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
383 | 383 |
384 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | 384 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
385 | 385 |
386 std::string constraints_16_9 = GenerateGetUserMediaCall( | 386 std::string constraints_16_9 = GenerateGetUserMediaCall( |
387 kGetUserMediaAndAnalyseAndStop, 640, 640, 360, 360, 30, 30); | 387 kGetUserMediaAndAnalyseAndStop, 640, 640, 360, 360, 30, 10); |
388 | 388 |
389 NavigateToURL(shell(), url); | 389 NavigateToURL(shell(), url); |
390 ASSERT_EQ("16:9 letterbox", | 390 ASSERT_EQ("16:9 letterbox", |
391 ExecuteJavascriptAndReturnResult(constraints_16_9)); | 391 ExecuteJavascriptAndReturnResult(constraints_16_9)); |
392 } | 392 } |
393 | 393 |
394 namespace { | 394 namespace { |
395 | 395 |
396 struct UserMediaSizes { | 396 struct UserMediaSizes { |
397 int min_width; | 397 int min_width; |
(...skipping 29 matching lines...) Expand all Loading... |
427 user_media().min_height, | 427 user_media().min_height, |
428 user_media().max_height, | 428 user_media().max_height, |
429 user_media().min_frame_rate, | 429 user_media().min_frame_rate, |
430 user_media().max_frame_rate); | 430 user_media().max_frame_rate); |
431 DVLOG(1) << "Calling getUserMedia: " << call; | 431 DVLOG(1) << "Calling getUserMedia: " << call; |
432 NavigateToURL(shell(), url); | 432 NavigateToURL(shell(), url); |
433 ExecuteJavascriptAndWaitForOk(call); | 433 ExecuteJavascriptAndWaitForOk(call); |
434 } | 434 } |
435 | 435 |
436 static const UserMediaSizes kAllUserMediaSizes[] = { | 436 static const UserMediaSizes kAllUserMediaSizes[] = { |
437 {320, 320, 180, 180, 30, 30}, | 437 {320, 320, 180, 180, 30, 10}, |
438 {320, 320, 240, 240, 30, 30}, | 438 {320, 320, 240, 240, 30, 10}, |
439 {640, 640, 360, 360, 30, 30}, | 439 {640, 640, 360, 360, 30, 10}, |
440 {640, 640, 480, 480, 30, 30}, | 440 {640, 640, 480, 480, 30, 10}, |
441 {960, 960, 720, 720, 30, 30}, | 441 {960, 960, 720, 720, 30, 10}, |
442 {1280, 1280, 720, 720, 30, 30}, | 442 {1280, 1280, 720, 720, 30, 10}, |
443 {1920, 1920, 1080, 1080, 30, 30}}; | 443 {1920, 1920, 1080, 1080, 30, 10}}; |
444 | 444 |
445 INSTANTIATE_TEST_CASE_P(UserMedia, | 445 INSTANTIATE_TEST_CASE_P(UserMedia, |
446 WebRtcConstraintsBrowserTest, | 446 WebRtcConstraintsBrowserTest, |
447 testing::ValuesIn(kAllUserMediaSizes)); | 447 testing::ValuesIn(kAllUserMediaSizes)); |
448 | 448 |
449 } // namespace content | 449 } // namespace content |
OLD | NEW |