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 32cfdd9194856e31acb05d899f9cbaa79a53e432..16ee1a2c052826eb9013631302ac36cf7fca4cab 100644 |
| --- a/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc |
| +++ b/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc |
| @@ -53,7 +53,7 @@ static const base::FilePath::CharType kArgbToI420ConverterExecutable[] = |
| static const char kHomeEnvName[] = |
| #if defined(OS_WIN) |
| - "HOMEPATH"; |
| + "USERPROFILE"; |
|
kjellander_chromium
2014/04/28 06:03:52
This will make it possible to support the Chromium
|
| #else |
| "HOME"; |
| #endif |
| @@ -67,15 +67,27 @@ static const base::FilePath::CharType kStatsFileName[] = |
| FILE_PATH_LITERAL("stats.txt"); |
| static const char kMainWebrtcTestHtmlPage[] = |
| "/webrtc/webrtc_jsep01_test.html"; |
| -static const char kCapturingWebrtcHtmlPage[] = |
| - "/webrtc/webrtc_video_quality_test.html"; |
| -static const int k360pWidth = 640; |
| -static const int k360pHeight = 360; |
| // If you change the port number, don't forget to modify video_extraction.js |
| // too! |
| static const char kPyWebSocketPortNumber[] = "12221"; |
| +// Configuration object containing: test_name, width, height, capture_page, |
| +// reference_video, test_constraints. |
| +typedef std::tr1::tuple<const char*, int, int, const char*, |
| + const base::FilePath::CharType*, const char*> TestConfig; |
| + |
| +static const TestConfig k360pConfig( |
| + "360p", 640, 360, |
| + "/webrtc/webrtc_video_quality_test.html", |
| + test::kReferenceFileName360p, |
| + WebRtcTestBase::kAudioVideoCallConstraints360p); |
| +static const TestConfig k720pConfig( |
| + "720p", 1280, 720, |
| + "/webrtc/webrtc_video_quality_test_hd.html", |
| + test::kReferenceFileName720p, |
| + WebRtcTestBase::kAudioVideoCallConstraints720p); |
| + |
| // Test the video quality of the WebRTC output. |
| // |
| // Prerequisites: This test case must run on a machine with a chrome playing |
| @@ -99,10 +111,17 @@ static const char kPyWebSocketPortNumber[] = "12221"; |
| // frame_analyzer. Both tools can be found under third_party/webrtc/tools. The |
| // test also runs a stand alone Python implementation of a WebSocket server |
| // (pywebsocket) and a barcode_decoder script. |
| -class WebRtcVideoQualityBrowserTest : public WebRtcTestBase { |
| +class WebRtcVideoQualityBrowserTest : public WebRtcTestBase, |
| + public testing::WithParamInterface<TestConfig> { |
| public: |
| WebRtcVideoQualityBrowserTest() |
| - : pywebsocket_server_(0), |
| + : test_name_(std::tr1::get<0>(GetParam())), |
| + width_(std::tr1::get<1>(GetParam())), |
| + height_(std::tr1::get<2>(GetParam())), |
| + capture_page_(std::tr1::get<3>(GetParam())), |
| + reference_video_(std::tr1::get<4>(GetParam())), |
| + test_constraints_(std::tr1::get<5>(GetParam())), |
| + pywebsocket_server_(0), |
| environment_(base::Environment::Create()) {} |
| virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| @@ -114,7 +133,7 @@ class WebRtcVideoQualityBrowserTest : public WebRtcTestBase { |
| // Set up the command line option with the expected file name. We will check |
| // its existence in HasAllRequiredResources(). |
| webrtc_reference_video_y4m_ = test::GetReferenceFilesDir() |
| - .Append(test::kReferenceFileName360p) |
| + .Append(reference_video_) |
| .AddExtension(test::kY4mFileExtension); |
| command_line->AppendSwitchPath(switches::kUseFileForFakeVideoCapture, |
| webrtc_reference_video_y4m_); |
| @@ -248,7 +267,7 @@ class WebRtcVideoQualityBrowserTest : public WebRtcTestBase { |
| EXPECT_TRUE(GetPythonCommand(&compare_command)); |
| compare_command.AppendArgPath(path_to_compare_script); |
| - compare_command.AppendArg("--label=360p"); |
| + compare_command.AppendArg(base::StringPrintf("--label=%s", test_name_)); |
| compare_command.AppendArg("--ref_video"); |
| compare_command.AppendArgPath(reference_video_filename); |
| compare_command.AppendArg("--test_video"); |
| @@ -279,6 +298,13 @@ class WebRtcVideoQualityBrowserTest : public WebRtcTestBase { |
| return base::FilePath(native_home_dir).Append(kWorkingDirName); |
| } |
| + protected: |
| + const char* test_name_; |
| + int width_; |
| + int height_; |
| + const char* capture_page_; |
| + const base::FilePath::CharType* reference_video_; |
| + const char* test_constraints_; |
| test::PeerConnectionServerRunner peerconnection_server_; |
| private: |
| @@ -299,8 +325,15 @@ class WebRtcVideoQualityBrowserTest : public WebRtcTestBase { |
| base::FilePath webrtc_reference_video_y4m_; |
| }; |
| -IN_PROC_BROWSER_TEST_F(WebRtcVideoQualityBrowserTest, |
| - MANUAL_TestVGAVideoQuality) { |
| +static const TestConfig kVideoConfigurations[] = { k360pConfig, k720pConfig }; |
| +INSTANTIATE_TEST_CASE_P( |
| + WebRtcVideoQualityBrowserTests, |
| + WebRtcVideoQualityBrowserTest, |
| + testing::ValuesIn(kVideoConfigurations)); |
| + |
| +IN_PROC_BROWSER_TEST_P(WebRtcVideoQualityBrowserTest, |
| + MANUAL_TestVideoQuality) { |
| + |
| #if defined(OS_WIN) |
| // Fails on XP. http://crbug.com/353078 |
| if (base::win::GetVersion() <= base::win::VERSION_XP) |
| @@ -310,7 +343,6 @@ IN_PROC_BROWSER_TEST_F(WebRtcVideoQualityBrowserTest, |
| 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(HasAllRequiredResources()); |
| ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| ASSERT_TRUE(StartPyWebSocketServer()); |
| @@ -319,11 +351,11 @@ IN_PROC_BROWSER_TEST_F(WebRtcVideoQualityBrowserTest, |
| content::WebContents* left_tab = |
| OpenPageAndGetUserMediaInNewTabWithConstraints( |
| embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage), |
| - kAudioVideoCallConstraints360p); |
| + test_constraints_); |
| content::WebContents* right_tab = |
| OpenPageAndGetUserMediaInNewTabWithConstraints( |
| - embedded_test_server()->GetURL(kCapturingWebrtcHtmlPage), |
| - kAudioVideoCallConstraints360p); |
| + embedded_test_server()->GetURL(capture_page_), |
| + test_constraints_); |
| EstablishCall(left_tab, right_tab); |
| @@ -353,13 +385,13 @@ IN_PROC_BROWSER_TEST_F(WebRtcVideoQualityBrowserTest, |
| chrome::CloseWebContents(browser(), right_tab, false); |
| RunARGBtoI420Converter( |
| - k360pWidth, k360pHeight, GetWorkingDir().Append(kCapturedYuvFileName)); |
| + width_, height_, GetWorkingDir().Append(kCapturedYuvFileName)); |
| ASSERT_TRUE(CompareVideosAndPrintResult( |
| - k360pWidth, |
| - k360pHeight, |
| + width_, |
| + height_, |
| GetWorkingDir().Append(kCapturedYuvFileName), |
| test::GetReferenceFilesDir() |
| - .Append(test::kReferenceFileName360p) |
| + .Append(reference_video_) |
| .AddExtension(test::kYuvFileExtension), |
| GetWorkingDir().Append(kStatsFileName))); |
| } |