1 /* 2 * Copyright (c) 2021 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 TEST_UTILS_H_ 17 #define TEST_UTILS_H_ 18 #include "ability_info.h" 19 #include "application_info.h" 20 #include "process_info.h" 21 #include "want.h" 22 23 namespace OHOS { 24 namespace AppExecFwk { 25 using namespace OHOS::AAFwk; 26 const std::string EVENT_RESP_LIFECYCLE_CALLBACK = "resp_com_ohos_amsst_appkit_service_ability_lifecycle_callbacks"; 27 const std::string EVENT_RESP_LIFECYCLE_OBSERVER = "resp_com_ohos_amsst_appkit_service_lifecycle_observer"; 28 const std::string EVENT_RESP_FIRST_ABILITY = "resp_com_ohos_amsst_appkit_service_mainabilitydemo"; 29 const std::string EVENT_RESP_SECOND_ABILITY = "resp_com_ohos_amsst_appkit_service_secondability"; 30 const std::string EVENT_RESP_KITTEST_COMPLETE = "resp_com_ohos_amsst_appkit_service_kittest_completed"; 31 const std::string EVENT_REQU_KITTEST = "requ_com_ohos_amsst_appkit_service_kittest"; 32 const std::string EVENT_RESP_SECOND_ABILITY_CONTEXT = 33 "resp_com_ohos_amsst_appkit_service_secondability_ability_context"; 34 const std::string EVENT_REQU_KITTEST_SECOND = "resp_com_ohos_amsst_appkit_service_secondability_kittest"; 35 36 const std::string APP_LIFE_CYCLE_CALL_BACKS_RESP_EVENT_NAME = "resp_com_ohos_amsst_service_app_life_cycle_call_backs"; 37 const std::string APP_LIFE_CYCLE_CALL_BACKS_REQ_EVENT_NAME = "req_com_ohos_amsst_service_app_life_cycle_call_backs"; 38 39 const std::string APP_ABILITY_CONTEXT_RESP_EVENT_NAME = "resp_com_ohos_amsst_service_app_ability_context"; 40 const std::string APP_ABILITY_CONTEXT_REQ_EVENT_NAME = "req_com_ohos_amsst_service_app_ability_context"; 41 42 const std::string APP_ABILITY_RESP_EVENT_NAME = "resp_com_ohos_amsst_service_app_ability"; 43 const std::string APP_ABILITY_REQ_EVENT_NAME = "req_com_ohos_amsst_service_app_ability"; 44 45 const std::string APP_ABILITY_CONNECTION_RESP_EVENT_NAME = "resp_com_ohos_amsst_service_app_ability_connection"; 46 const std::string APP_ABILITY_CONNECTION_REQ_EVENT_NAME = "req_com_ohos_amsst_service_app_ability_connection"; 47 48 const std::string APP_ABILITY_LIFE_CYCLE_RESP_EVENT_NAME = "resp_com_ohos_amsst_service_app_ability_life_cycle"; 49 const std::string APP_ABILITY_LIFE_CYCLE_REQ_EVENT_NAME = "req_com_ohos_amsst_service_app_ability_life_cycle"; 50 51 const std::string APP_LIFE_CYCLE_OBSERVER_RESP_EVENT_NAME = "resp_com_ohos_amsst_service_app_life_cycle_observer"; 52 const std::string APP_LIFE_CYCLE_OBSERVER_REQ_EVENT_NAME = "req_com_ohos_amsst_service_app_life_cycle_observer"; 53 54 enum class CaseIndex { 55 ONE = 1, 56 TWO = 2, 57 THREE = 3, 58 FOUR = 4, 59 FIVE = 5, 60 SIX = 6, 61 SEVEN = 7, 62 EIGHT = 8, 63 NINE = 9, 64 TEN = 10, 65 ELEVEN = 11, 66 TWELVE = 12, 67 THIRTEEN = 13, 68 FOURTEEN = 14, 69 FIFTEEN = 15, 70 SIXTEEN = 16, 71 SEVENTEEN = 17, 72 EIGHTEEN = 18, 73 NINETEEN = 19, 74 TWENTY = 20, 75 HANDRED = 1024, 76 }; 77 78 class TestUtils { 79 public: 80 TestUtils() = default; 81 virtual ~TestUtils() = default; 82 static bool PublishEvent(const std::string &eventName, const int &code, const std::string &data); 83 static Want MakeWant(std::string deviceId, std::string abilityName, std::string bundleName, 84 std::map<std::string, std::string> params); 85 }; 86 } // namespace AppExecFwk 87 } // namespace OHOS 88 #endif // TEST_UTILS_H_