| 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/base64.h" | 5 #include "base/base64.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/environment.h" | 7 #include "base/environment.h" |
| 8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 : environment_(base::Environment::Create()) { | 100 : environment_(base::Environment::Create()) { |
| 101 test_config_ = GetParam(); | 101 test_config_ = GetParam(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void SetUpInProcessBrowserTestFixture() override { | 104 void SetUpInProcessBrowserTestFixture() override { |
| 105 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. | 105 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. |
| 106 | 106 |
| 107 ASSERT_TRUE(temp_working_dir_.CreateUniqueTempDir()); | 107 ASSERT_TRUE(temp_working_dir_.CreateUniqueTempDir()); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void SetUpCommandLine(CommandLine* command_line) override { | 110 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 111 // Set up the command line option with the expected file name. We will check | 111 // Set up the command line option with the expected file name. We will check |
| 112 // its existence in HasAllRequiredResources(). | 112 // its existence in HasAllRequiredResources(). |
| 113 webrtc_reference_video_y4m_ = test::GetReferenceFilesDir() | 113 webrtc_reference_video_y4m_ = test::GetReferenceFilesDir() |
| 114 .Append(test_config_.reference_video) | 114 .Append(test_config_.reference_video) |
| 115 .AddExtension(test::kY4mFileExtension); | 115 .AddExtension(test::kY4mFileExtension); |
| 116 command_line->AppendSwitchPath(switches::kUseFileForFakeVideoCapture, | 116 command_line->AppendSwitchPath(switches::kUseFileForFakeVideoCapture, |
| 117 webrtc_reference_video_y4m_); | 117 webrtc_reference_video_y4m_); |
| 118 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 118 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
| 119 | 119 |
| 120 // The video playback will not work without a GPU, so force its use here. | 120 // The video playback will not work without a GPU, so force its use here. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 const base::FilePath& captured_video_filename) { | 159 const base::FilePath& captured_video_filename) { |
| 160 base::FilePath path_to_converter = base::MakeAbsoluteFilePath( | 160 base::FilePath path_to_converter = base::MakeAbsoluteFilePath( |
| 161 GetBrowserDir().Append(kArgbToI420ConverterExecutable)); | 161 GetBrowserDir().Append(kArgbToI420ConverterExecutable)); |
| 162 | 162 |
| 163 if (!base::PathExists(path_to_converter)) { | 163 if (!base::PathExists(path_to_converter)) { |
| 164 LOG(ERROR) << "Missing ARGB->I420 converter: should be in " | 164 LOG(ERROR) << "Missing ARGB->I420 converter: should be in " |
| 165 << path_to_converter.value(); | 165 << path_to_converter.value(); |
| 166 return false; | 166 return false; |
| 167 } | 167 } |
| 168 | 168 |
| 169 CommandLine converter_command(path_to_converter); | 169 base::CommandLine converter_command(path_to_converter); |
| 170 converter_command.AppendSwitchPath("--frames_dir", GetWorkingDir()); | 170 converter_command.AppendSwitchPath("--frames_dir", GetWorkingDir()); |
| 171 converter_command.AppendSwitchPath("--output_file", | 171 converter_command.AppendSwitchPath("--output_file", |
| 172 captured_video_filename); | 172 captured_video_filename); |
| 173 converter_command.AppendSwitchASCII("--width", | 173 converter_command.AppendSwitchASCII("--width", |
| 174 base::StringPrintf("%d", width)); | 174 base::StringPrintf("%d", width)); |
| 175 converter_command.AppendSwitchASCII("--height", | 175 converter_command.AppendSwitchASCII("--height", |
| 176 base::StringPrintf("%d", height)); | 176 base::StringPrintf("%d", height)); |
| 177 converter_command.AppendSwitchASCII("--delete_frames", "true"); | 177 converter_command.AppendSwitchASCII("--delete_frames", "true"); |
| 178 | 178 |
| 179 // We produce an output file that will later be used as an input to the | 179 // We produce an output file that will later be used as an input to the |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 return false; | 212 return false; |
| 213 } | 213 } |
| 214 if (!base::PathExists(path_to_compare_script)) { | 214 if (!base::PathExists(path_to_compare_script)) { |
| 215 LOG(ERROR) << "Missing video compare script: should be in " | 215 LOG(ERROR) << "Missing video compare script: should be in " |
| 216 << path_to_compare_script.value(); | 216 << path_to_compare_script.value(); |
| 217 return false; | 217 return false; |
| 218 } | 218 } |
| 219 | 219 |
| 220 // Note: don't append switches to this command since it will mess up the | 220 // Note: don't append switches to this command since it will mess up the |
| 221 // -u in the python invocation! | 221 // -u in the python invocation! |
| 222 CommandLine compare_command(CommandLine::NO_PROGRAM); | 222 base::CommandLine compare_command(base::CommandLine::NO_PROGRAM); |
| 223 EXPECT_TRUE(GetPythonCommand(&compare_command)); | 223 EXPECT_TRUE(GetPythonCommand(&compare_command)); |
| 224 | 224 |
| 225 compare_command.AppendArgPath(path_to_compare_script); | 225 compare_command.AppendArgPath(path_to_compare_script); |
| 226 compare_command.AppendArg(base::StringPrintf("--label=%s", test_label)); | 226 compare_command.AppendArg(base::StringPrintf("--label=%s", test_label)); |
| 227 compare_command.AppendArg("--ref_video"); | 227 compare_command.AppendArg("--ref_video"); |
| 228 compare_command.AppendArgPath(reference_video_filename); | 228 compare_command.AppendArgPath(reference_video_filename); |
| 229 compare_command.AppendArg("--test_video"); | 229 compare_command.AppendArg("--test_video"); |
| 230 compare_command.AppendArgPath(captured_video_filename); | 230 compare_command.AppendArgPath(captured_video_filename); |
| 231 compare_command.AppendArg("--frame_analyzer"); | 231 compare_command.AppendArg("--frame_analyzer"); |
| 232 compare_command.AppendArgPath(path_to_analyzer); | 232 compare_command.AppendArgPath(path_to_analyzer); |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 ASSERT_TRUE(CompareVideosAndPrintResult( | 332 ASSERT_TRUE(CompareVideosAndPrintResult( |
| 333 test_config_.test_name, | 333 test_config_.test_name, |
| 334 test_config_.width, | 334 test_config_.width, |
| 335 test_config_.height, | 335 test_config_.height, |
| 336 GetWorkingDir().Append(kCapturedYuvFileName), | 336 GetWorkingDir().Append(kCapturedYuvFileName), |
| 337 test::GetReferenceFilesDir() | 337 test::GetReferenceFilesDir() |
| 338 .Append(test_config_.reference_video) | 338 .Append(test_config_.reference_video) |
| 339 .AddExtension(test::kYuvFileExtension), | 339 .AddExtension(test::kYuvFileExtension), |
| 340 GetWorkingDir().Append(kStatsFileName))); | 340 GetWorkingDir().Append(kStatsFileName))); |
| 341 } | 341 } |
| OLD | NEW |