1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_ABILITY_RUNTIME_TEST_RUNNER_H 17 #define OHOS_ABILITY_RUNTIME_TEST_RUNNER_H 18 19 #include <memory> 20 #include "ability_delegator_args.h" 21 22 namespace OHOS { 23 namespace AbilityRuntime { 24 class Runtime; 25 } 26 27 namespace AppExecFwk { 28 class TestRunner { 29 public: 30 /** 31 * Creates a TestRunner instance with the input parameter passed. 32 * 33 * @param runtime Indicates the ability runtime. 34 * @param args Indicates the AbilityDelegatorArgs object. 35 * @return the TestRunner object if TestRunner object is created successfully; returns null otherwise. 36 */ 37 static std::unique_ptr<TestRunner> Create(const std::unique_ptr<AbilityRuntime::Runtime> &runtime, 38 const std::shared_ptr<AbilityDelegatorArgs> &args, bool isFaJsModel); 39 40 /** 41 * Default constructor used to create a TestRunner instance. 42 */ 43 TestRunner() = default; 44 45 /** 46 * Default deconstructor used to deconstruct. 47 */ 48 virtual ~TestRunner() = default; 49 50 /** 51 * Prepares the testing environment for running test code. 52 */ 53 virtual void Prepare(); 54 55 /** 56 * Runs all test code. 57 */ 58 virtual void Run(); 59 60 /** 61 * Initialize runtime only fo ace 1.0. 62 */ 63 virtual bool Initialize(); 64 }; 65 } // namespace AppExecFwk 66 } // namespace OHOS 67 68 #endif // OHOS_ABILITY_RUNTIME_TEST_RUNNER_H 69