| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/environment.h" | 6 #include "base/environment.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/process/launch.h" | 9 #include "base/process/launch.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 static const int k360pWidth = 640; | 72 static const int k360pWidth = 640; |
| 73 static const int k360pHeight = 360; | 73 static const int k360pHeight = 360; |
| 74 | 74 |
| 75 // If you change the port number, don't forget to modify video_extraction.js | 75 // If you change the port number, don't forget to modify video_extraction.js |
| 76 // too! | 76 // too! |
| 77 static const char kPyWebSocketPortNumber[] = "12221"; | 77 static const char kPyWebSocketPortNumber[] = "12221"; |
| 78 | 78 |
| 79 // Test the video quality of the WebRTC output. | 79 // Test the video quality of the WebRTC output. |
| 80 // | 80 // |
| 81 // Prerequisites: This test case must run on a machine with a chrome playing | 81 // Prerequisites: This test case must run on a machine with a chrome playing |
| 82 // the video from the reference files located int GetReferenceVideosDir(). | 82 // the video from the reference files located in GetReferenceFilesDir(). |
| 83 // The file kReferenceY4mFileName.kY4mFileExtension is played using a | 83 // The file kReferenceY4mFileName.kY4mFileExtension is played using a |
| 84 // FileVideoCaptureDevice and its sibling with kYuvFileExtension is used for | 84 // FileVideoCaptureDevice and its sibling with kYuvFileExtension is used for |
| 85 // comparison. | 85 // comparison. |
| 86 // | 86 // |
| 87 // You must also compile the chromium_builder_webrtc target before you run this | 87 // You must also compile the chromium_builder_webrtc target before you run this |
| 88 // test to get all the tools built. | 88 // test to get all the tools built. |
| 89 // | 89 // |
| 90 // The external compare_videos.py script also depends on two external | 90 // The external compare_videos.py script also depends on two external |
| 91 // executables which must be located in the PATH when running this test. | 91 // executables which must be located in the PATH when running this test. |
| 92 // * zxing (see the CPP version at https://code.google.com/p/zxing) | 92 // * zxing (see the CPP version at https://code.google.com/p/zxing) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 106 environment_(base::Environment::Create()) {} | 106 environment_(base::Environment::Create()) {} |
| 107 | 107 |
| 108 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 108 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 109 test::PeerConnectionServerRunner::KillAllPeerConnectionServers(); | 109 test::PeerConnectionServerRunner::KillAllPeerConnectionServers(); |
| 110 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. | 110 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. |
| 111 } | 111 } |
| 112 | 112 |
| 113 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 113 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 114 // Set up the command line option with the expected file name. We will check | 114 // Set up the command line option with the expected file name. We will check |
| 115 // its existence in HasAllRequiredResources(). | 115 // its existence in HasAllRequiredResources(). |
| 116 webrtc_reference_video_y4m_ = test::GetReferenceVideosDir() | 116 webrtc_reference_video_y4m_ = test::GetReferenceFilesDir() |
| 117 .Append(test::kReferenceFileName360p) | 117 .Append(test::kReferenceFileName360p) |
| 118 .AddExtension(test::kY4mFileExtension); | 118 .AddExtension(test::kY4mFileExtension); |
| 119 command_line->AppendSwitchPath(switches::kUseFileForFakeVideoCapture, | 119 command_line->AppendSwitchPath(switches::kUseFileForFakeVideoCapture, |
| 120 webrtc_reference_video_y4m_); | 120 webrtc_reference_video_y4m_); |
| 121 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 121 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
| 122 | 122 |
| 123 // The video playback will not work without a GPU, so force its use here. | 123 // The video playback will not work without a GPU, so force its use here. |
| 124 command_line->AppendSwitch(switches::kUseGpuInTests); | 124 command_line->AppendSwitch(switches::kUseGpuInTests); |
| 125 } | 125 } |
| 126 | 126 |
| 127 bool HasAllRequiredResources() { | 127 bool HasAllRequiredResources() { |
| 128 if (!base::PathExists(GetWorkingDir())) { | 128 if (!base::PathExists(GetWorkingDir())) { |
| 129 LOG(ERROR) << "Cannot find the working directory for the temporary " | 129 LOG(ERROR) << "Cannot find the working directory for the temporary " |
| 130 "files:" << GetWorkingDir().value(); | 130 "files:" << GetWorkingDir().value(); |
| 131 return false; | 131 return false; |
| 132 } | 132 } |
| 133 | 133 |
| 134 // Ensure we have the required input files. | 134 // Ensure we have the required input files. |
| 135 return test::HasReferenceFilesInCheckout(); | 135 return test::HasReferenceFilesInCheckout(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 bool StartPyWebSocketServer() { | 138 bool StartPyWebSocketServer() { |
| 139 base::FilePath path_pywebsocket_dir = | 139 base::FilePath path_pywebsocket_dir = |
| 140 GetSourceDir().Append(FILE_PATH_LITERAL("third_party/pywebsocket/src")); | 140 GetSourceDir().Append(FILE_PATH_LITERAL("third_party/pywebsocket/src")); |
| 141 base::FilePath pywebsocket_server = path_pywebsocket_dir.Append( | 141 base::FilePath pywebsocket_server = path_pywebsocket_dir.Append( |
| 142 FILE_PATH_LITERAL("mod_pywebsocket/standalone.py")); | 142 FILE_PATH_LITERAL("mod_pywebsocket/standalone.py")); |
| 143 base::FilePath path_to_data_handler = | 143 base::FilePath path_to_data_handler = |
| 144 GetSourceDir().Append(FILE_PATH_LITERAL("chrome/test/functional")); | 144 GetSourceDir().Append(FILE_PATH_LITERAL("chrome/test/data/webrtc/wsh")); |
| 145 | 145 |
| 146 if (!base::PathExists(pywebsocket_server)) { | 146 if (!base::PathExists(pywebsocket_server)) { |
| 147 LOG(ERROR) << "Missing pywebsocket server."; | 147 LOG(ERROR) << "Missing pywebsocket server."; |
| 148 return false; | 148 return false; |
| 149 } | 149 } |
| 150 if (!base::PathExists(path_to_data_handler)) { | 150 if (!base::PathExists(path_to_data_handler)) { |
| 151 LOG(ERROR) << "Missing data handler for pywebsocket server."; | 151 LOG(ERROR) << "Missing data handler for pywebsocket server."; |
| 152 return false; | 152 return false; |
| 153 } | 153 } |
| 154 | 154 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 base::FilePath browser_dir; | 291 base::FilePath browser_dir; |
| 292 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &browser_dir)); | 292 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &browser_dir)); |
| 293 return browser_dir; | 293 return browser_dir; |
| 294 } | 294 } |
| 295 | 295 |
| 296 base::ProcessHandle pywebsocket_server_; | 296 base::ProcessHandle pywebsocket_server_; |
| 297 scoped_ptr<base::Environment> environment_; | 297 scoped_ptr<base::Environment> environment_; |
| 298 base::FilePath webrtc_reference_video_y4m_; | 298 base::FilePath webrtc_reference_video_y4m_; |
| 299 }; | 299 }; |
| 300 | 300 |
| 301 // Disabled due to crbug.com/360033. | |
| 302 IN_PROC_BROWSER_TEST_F(WebRtcVideoQualityBrowserTest, | 301 IN_PROC_BROWSER_TEST_F(WebRtcVideoQualityBrowserTest, |
| 303 DISABLED_MANUAL_TestVGAVideoQuality) { | 302 MANUAL_TestVGAVideoQuality) { |
| 304 #if defined(OS_WIN) | 303 #if defined(OS_WIN) |
| 305 // Fails on XP. http://crbug.com/353078 | 304 // Fails on XP. http://crbug.com/353078 |
| 306 if (base::win::GetVersion() <= base::win::VERSION_XP) | 305 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 307 return; | 306 return; |
| 308 #endif | 307 #endif |
| 309 | 308 |
| 310 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 150) << | 309 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 150) << |
| 311 "This is a long-running test; you must specify " | 310 "This is a long-running test; you must specify " |
| 312 "--ui-test-action-max-timeout to have a value of at least 150000."; | 311 "--ui-test-action-max-timeout to have a value of at least 150000."; |
| 313 | 312 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 350 |
| 352 chrome::CloseWebContents(browser(), left_tab, false); | 351 chrome::CloseWebContents(browser(), left_tab, false); |
| 353 chrome::CloseWebContents(browser(), right_tab, false); | 352 chrome::CloseWebContents(browser(), right_tab, false); |
| 354 | 353 |
| 355 RunARGBtoI420Converter( | 354 RunARGBtoI420Converter( |
| 356 k360pWidth, k360pHeight, GetWorkingDir().Append(kCapturedYuvFileName)); | 355 k360pWidth, k360pHeight, GetWorkingDir().Append(kCapturedYuvFileName)); |
| 357 ASSERT_TRUE(CompareVideosAndPrintResult( | 356 ASSERT_TRUE(CompareVideosAndPrintResult( |
| 358 k360pWidth, | 357 k360pWidth, |
| 359 k360pHeight, | 358 k360pHeight, |
| 360 GetWorkingDir().Append(kCapturedYuvFileName), | 359 GetWorkingDir().Append(kCapturedYuvFileName), |
| 361 test::GetReferenceVideosDir() | 360 test::GetReferenceFilesDir() |
| 362 .Append(test::kReferenceFileName360p) | 361 .Append(test::kReferenceFileName360p) |
| 363 .AddExtension(test::kYuvFileExtension), | 362 .AddExtension(test::kYuvFileExtension), |
| 364 GetWorkingDir().Append(kStatsFileName))); | 363 GetWorkingDir().Append(kStatsFileName))); |
| 365 } | 364 } |
| OLD | NEW |