swiftshader_tests_main.cc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2017 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. class SwiftShaderTestEnvironment : public testing::Environment {
  19. public:
  20. void SetUp() override {}
  21. void TearDown() override {}
  22. };
  23. int main(int argc, char** argv) {
  24. base::CommandLine::Init(argc, argv);
  25. testing::InitGoogleMock(&argc, argv);
  26. testing::AddGlobalTestEnvironment(new SwiftShaderTestEnvironment());
  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 test timeout.
  34. base::BindOnce(&RunHelper, base::Unretained(&test_suite)));
  35. return rt;
  36. }