dawn_end2end_tests_main.cc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // 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. #include "base/bind.h"
  5. #include "base/command_line.h"
  6. #include "base/task/single_thread_task_executor.h"
  7. #include "base/test/launcher/unit_test_launcher.h"
  8. #include "base/test/test_suite.h"
  9. #include "testing/gmock/include/gmock/gmock.h"
  10. #include "testing/gtest/include/gtest/gtest.h"
  11. namespace {
  12. int RunHelper(base::TestSuite* test_suite) {
  13. base::SingleThreadTaskExecutor task_executor;
  14. return test_suite->Run();
  15. }
  16. } // namespace
  17. // Definition located in third_party/dawn/src/tests/DawnTest.h
  18. // Forward declared here to avoid pulling in the Dawn headers.
  19. void InitDawnEnd2EndTestEnvironment(int argc, char** argv);
  20. int main(int argc, char** argv) {
  21. base::CommandLine::Init(argc, argv);
  22. // Environment initialization is done before test initialization
  23. // so tests can be instantiated for each available GPU adapter.
  24. InitDawnEnd2EndTestEnvironment(argc, argv);
  25. testing::InitGoogleMock(&argc, argv);
  26. base::TestSuite test_suite(argc, argv);
  27. int rt = base::LaunchUnitTestsWithOptions(
  28. argc, argv,
  29. 1, // Run tests serially.
  30. 0, // Disable batching.
  31. true, // Use job objects.
  32. base::BindOnce(&RunHelper, base::Unretained(&test_suite)));
  33. return rt;
  34. }