OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 printf("Output was:\n\n%s\n", output.c_str()); | 252 printf("Output was:\n\n%s\n", output.c_str()); |
253 bool has_result_lines = output.find("RESULT") != std::string::npos; | 253 bool has_result_lines = output.find("RESULT") != std::string::npos; |
254 if (!ok || !has_result_lines) { | 254 if (!ok || !has_result_lines) { |
255 LOG(ERROR) << "Failed to compare videos; see output above to see what " | 255 LOG(ERROR) << "Failed to compare videos; see output above to see what " |
256 << "the error was."; | 256 << "the error was."; |
257 return false; | 257 return false; |
258 } | 258 } |
259 return true; | 259 return true; |
260 } | 260 } |
261 | 261 |
262 void TestVideoQuality(const std::string& video_codec) { | 262 void TestVideoQuality(const std::string& video_codec, |
| 263 bool prefer_hw_video_codec) { |
263 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 150) | 264 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 150) |
264 << "This is a long-running test; you must specify " | 265 << "This is a long-running test; you must specify " |
265 "--ui-test-action-max-timeout to have a value of at least 150000."; | 266 "--ui-test-action-max-timeout to have a value of at least 150000."; |
266 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); | 267 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); |
267 ASSERT_TRUE(embedded_test_server()->Start()); | 268 ASSERT_TRUE(embedded_test_server()->Start()); |
268 | 269 |
269 content::WebContents* left_tab = | 270 content::WebContents* left_tab = |
270 OpenPageAndGetUserMediaInNewTabWithConstraints( | 271 OpenPageAndGetUserMediaInNewTabWithConstraints( |
271 embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage), | 272 embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage), |
272 test_config_.constraints); | 273 test_config_.constraints); |
273 content::WebContents* right_tab = | 274 content::WebContents* right_tab = |
274 OpenPageAndGetUserMediaInNewTabWithConstraints( | 275 OpenPageAndGetUserMediaInNewTabWithConstraints( |
275 embedded_test_server()->GetURL(kCapturingWebrtcHtmlPage), | 276 embedded_test_server()->GetURL(kCapturingWebrtcHtmlPage), |
276 test_config_.constraints); | 277 test_config_.constraints); |
277 | 278 |
278 SetupPeerconnectionWithLocalStream(left_tab); | 279 SetupPeerconnectionWithLocalStream(left_tab); |
279 SetupPeerconnectionWithLocalStream(right_tab); | 280 SetupPeerconnectionWithLocalStream(right_tab); |
280 | 281 |
281 if (!video_codec.empty()) { | 282 if (!video_codec.empty()) { |
282 SetDefaultVideoCodec(left_tab, video_codec); | 283 SetDefaultVideoCodec(left_tab, video_codec, prefer_hw_video_codec); |
283 SetDefaultVideoCodec(right_tab, video_codec); | 284 SetDefaultVideoCodec(right_tab, video_codec, prefer_hw_video_codec); |
284 } | 285 } |
285 NegotiateCall(left_tab, right_tab); | 286 NegotiateCall(left_tab, right_tab); |
286 | 287 |
287 // Poll slower here to avoid flooding the log with messages: capturing and | 288 // Poll slower here to avoid flooding the log with messages: capturing and |
288 // sending frames take quite a bit of time. | 289 // sending frames take quite a bit of time. |
289 int polling_interval_msec = 1000; | 290 int polling_interval_msec = 1000; |
290 | 291 |
291 EXPECT_TRUE(test::PollingWaitUntil("doneFrameCapturing()", "done-capturing", | 292 EXPECT_TRUE(test::PollingWaitUntil("doneFrameCapturing()", "done-capturing", |
292 right_tab, polling_interval_msec)); | 293 right_tab, polling_interval_msec)); |
293 | 294 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 }; | 340 }; |
340 | 341 |
341 INSTANTIATE_TEST_CASE_P( | 342 INSTANTIATE_TEST_CASE_P( |
342 WebRtcVideoQualityBrowserTests, | 343 WebRtcVideoQualityBrowserTests, |
343 WebRtcVideoQualityBrowserTest, | 344 WebRtcVideoQualityBrowserTest, |
344 testing::ValuesIn(kVideoConfigurations)); | 345 testing::ValuesIn(kVideoConfigurations)); |
345 | 346 |
346 IN_PROC_BROWSER_TEST_P(WebRtcVideoQualityBrowserTest, | 347 IN_PROC_BROWSER_TEST_P(WebRtcVideoQualityBrowserTest, |
347 MANUAL_TestVideoQualityVp8) { | 348 MANUAL_TestVideoQualityVp8) { |
348 base::ThreadRestrictions::ScopedAllowIO allow_io; | 349 base::ThreadRestrictions::ScopedAllowIO allow_io; |
349 TestVideoQuality("VP8"); | 350 TestVideoQuality("VP8", false /* prefer_hw_video_codec */); |
350 } | 351 } |
351 | 352 |
352 IN_PROC_BROWSER_TEST_P(WebRtcVideoQualityBrowserTest, | 353 IN_PROC_BROWSER_TEST_P(WebRtcVideoQualityBrowserTest, |
353 MANUAL_TestVideoQualityVp9) { | 354 MANUAL_TestVideoQualityVp9) { |
354 base::ThreadRestrictions::ScopedAllowIO allow_io; | 355 base::ThreadRestrictions::ScopedAllowIO allow_io; |
355 TestVideoQuality("VP9"); | 356 TestVideoQuality("VP9", false /* prefer_hw_video_codec */); |
356 } | 357 } |
357 | 358 |
358 #if BUILDFLAG(RTC_USE_H264) | 359 #if BUILDFLAG(RTC_USE_H264) |
359 | 360 |
360 IN_PROC_BROWSER_TEST_P(WebRtcVideoQualityBrowserTest, | 361 IN_PROC_BROWSER_TEST_P(WebRtcVideoQualityBrowserTest, |
361 MANUAL_TestVideoQualityH264) { | 362 MANUAL_TestVideoQualityH264) { |
362 base::ThreadRestrictions::ScopedAllowIO allow_io; | 363 base::ThreadRestrictions::ScopedAllowIO allow_io; |
363 // Only run test if run-time feature corresponding to |rtc_use_h264| is on. | 364 // Only run test if run-time feature corresponding to |rtc_use_h264| is on. |
364 if (!base::FeatureList::IsEnabled(content::kWebRtcH264WithOpenH264FFmpeg)) { | 365 if (!base::FeatureList::IsEnabled(content::kWebRtcH264WithOpenH264FFmpeg)) { |
365 LOG(WARNING) << "Run-time feature WebRTC-H264WithOpenH264FFmpeg disabled. " | 366 LOG(WARNING) << "Run-time feature WebRTC-H264WithOpenH264FFmpeg disabled. " |
366 "Skipping WebRtcVideoQualityBrowserTest.MANUAL_TestVideoQualityH264 " | 367 "Skipping WebRtcVideoQualityBrowserTest.MANUAL_TestVideoQualityH264 " |
367 "(test \"OK\")"; | 368 "(test \"OK\")"; |
368 return; | 369 return; |
369 } | 370 } |
370 TestVideoQuality("H264"); | 371 TestVideoQuality("H264", true /* prefer_hw_video_codec */); |
371 } | 372 } |
372 | 373 |
373 #endif // BUILDFLAG(RTC_USE_H264) | 374 #endif // BUILDFLAG(RTC_USE_H264) |
OLD | NEW |