blob: 9df19252fc9ab7933d60b8d84481859c3e276a91 [file] [log] [blame]
Corentin Wallez0b71452b2018-10-30 17:35:001// Copyright 2018 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "base/bind.h"
6#include "base/command_line.h"
Carlos Caballeroa1f7a0d2019-06-12 08:20:347#include "base/task/single_thread_task_executor.h"
Corentin Wallez0b71452b2018-10-30 17:35:008#include "base/test/launcher/unit_test_launcher.h"
9#include "base/test/test_suite.h"
10#include "testing/gmock/include/gmock/gmock.h"
11#include "testing/gtest/include/gtest/gtest.h"
12
13namespace {
14
15int RunHelper(base::TestSuite* test_suite) {
Carlos Caballeroa1f7a0d2019-06-12 08:20:3416 base::SingleThreadTaskExecutor task_executor;
Corentin Wallez0b71452b2018-10-30 17:35:0017 return test_suite->Run();
18}
19
20} // namespace
21
Corentin Wallez248a1fa2019-02-20 12:05:0522// Definition located in third_party/dawn/src/tests/DawnTest.h
23// Forward declared here to avoid pulling in the Dawn headers.
24void InitDawnEnd2EndTestEnvironment(int argc, char** argv);
25
Corentin Wallez0b71452b2018-10-30 17:35:0026int main(int argc, char** argv) {
27 base::CommandLine::Init(argc, argv);
Austin Eng9b8406b2020-05-11 13:19:1128
29 // Environment initialization is done before test initialization
30 // so tests can be instantiated for each available GPU adapter.
31 InitDawnEnd2EndTestEnvironment(argc, argv);
32
Corentin Wallez0b71452b2018-10-30 17:35:0033 testing::InitGoogleMock(&argc, argv);
34 base::TestSuite test_suite(argc, argv);
Corentin Wallez0b71452b2018-10-30 17:35:0035 int rt = base::LaunchUnitTestsWithOptions(
36 argc, argv,
37 1, // Run tests serially.
38 0, // Disable batching.
39 true, // Use job objects.
40 base::BindOnce(&RunHelper, base::Unretained(&test_suite)));
41 return rt;
42}