run_all_perftests.cc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Copyright 2014 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/test/launcher/unit_test_launcher.h"
  6. #include "base/test/test_suite.h"
  7. #include "build/build_config.h"
  8. #include "media/base/media.h"
  9. class TestSuiteNoAtExit : public base::TestSuite {
  10. public:
  11. TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv) {}
  12. ~TestSuiteNoAtExit() override = default;
  13. protected:
  14. void Initialize() override;
  15. };
  16. void TestSuiteNoAtExit::Initialize() {
  17. // Run TestSuite::Initialize first so that logging is initialized.
  18. base::TestSuite::Initialize();
  19. // Run this here instead of main() to ensure an AtExitManager is already
  20. // present.
  21. media::InitializeMediaLibrary();
  22. }
  23. int main(int argc, char** argv) {
  24. TestSuiteNoAtExit test_suite(argc, argv);
  25. // Always run the perf tests serially, to avoid distorting
  26. // perf measurements with randomness resulting from running
  27. // in parallel.
  28. return base::LaunchUnitTestsSerially(
  29. argc, argv,
  30. base::BindOnce(&TestSuiteNoAtExit::Run, base::Unretained(&test_suite)));
  31. }