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_ABILITY_DELEGATOR_ARGS_H 17 #define OHOS_ABILITY_RUNTIME_ABILITY_DELEGATOR_ARGS_H 18 19 #include <map> 20 #include <string> 21 22 #include "want.h" 23 24 namespace OHOS { 25 namespace AppExecFwk { 26 class AbilityDelegatorArgs { 27 public: 28 /** 29 * Indicates the key of test bundle name. 30 */ 31 static const std::string KEY_TEST_BUNDLE_NAME; 32 /** 33 * Indicates the key of test package name. 34 */ 35 static const std::string KEY_TEST_PACKAGE_NAME; 36 /** 37 * Indicates the key of test module name. 38 */ 39 static const std::string KEY_TEST_MODULE_NAME; 40 /** 41 * Indicates the key of test runner class name. 42 */ 43 static const std::string KEY_TEST_RUNNER_CLASS; 44 /** 45 * Indicates the key of test case name. 46 */ 47 static const std::string KEY_TEST_CASE; 48 /** 49 * Indicates the key of test wait timeout. 50 */ 51 static const std::string KEY_TEST_WAIT_TIMEOUT; 52 /** 53 * Indicates the key of debug flag. 54 */ 55 static const std::string KEY_TEST_DEBUG; 56 /** 57 * Indicates the value of debug flag. 58 */ 59 static const std::string VALUE_TEST_DEBUG; 60 61 public: 62 /** 63 * Default constructor used to create a AbilityDelegatorArgs instance. 64 */ 65 AbilityDelegatorArgs() = default; 66 virtual ~AbilityDelegatorArgs() = default; 67 68 /** 69 * A constructor used to create a AbilityDelegatorArgs instance with the input parameter passed. 70 * 71 * @param want Indicates the Want that contains parameters. 72 */ 73 explicit AbilityDelegatorArgs(const AAFwk::Want &want); 74 75 /** 76 * Obtains the bundle name of the application being tested. 77 * 78 * @return the application bundle name. 79 */ 80 std::string GetTestBundleName() const; 81 82 /** 83 * Obtains the package name of the application being tested. 84 * 85 * @return the application package name. 86 */ 87 std::string GetTestPackageName() const; 88 89 /** 90 * Obtains the module name of the application being tested. 91 * 92 * @return the application module name. 93 */ 94 std::string GetTestModuleName() const; 95 96 /** 97 * Obtains the class name of the test runner used to execute test cases. 98 * 99 * @return the class name of the test runner. 100 */ 101 std::string GetTestRunnerClassName() const; 102 103 /** 104 * Obtains the test cases name. 105 * 106 * @return the test cases name. 107 */ 108 std::string GetTestCaseName() const; 109 110 /** 111 * Obtains the test parameters. 112 * 113 * @return the test parameters. 114 */ 115 std::map<std::string, std::string> GetTestParam() const; 116 117 /** 118 * Find debug flag. 119 * 120 * @return true if found, false otherwise. 121 */ 122 bool FindDebugFlag() const; 123 124 private: 125 std::string GetParamValue(const std::string &key) const; 126 127 private: 128 std::string bundleName_; 129 std::map<std::string, std::string> params_; 130 }; 131 } // namespace AppExecFwk 132 } // namespace OHOS 133 134 #endif // OHOS_ABILITY_RUNTIME_ABILITY_DELEGATOR_ARGS_H 135