dawn_end2end_tests_main.cc 1.5 KB

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