OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <string> | 5 #include <string> |
6 | 6 |
7 // This has to be included first. | 7 // This has to be included first. |
8 // See http://code.google.com/p/googletest/issues/detail?id=371 | 8 // See http://code.google.com/p/googletest/issues/detail?id=371 |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
| 11 #include "base/at_exit.h" |
11 #include "base/bind.h" | 12 #include "base/bind.h" |
12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
13 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/message_loop/message_loop.h" |
15 #include "content/common/gpu/media/vaapi_h264_decoder.h" | 17 #include "content/common/gpu/media/vaapi_h264_decoder.h" |
16 #include "media/base/video_decoder_config.h" | 18 #include "media/base/video_decoder_config.h" |
17 #include "third_party/libyuv/include/libyuv.h" | 19 #include "third_party/libyuv/include/libyuv.h" |
18 | 20 |
| 21 #if defined(USE_OZONE) |
| 22 #include "ui/ozone/public/ozone_platform.h" |
| 23 #endif |
| 24 |
19 // This program is run like this: | 25 // This program is run like this: |
20 // DISPLAY=:0 ./vaapi_h264_decoder_unittest --input_file input.h264 | 26 // DISPLAY=:0 ./vaapi_h264_decoder_unittest --input_file input.h264 |
21 // [--output_file output.i420] [--md5sum expected_md5_hex] | 27 // [--output_file output.i420] [--md5sum expected_md5_hex] |
22 // | 28 // |
23 // The input is read from input.h264. The output is written to output.i420 if it | 29 // The input is read from input.h264. The output is written to output.i420 if it |
24 // is given. It also verifies the MD5 sum of the decoded I420 data if the | 30 // is given. It also verifies the MD5 sum of the decoded I420 data if the |
25 // expected MD5 sum is given. | 31 // expected MD5 sum is given. |
26 | 32 |
27 namespace content { | 33 namespace content { |
28 namespace { | 34 namespace { |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 334 } |
329 } | 335 } |
330 | 336 |
331 } // namespace | 337 } // namespace |
332 } // namespace content | 338 } // namespace content |
333 | 339 |
334 int main(int argc, char** argv) { | 340 int main(int argc, char** argv) { |
335 testing::InitGoogleTest(&argc, argv); // Removes gtest-specific args. | 341 testing::InitGoogleTest(&argc, argv); // Removes gtest-specific args. |
336 base::CommandLine::Init(argc, argv); | 342 base::CommandLine::Init(argc, argv); |
337 | 343 |
| 344 base::ShadowingAtExitManager at_exit_manager; |
| 345 |
338 // Needed to enable DVLOG through --vmodule. | 346 // Needed to enable DVLOG through --vmodule. |
339 logging::LoggingSettings settings; | 347 logging::LoggingSettings settings; |
340 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 348 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
341 CHECK(logging::InitLogging(settings)); | 349 CHECK(logging::InitLogging(settings)); |
342 | 350 |
343 // Process command line. | 351 // Process command line. |
344 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 352 base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
345 CHECK(cmd_line); | 353 CHECK(cmd_line); |
346 | 354 |
347 base::CommandLine::SwitchMap switches = cmd_line->GetSwitches(); | 355 base::CommandLine::SwitchMap switches = cmd_line->GetSwitches(); |
348 for (base::CommandLine::SwitchMap::const_iterator it = switches.begin(); | 356 for (base::CommandLine::SwitchMap::const_iterator it = switches.begin(); |
349 it != switches.end(); | 357 it != switches.end(); |
350 ++it) { | 358 ++it) { |
351 if (it->first == "input_file") { | 359 if (it->first == "input_file") { |
352 content::g_input_file = base::FilePath(it->second); | 360 content::g_input_file = base::FilePath(it->second); |
353 continue; | 361 continue; |
354 } | 362 } |
355 if (it->first == "output_file") { | 363 if (it->first == "output_file") { |
356 content::g_output_file = base::FilePath(it->second); | 364 content::g_output_file = base::FilePath(it->second); |
357 continue; | 365 continue; |
358 } | 366 } |
359 if (it->first == "md5sum") { | 367 if (it->first == "md5sum") { |
360 content::g_md5sum = it->second; | 368 content::g_md5sum = it->second; |
361 continue; | 369 continue; |
362 } | 370 } |
363 if (it->first == "v" || it->first == "vmodule") | 371 if (it->first == "v" || it->first == "vmodule") |
364 continue; | 372 continue; |
| 373 if (it->first == "ozone-platform") |
| 374 continue; |
365 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 375 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
366 } | 376 } |
367 | 377 |
| 378 #if defined(USE_OZONE) |
| 379 base::MessageLoopForUI main_loop; |
| 380 ui::OzonePlatform::InitializeForUI(); |
| 381 ui::OzonePlatform::InitializeForGPU(); |
| 382 #endif |
| 383 |
368 return RUN_ALL_TESTS(); | 384 return RUN_ALL_TESTS(); |
369 } | 385 } |
OLD | NEW |