1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/command_line.h"
6 #include "base/functional/bind.h"
7 #include "base/functional/callback_helpers.h"
8 #include "base/task/single_thread_task_executor.h"
9 #include "base/test/launcher/unit_test_launcher.h"
10 #include "base/test/test_suite.h"
11 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h"
16 int RunHelper(base::TestSuite* test_suite) {
17 base::SingleThreadTaskExecutor task_executor;
18 return test_suite->Run();
23 class SwiftShaderTestEnvironment : public testing::Environment {
25 void SetUp() override {}
26 void TearDown() override {}
29 int main(int argc, char** argv) {
30 base::CommandLine::Init(argc, argv);
31 testing::InitGoogleMock(&argc, argv);
32 testing::AddGlobalTestEnvironment(new SwiftShaderTestEnvironment());
33 base::TestSuite test_suite(argc, argv);
34 int rt = base::LaunchUnitTestsWithOptions(
36 1, // Run tests serially.
37 0, // Disable batching.
38 true, // Use job objects.
39 base::DoNothing(), // No special action on test timeout.
40 base::BindOnce(&RunHelper, base::Unretained(&test_suite)));