/* * Copyright (c) 2020 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef OHOS_ABILITY_TEST_HELPER_H #define OHOS_ABILITY_TEST_HELPER_H #include #include #include #include #include #include #include "ipc_skeleton.h" namespace OHOS { struct SliceRecord { std::string name; State state; }; class AbilityTestHelper { public: AbilityTestHelper() = delete; ~AbilityTestHelper() = delete; static void Initialize(); static void UnInitialize(); static void InstallCallback(const uint8_t resultCode, const void *resultMessage); static void UninstallCallback(const uint8_t resultCode, const void *resultMessage); static int32_t AbilityCallback(uint32_t code, IpcIo *data, IpcIo *reply, MessageOption option); static bool TestInstall(const std::string &hap); static bool TestUnInstall(const std::string &bundleName); static bool TestStartAbility(const Want &want); static bool TestTerminateApp(const std::string &bundleName); static State GetAbilityState(const ElementName &elementName); static std::list> GetSliceStack(const ElementName &elementName); private: static IClientProxy *GetAbilityInnerFeature(); static void TestDumpAbility(const ElementName &elementName); static void SemWait(); static void SemPost(); static SvcIdentity identity_; static IClientProxy *proxy_; static IpcObjectStub objectStub_; }; } #endif // OHOS_ABILITY_TEST_HELPER_H