Chromium Code Reviews| Index: chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc |
| diff --git a/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc b/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc |
| index 6098fa3452657239a9c2664f6c0d7f78cb462fbe..80ff0a39398b1ed6d8a0db2faa3f649357d5c81a 100644 |
| --- a/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc |
| +++ b/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc |
| @@ -198,6 +198,7 @@ class WebRtcVideoQualityBrowserTest : public WebRtcTestBase, |
| const char* test_label, |
| int width, |
| int height, |
| + const std::string& video_codec, |
|
phoglund_chromium
2016/03/07 10:57:12
I don't see why this function needs to know about
asapersson2
2016/03/07 13:05:29
Done.
|
| const base::FilePath& captured_video_filename, |
| const base::FilePath& reference_video_filename, |
| const base::FilePath& stats_file) { |
| @@ -230,13 +231,17 @@ class WebRtcVideoQualityBrowserTest : public WebRtcTestBase, |
| return false; |
| } |
| + std::string codec_label = |
| + video_codec.empty() ? video_codec : "_" + video_codec; |
| + |
| // Note: don't append switches to this command since it will mess up the |
| // -u in the python invocation! |
| base::CommandLine compare_command(base::CommandLine::NO_PROGRAM); |
| EXPECT_TRUE(GetPythonCommand(&compare_command)); |
| compare_command.AppendArgPath(path_to_compare_script); |
| - compare_command.AppendArg(base::StringPrintf("--label=%s", test_label)); |
| + compare_command.AppendArg(base::StringPrintf("--label=%s", test_label) + |
| + codec_label); |
| compare_command.AppendArg("--ref_video"); |
| compare_command.AppendArgPath(reference_video_filename); |
| compare_command.AppendArg("--test_video"); |
| @@ -270,12 +275,61 @@ class WebRtcVideoQualityBrowserTest : public WebRtcTestBase, |
| return true; |
| } |
| + void TestVideoQuality(const std::string& video_codec) { |
| + ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 150) |
| + << "This is a long-running test; you must specify " |
| + "--ui-test-action-max-timeout to have a value of at least 150000."; |
| + ASSERT_TRUE(test::HasReferenceFilesInCheckout()); |
| + ASSERT_TRUE(embedded_test_server()->Start()); |
| + |
| + content::WebContents* left_tab = |
| + OpenPageAndGetUserMediaInNewTabWithConstraints( |
| + embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage), |
| + test_config_.constraints); |
| + content::WebContents* right_tab = |
| + OpenPageAndGetUserMediaInNewTabWithConstraints( |
| + embedded_test_server()->GetURL(kCapturingWebrtcHtmlPage), |
| + test_config_.constraints); |
| + |
| + SetupPeerconnectionWithLocalStream(left_tab); |
| + SetupPeerconnectionWithLocalStream(right_tab); |
| + |
| + NegotiateCall(left_tab, right_tab, video_codec); |
| + |
| + // Poll slower here to avoid flooding the log with messages: capturing and |
| + // sending frames take quite a bit of time. |
| + int polling_interval_msec = 1000; |
| + |
| + EXPECT_TRUE(test::PollingWaitUntil("doneFrameCapturing()", "done-capturing", |
| + right_tab, polling_interval_msec)); |
| + |
| + HangUp(left_tab); |
| + |
| + WriteCapturedFramesToWorkingDir(right_tab); |
| + |
| + // Shut everything down to avoid having the javascript race with the |
| + // analysis |
|
phoglund_chromium
2016/03/07 10:57:12
Nit: pull up to previous line
asapersson2
2016/03/07 13:05:29
Done.
|
| + // tools. For instance, dont have console log printouts interleave with the |
| + // RESULT lines from the analysis tools (crbug.com/323200). |
| + chrome::CloseWebContents(browser(), left_tab, false); |
| + chrome::CloseWebContents(browser(), right_tab, false); |
| + |
| + ASSERT_TRUE( |
| + RunARGBtoI420Converter(test_config_.width, test_config_.height, |
| + GetWorkingDir().Append(kCapturedYuvFileName))); |
|
phoglund_chromium
2016/03/07 10:57:12
What about:
std::string codec_label = video_codec
asapersson2
2016/03/07 13:05:29
Done.
|
| + ASSERT_TRUE(CompareVideosAndPrintResult( |
| + test_config_.test_name, test_config_.width, test_config_.height, |
| + video_codec, GetWorkingDir().Append(kCapturedYuvFileName), |
| + test::GetReferenceFilesDir() |
| + .Append(test_config_.reference_video) |
| + .AddExtension(test::kYuvFileExtension), |
| + GetWorkingDir().Append(kStatsFileName))); |
| + } |
| + |
| protected: |
| VideoQualityTestConfig test_config_; |
| - base::FilePath GetWorkingDir() { |
| - return temp_working_dir_.path(); |
| - } |
| + base::FilePath GetWorkingDir() { return temp_working_dir_.path(); } |
| private: |
| base::FilePath GetSourceDir() { |
| @@ -300,56 +354,21 @@ INSTANTIATE_TEST_CASE_P( |
| WebRtcVideoQualityBrowserTest, |
| testing::ValuesIn(kVideoConfigurations)); |
| +// The video codec name is now appended to the test label (e.g. '720p_VP8'). |
| +// TODO(asapersson): Keep test below using the default video codec (which do |
| +// not have the codec name appended ('720p')) until new tests have been |
| +// running for some time. |
| +IN_PROC_BROWSER_TEST_P(WebRtcVideoQualityBrowserTest, |
| + MANUAL_TestVideoQualityDefault) { |
| + TestVideoQuality(""); |
| +} |
| + |
| +IN_PROC_BROWSER_TEST_P(WebRtcVideoQualityBrowserTest, |
| + MANUAL_TestVideoQualityVp8) { |
| + TestVideoQuality("VP8"); |
| +} |
| + |
| IN_PROC_BROWSER_TEST_P(WebRtcVideoQualityBrowserTest, |
| - MANUAL_TestVideoQuality) { |
| - ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 150) << |
| - "This is a long-running test; you must specify " |
| - "--ui-test-action-max-timeout to have a value of at least 150000."; |
| - ASSERT_TRUE(test::HasReferenceFilesInCheckout()); |
| - ASSERT_TRUE(embedded_test_server()->Start()); |
| - |
| - content::WebContents* left_tab = |
| - OpenPageAndGetUserMediaInNewTabWithConstraints( |
| - embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage), |
| - test_config_.constraints); |
| - content::WebContents* right_tab = |
| - OpenPageAndGetUserMediaInNewTabWithConstraints( |
| - embedded_test_server()->GetURL(kCapturingWebrtcHtmlPage), |
| - test_config_.constraints); |
| - |
| - SetupPeerconnectionWithLocalStream(left_tab); |
| - SetupPeerconnectionWithLocalStream(right_tab); |
| - |
| - NegotiateCall(left_tab, right_tab); |
| - |
| - // Poll slower here to avoid flooding the log with messages: capturing and |
| - // sending frames take quite a bit of time. |
| - int polling_interval_msec = 1000; |
| - |
| - EXPECT_TRUE(test::PollingWaitUntil( |
| - "doneFrameCapturing()", "done-capturing", right_tab, |
| - polling_interval_msec)); |
| - |
| - HangUp(left_tab); |
| - |
| - WriteCapturedFramesToWorkingDir(right_tab); |
| - |
| - // Shut everything down to avoid having the javascript race with the analysis |
| - // tools. For instance, dont have console log printouts interleave with the |
| - // RESULT lines from the analysis tools (crbug.com/323200). |
| - chrome::CloseWebContents(browser(), left_tab, false); |
| - chrome::CloseWebContents(browser(), right_tab, false); |
| - |
| - ASSERT_TRUE(RunARGBtoI420Converter( |
| - test_config_.width, test_config_.height, |
| - GetWorkingDir().Append(kCapturedYuvFileName))); |
| - ASSERT_TRUE(CompareVideosAndPrintResult( |
| - test_config_.test_name, |
| - test_config_.width, |
| - test_config_.height, |
| - GetWorkingDir().Append(kCapturedYuvFileName), |
| - test::GetReferenceFilesDir() |
| - .Append(test_config_.reference_video) |
| - .AddExtension(test::kYuvFileExtension), |
| - GetWorkingDir().Append(kStatsFileName))); |
| + MANUAL_TestVideoQualityVp9) { |
| + TestVideoQuality("VP9"); |
| } |