• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "bundle_info.h"
22 
23 namespace OHOS {
24 namespace AbilityRuntime {
25 const std::string CAPITALTESTRUNNER = "/ets/TestRunner/";
26 const std::string LOWERCASETESTRUNNER = "/ets/testrunner/";
27 class Runtime;
28 }
29 
30 namespace AppExecFwk {
31 class TestRunner {
32 public:
33     /**
34      * Creates a TestRunner instance with the input parameter passed.
35      *
36      * @param runtime Indicates the ability runtime.
37      * @param args Indicates the AbilityDelegatorArgs object.
38      * @return the TestRunner object if TestRunner object is created successfully; returns null otherwise.
39      */
40     static std::unique_ptr<TestRunner> Create(const std::unique_ptr<AbilityRuntime::Runtime> &runtime,
41         const std::shared_ptr<AbilityDelegatorArgs> &args, bool isFaJsModel);
42 
43     /**
44      * Default constructor used to create a TestRunner instance.
45      */
46     TestRunner() = default;
47 
48     /**
49      * Default deconstructor used to deconstruct.
50      */
51     virtual ~TestRunner() = default;
52 
53     /**
54      * Prepares the testing environment for running test code.
55      */
56     virtual void Prepare();
57 
58     /**
59      * Runs all test code.
60      */
61     virtual void Run();
62 
63     /**
64      * Initialize runtime only fo ace 1.0.
65      */
66     virtual bool Initialize();
67 };
68 }  // namespace AppExecFwk
69 }  // namespace OHOS
70 
71 #endif  // OHOS_ABILITY_RUNTIME_TEST_RUNNER_H
72