Commit 372610a8 authored by Chih-Yu Huang's avatar Chih-Yu Huang Committed by Commit Bot

media/gpu: VDA tests and perf tests uses base::TestLauncher.

In CL:1679774 we added a TestLauncher specific argument for each
Chrome test binary at Tast framework. However, currently VDA test and
VDA perf test doesn't use base::TestLauncher, so they failed at
parsing arguments.
In this CL, we use base::TestLauncher at both VDA tests and perf
tests.

BUG=chromium:985179
TEST=./video_decode_accelerator_tests --test-launcher-timeout=3600000

Change-Id: I8155aae78be81bedcb252bfbdb534760e788d3be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1708150Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Reviewed-by: default avatarDavid Staessens <dstaessens@chromium.org>
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#678603}
parent 643ffcf2
...@@ -602,6 +602,7 @@ test("video_decode_accelerator_tests") { ...@@ -602,6 +602,7 @@ test("video_decode_accelerator_tests") {
"test:video_player", "test:video_player",
"test:video_player_test_environment", "test:video_player_test_environment",
"test:video_player_thumbnail_renderer", "test:video_player_thumbnail_renderer",
"//base/test:test_support",
"//media:test_support", "//media:test_support",
"//testing/gtest", "//testing/gtest",
] ]
...@@ -618,6 +619,7 @@ test("video_decode_accelerator_perf_tests") { ...@@ -618,6 +619,7 @@ test("video_decode_accelerator_perf_tests") {
":buildflags", ":buildflags",
"test:video_player", "test:video_player",
"test:video_player_test_environment", "test:video_player_test_environment",
"//base/test:test_support",
"//media:test_support", "//media:test_support",
"//testing/gtest", "//testing/gtest",
] ]
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/json/json_writer.h" #include "base/json/json_writer.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h"
#include "media/base/test_data_util.h" #include "media/base/test_data_util.h"
#include "media/gpu/test/video_player/frame_renderer_dummy.h" #include "media/gpu/test/video_player/frame_renderer_dummy.h"
#include "media/gpu/test/video_player/video.h" #include "media/gpu/test/video_player/video.h"
...@@ -377,7 +379,7 @@ int main(int argc, char** argv) { ...@@ -377,7 +379,7 @@ int main(int argc, char** argv) {
LOG_ASSERT(cmd_line); LOG_ASSERT(cmd_line);
if (cmd_line->HasSwitch("help")) { if (cmd_line->HasSwitch("help")) {
std::cout << media::test::usage_msg << "\n" << media::test::help_msg; std::cout << media::test::usage_msg << "\n" << media::test::help_msg;
return 0; return EXIT_SUCCESS;
} }
// Check if a video was specified on the command line. // Check if a video was specified on the command line.
...@@ -393,8 +395,11 @@ int main(int argc, char** argv) { ...@@ -393,8 +395,11 @@ int main(int argc, char** argv) {
base::CommandLine::SwitchMap switches = cmd_line->GetSwitches(); base::CommandLine::SwitchMap switches = cmd_line->GetSwitches();
for (base::CommandLine::SwitchMap::const_iterator it = switches.begin(); for (base::CommandLine::SwitchMap::const_iterator it = switches.begin();
it != switches.end(); ++it) { it != switches.end(); ++it) {
if (it->first.find("gtest_") == 0 || // Handled by GoogleTest // Ignore arguments handled by Chrome, GoogleTest, and base::TestLauncher.
it->first == "v" || it->first == "vmodule") { // Handled by Chrome if (it->first == "v" || it->first == "vmodule" ||
it->first.find("gtest_") == 0 ||
it->first.find("test-launcher") != std::string::npos ||
it->first == "single-process-tests") {
continue; continue;
} }
...@@ -422,5 +427,8 @@ int main(int argc, char** argv) { ...@@ -422,5 +427,8 @@ int main(int argc, char** argv) {
media::test::g_env = static_cast<media::test::VideoPlayerTestEnvironment*>( media::test::g_env = static_cast<media::test::VideoPlayerTestEnvironment*>(
testing::AddGlobalTestEnvironment(test_environment)); testing::AddGlobalTestEnvironment(test_environment));
return RUN_ALL_TESTS(); base::TestSuite test_suite(argc, argv);
return base::LaunchUnitTestsSerially(
argc, argv,
base::BindOnce(&base::TestSuite::Run, base::Unretained(&test_suite)));
} }
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/command_line.h" #include "base/command_line.h"
#include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h"
#include "media/base/test_data_util.h" #include "media/base/test_data_util.h"
#include "media/gpu/test/video_frame_file_writer.h" #include "media/gpu/test/video_frame_file_writer.h"
#include "media/gpu/test/video_frame_validator.h" #include "media/gpu/test/video_frame_validator.h"
...@@ -324,7 +326,7 @@ int main(int argc, char** argv) { ...@@ -324,7 +326,7 @@ int main(int argc, char** argv) {
LOG_ASSERT(cmd_line); LOG_ASSERT(cmd_line);
if (cmd_line->HasSwitch("help")) { if (cmd_line->HasSwitch("help")) {
std::cout << media::test::usage_msg << "\n" << media::test::help_msg; std::cout << media::test::usage_msg << "\n" << media::test::help_msg;
return 0; return EXIT_SUCCESS;
} }
// Check if a video was specified on the command line. // Check if a video was specified on the command line.
...@@ -342,8 +344,11 @@ int main(int argc, char** argv) { ...@@ -342,8 +344,11 @@ int main(int argc, char** argv) {
base::CommandLine::SwitchMap switches = cmd_line->GetSwitches(); base::CommandLine::SwitchMap switches = cmd_line->GetSwitches();
for (base::CommandLine::SwitchMap::const_iterator it = switches.begin(); for (base::CommandLine::SwitchMap::const_iterator it = switches.begin();
it != switches.end(); ++it) { it != switches.end(); ++it) {
if (it->first.find("gtest_") == 0 || // Handled by GoogleTest // Ignore arguments handled by Chrome, GoogleTest, and base::TestLauncher.
it->first == "v" || it->first == "vmodule") { // Handled by Chrome if (it->first == "v" || it->first == "vmodule" ||
it->first.find("gtest_") == 0 ||
it->first.find("test-launcher") != std::string::npos ||
it->first == "single-process-tests") {
continue; continue;
} }
...@@ -375,5 +380,8 @@ int main(int argc, char** argv) { ...@@ -375,5 +380,8 @@ int main(int argc, char** argv) {
media::test::g_env = static_cast<media::test::VideoPlayerTestEnvironment*>( media::test::g_env = static_cast<media::test::VideoPlayerTestEnvironment*>(
testing::AddGlobalTestEnvironment(test_environment)); testing::AddGlobalTestEnvironment(test_environment));
return RUN_ALL_TESTS(); base::TestSuite test_suite(argc, argv);
return base::LaunchUnitTestsSerially(
argc, argv,
base::BindOnce(&base::TestSuite::Run, base::Unretained(&test_suite)));
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment