test_main_lib.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef TEST_TEST_MAIN_LIB_H_
  11. #define TEST_TEST_MAIN_LIB_H_
  12. #include <memory>
  13. #include <string>
  14. namespace webrtc {
  15. // Class to initialize test environment and run tests.
  16. class TestMain {
  17. public:
  18. virtual ~TestMain() {}
  19. static std::unique_ptr<TestMain> Create();
  20. // Initializes test environment. Clients can add their own initialization
  21. // steps after call to this method and before running tests.
  22. // Returns 0 if initialization was successful and non 0 otherwise.
  23. virtual int Init() = 0;
  24. // Temporary for backward compatibility
  25. virtual int Init(int* argc, char* argv[]) = 0;
  26. // Runs test end return result error code. 0 - no errors.
  27. virtual int Run(int argc, char* argv[]) = 0;
  28. protected:
  29. TestMain() = default;
  30. std::string field_trials_;
  31. };
  32. } // namespace webrtc
  33. #endif // TEST_TEST_MAIN_LIB_H_