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/environment.h" | 5 #include "base/environment.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/process/launch.h" | 8 #include "base/process/launch.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // -u in the python invocation! | 152 // -u in the python invocation! |
153 CommandLine pywebsocket_command(CommandLine::NO_PROGRAM); | 153 CommandLine pywebsocket_command(CommandLine::NO_PROGRAM); |
154 EXPECT_TRUE(GetPythonCommand(&pywebsocket_command)); | 154 EXPECT_TRUE(GetPythonCommand(&pywebsocket_command)); |
155 | 155 |
156 pywebsocket_command.AppendArgPath(pywebsocket_server); | 156 pywebsocket_command.AppendArgPath(pywebsocket_server); |
157 pywebsocket_command.AppendArg("-p"); | 157 pywebsocket_command.AppendArg("-p"); |
158 pywebsocket_command.AppendArg(kPyWebSocketPortNumber); | 158 pywebsocket_command.AppendArg(kPyWebSocketPortNumber); |
159 pywebsocket_command.AppendArg("-d"); | 159 pywebsocket_command.AppendArg("-d"); |
160 pywebsocket_command.AppendArgPath(path_to_data_handler); | 160 pywebsocket_command.AppendArgPath(path_to_data_handler); |
161 | 161 |
162 LOG(INFO) << "Running " << pywebsocket_command.GetCommandLineString(); | 162 VLOG(0) << "Running " << pywebsocket_command.GetCommandLineString(); |
163 return base::LaunchProcess(pywebsocket_command, base::LaunchOptions(), | 163 return base::LaunchProcess(pywebsocket_command, base::LaunchOptions(), |
164 &pywebsocket_server_); | 164 &pywebsocket_server_); |
165 } | 165 } |
166 | 166 |
167 bool ShutdownPyWebSocketServer() { | 167 bool ShutdownPyWebSocketServer() { |
168 return base::KillProcess(pywebsocket_server_, 0, false); | 168 return base::KillProcess(pywebsocket_server_, 0, false); |
169 } | 169 } |
170 | 170 |
171 // Ensures we didn't get any errors asynchronously (e.g. while no javascript | 171 // Ensures we didn't get any errors asynchronously (e.g. while no javascript |
172 // call from this test was outstanding). | 172 // call from this test was outstanding). |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 converter_command.AppendSwitchPath("--frames_dir", GetWorkingDir()); | 222 converter_command.AppendSwitchPath("--frames_dir", GetWorkingDir()); |
223 converter_command.AppendSwitchPath("--output_file", | 223 converter_command.AppendSwitchPath("--output_file", |
224 captured_video_filename); | 224 captured_video_filename); |
225 converter_command.AppendSwitchASCII("--width", | 225 converter_command.AppendSwitchASCII("--width", |
226 base::StringPrintf("%d", width)); | 226 base::StringPrintf("%d", width)); |
227 converter_command.AppendSwitchASCII("--height", | 227 converter_command.AppendSwitchASCII("--height", |
228 base::StringPrintf("%d", height)); | 228 base::StringPrintf("%d", height)); |
229 | 229 |
230 // We produce an output file that will later be used as an input to the | 230 // We produce an output file that will later be used as an input to the |
231 // barcode decoder and frame analyzer tools. | 231 // barcode decoder and frame analyzer tools. |
232 LOG(INFO) << "Running " << converter_command.GetCommandLineString(); | 232 VLOG(0) << "Running " << converter_command.GetCommandLineString(); |
233 std::string result; | 233 std::string result; |
234 bool ok = base::GetAppOutput(converter_command, &result); | 234 bool ok = base::GetAppOutput(converter_command, &result); |
235 LOG(INFO) << "Output was:\n\n" << result; | 235 VLOG(0) << "Output was:\n\n" << result; |
236 return ok; | 236 return ok; |
237 } | 237 } |
238 | 238 |
239 // Compares the |captured_video_filename| with the |reference_video_filename|. | 239 // Compares the |captured_video_filename| with the |reference_video_filename|. |
240 // | 240 // |
241 // The barcode decoder decodes the captured video containing barcodes overlaid | 241 // The barcode decoder decodes the captured video containing barcodes overlaid |
242 // into every frame of the video (produced by rgba_to_i420_converter). It | 242 // into every frame of the video (produced by rgba_to_i420_converter). It |
243 // produces a set of PNG images and a |stats_file| that maps each captured | 243 // produces a set of PNG images and a |stats_file| that maps each captured |
244 // frame to a frame in the reference video. The frames should be of size | 244 // frame to a frame in the reference video. The frames should be of size |
245 // |width| x |height|. | 245 // |width| x |height|. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 compare_command.AppendArgPath(captured_video_filename); | 280 compare_command.AppendArgPath(captured_video_filename); |
281 compare_command.AppendArg("--frame_analyzer"); | 281 compare_command.AppendArg("--frame_analyzer"); |
282 compare_command.AppendArgPath(path_to_analyzer); | 282 compare_command.AppendArgPath(path_to_analyzer); |
283 compare_command.AppendArg("--yuv_frame_width"); | 283 compare_command.AppendArg("--yuv_frame_width"); |
284 compare_command.AppendArg(base::StringPrintf("%d", width)); | 284 compare_command.AppendArg(base::StringPrintf("%d", width)); |
285 compare_command.AppendArg("--yuv_frame_height"); | 285 compare_command.AppendArg("--yuv_frame_height"); |
286 compare_command.AppendArg(base::StringPrintf("%d", height)); | 286 compare_command.AppendArg(base::StringPrintf("%d", height)); |
287 compare_command.AppendArg("--stats_file"); | 287 compare_command.AppendArg("--stats_file"); |
288 compare_command.AppendArgPath(stats_file); | 288 compare_command.AppendArgPath(stats_file); |
289 | 289 |
290 LOG(INFO) << "Running " << compare_command.GetCommandLineString(); | 290 VLOG(0) << "Running " << compare_command.GetCommandLineString(); |
291 std::string output; | 291 std::string output; |
292 bool ok = base::GetAppOutput(compare_command, &output); | 292 bool ok = base::GetAppOutput(compare_command, &output); |
293 // Print to stdout to ensure the perf numbers are parsed properly by the | 293 // Print to stdout to ensure the perf numbers are parsed properly by the |
294 // buildbot step. | 294 // buildbot step. |
295 printf("Output was:\n\n%s\n", output.c_str()); | 295 printf("Output was:\n\n%s\n", output.c_str()); |
296 return ok; | 296 return ok; |
297 } | 297 } |
298 | 298 |
299 base::FilePath GetWorkingDir() { | 299 base::FilePath GetWorkingDir() { |
300 std::string home_dir; | 300 std::string home_dir; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 ASSERT_TRUE( | 375 ASSERT_TRUE( |
376 CompareVideosAndPrintResult(kVgaWidth, | 376 CompareVideosAndPrintResult(kVgaWidth, |
377 kVgaHeight, | 377 kVgaHeight, |
378 GetWorkingDir().Append(kCapturedYuvFileName), | 378 GetWorkingDir().Append(kCapturedYuvFileName), |
379 GetWorkingDir().Append(kReferenceYuvFileName), | 379 GetWorkingDir().Append(kReferenceYuvFileName), |
380 GetWorkingDir().Append(kStatsFileName))); | 380 GetWorkingDir().Append(kStatsFileName))); |
381 | 381 |
382 ASSERT_TRUE(peerconnection_server_.Stop()); | 382 ASSERT_TRUE(peerconnection_server_.Stop()); |
383 ASSERT_TRUE(ShutdownPyWebSocketServer()); | 383 ASSERT_TRUE(ShutdownPyWebSocketServer()); |
384 } | 384 } |
OLD | NEW |