Artem Titov | 40a7a35 | 2018-10-15 13:25:34 | [diff] [blame] | 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 | |
| 13 | #include <memory> |
Mirko Bonadei | 2ab97f6 | 2019-07-18 11:44:12 | [diff] [blame] | 14 | #include <string> |
Artem Titov | 40a7a35 | 2018-10-15 13:25:34 | [diff] [blame] | 15 | |
| 16 | namespace webrtc { |
| 17 | |
| 18 | // Class to initialize test environment and run tests. |
| 19 | class TestMain { |
| 20 | public: |
| 21 | virtual ~TestMain() {} |
| 22 | |
| 23 | static std::unique_ptr<TestMain> Create(); |
| 24 | |
| 25 | // Initializes test environment. Clients can add their own initialization |
| 26 | // steps after call to this method and before running tests. |
| 27 | // Returns 0 if initialization was successful and non 0 otherwise. |
Artem Titov | b5541a0 | 2018-10-17 15:37:47 | [diff] [blame] | 28 | virtual int Init(int* argc, char* argv[]) = 0; |
Artem Titov | 40a7a35 | 2018-10-15 13:25:34 | [diff] [blame] | 29 | |
| 30 | // Runs test end return result error code. 0 - no errors. |
| 31 | virtual int Run(int argc, char* argv[]) = 0; |
| 32 | |
| 33 | protected: |
| 34 | TestMain() = default; |
Mirko Bonadei | 2ab97f6 | 2019-07-18 11:44:12 | [diff] [blame] | 35 | |
| 36 | std::string field_trials_; |
Artem Titov | 40a7a35 | 2018-10-15 13:25:34 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | } // namespace webrtc |
| 40 | |
| 41 | #endif // TEST_TEST_MAIN_LIB_H_ |