gl_tests_main.cc 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright (c) 2012 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/at_exit.h"
  5. #include "base/bind.h"
  6. #include "base/command_line.h"
  7. #include "base/message_loop/message_pump.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 "build/build_config.h"
  12. #include "gpu/command_buffer/tests/gl_test_setup_helper.h"
  13. #include "gpu/command_buffer/tests/gl_test_utils.h"
  14. #include "mojo/core/embedder/embedder.h"
  15. #include "testing/gmock/include/gmock/gmock.h"
  16. #if BUILDFLAG(IS_MAC)
  17. #include "base/mac/scoped_nsautorelease_pool.h"
  18. #endif
  19. namespace {
  20. class GlTestsSuite : public base::TestSuite {
  21. public:
  22. GlTestsSuite(int argc, char** argv) : base::TestSuite(argc, argv) {}
  23. protected:
  24. void Initialize() override {
  25. base::TestSuite::Initialize();
  26. gl_setup_ = std::make_unique<gpu::GLTestSetupHelper>();
  27. }
  28. private:
  29. std::unique_ptr<gpu::GLTestSetupHelper> gl_setup_;
  30. };
  31. } // namespace
  32. int main(int argc, char** argv) {
  33. base::CommandLine::Init(argc, argv);
  34. mojo::core::Init();
  35. GlTestsSuite gl_tests_suite(argc, argv);
  36. #if BUILDFLAG(IS_MAC)
  37. base::mac::ScopedNSAutoreleasePool pool;
  38. #endif
  39. testing::InitGoogleMock(&argc, argv);
  40. return base::LaunchUnitTestsSerially(
  41. argc, argv,
  42. base::BindOnce(&GlTestsSuite::Run, base::Unretained(&gl_tests_suite)));
  43. }