1885b47fbSopenharmony_ci/* 2885b47fbSopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd. 3885b47fbSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4885b47fbSopenharmony_ci * you may not use this file except in compliance with the License. 5885b47fbSopenharmony_ci * You may obtain a copy of the License at 6885b47fbSopenharmony_ci * 7885b47fbSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8885b47fbSopenharmony_ci * 9885b47fbSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10885b47fbSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11885b47fbSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12885b47fbSopenharmony_ci * See the License for the specific language governing permissions and 13885b47fbSopenharmony_ci * limitations under the License. 14885b47fbSopenharmony_ci */ 15885b47fbSopenharmony_ci 16885b47fbSopenharmony_ci#ifndef MOCK_BUNDLE_MANAGER_H 17885b47fbSopenharmony_ci#define MOCK_BUNDLE_MANAGER_H 18885b47fbSopenharmony_ci 19885b47fbSopenharmony_ci#include <gmock/gmock.h> 20885b47fbSopenharmony_ci#include <vector> 21885b47fbSopenharmony_ci#include "ability_info.h" 22885b47fbSopenharmony_ci#include "application_info.h" 23885b47fbSopenharmony_ci#include "bundlemgr/bundle_mgr_interface.h" 24885b47fbSopenharmony_ci#include "iremote_proxy.h" 25885b47fbSopenharmony_ci#include "iremote_stub.h" 26885b47fbSopenharmony_ci#include "want.h" 27885b47fbSopenharmony_ci 28885b47fbSopenharmony_cinamespace OHOS { 29885b47fbSopenharmony_cinamespace AppExecFwk { 30885b47fbSopenharmony_ciconst std::string COM_IX_HIWORLD = "com.ix.hiworld"; 31885b47fbSopenharmony_ciconst std::string COM_IX_HIMUSIC = "com.ix.hiMusic"; 32885b47fbSopenharmony_ciconst std::string COM_IX_HIRADIO = "com.ix.hiRadio"; 33885b47fbSopenharmony_ciconst std::string COM_IX_HISERVICE = "com.ix.hiService"; 34885b47fbSopenharmony_ciconst std::string COM_IX_MUSICSERVICE = "com.ix.musicService"; 35885b47fbSopenharmony_ciconst std::string COM_IX_HIDATA = "com.ix.hiData"; 36885b47fbSopenharmony_ci 37885b47fbSopenharmony_ciclass BundleMgrStub : public IRemoteStub<IBundleMgr> { 38885b47fbSopenharmony_cipublic: 39885b47fbSopenharmony_ci DECLARE_INTERFACE_DESCRIPTOR(u"IBundleMgr"); 40885b47fbSopenharmony_ci int OnRemoteRequest( 41885b47fbSopenharmony_ci uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override; 42885b47fbSopenharmony_ci}; 43885b47fbSopenharmony_ci 44885b47fbSopenharmony_ciclass BundleMgrService : public BundleMgrStub { 45885b47fbSopenharmony_cipublic: 46885b47fbSopenharmony_ci bool QueryAbilityInfo(const AAFwk::Want& want, AbilityInfo& abilityInfo) override; 47885b47fbSopenharmony_ci bool GetApplicationInfo( 48885b47fbSopenharmony_ci const std::string& appName, const ApplicationFlag flag, const int userId, ApplicationInfo& appInfo) override; 49885b47fbSopenharmony_ci 50885b47fbSopenharmony_ci bool GetBundleInfo(const std::string& bundleName, const BundleFlag flag, BundleInfo& bundleInfo, 51885b47fbSopenharmony_ci int32_t userId = Constants::UNSPECIFIED_USERID) override; 52885b47fbSopenharmony_ci 53885b47fbSopenharmony_ci BundleMgrService(); 54885b47fbSopenharmony_ci 55885b47fbSopenharmony_ci virtual ~BundleMgrService() 56885b47fbSopenharmony_ci {} 57885b47fbSopenharmony_ci 58885b47fbSopenharmony_ci bool CheckWantEntity(const AAFwk::Want&, AbilityInfo&); 59885b47fbSopenharmony_ci 60885b47fbSopenharmony_cipublic: 61885b47fbSopenharmony_ci using QueryAbilityInfoFunType = 62885b47fbSopenharmony_ci std::function<bool(std::string bundleName, AbilityInfo& abilityInfo, ElementName& elementTemp)>; 63885b47fbSopenharmony_ci std::map<std::string, QueryAbilityInfoFunType> abilityInfoMap_; 64885b47fbSopenharmony_ci}; 65885b47fbSopenharmony_ci} // namespace AppExecFwk 66885b47fbSopenharmony_ci} // namespace OHOS 67885b47fbSopenharmony_ci#endif // MOCK_BUNDLE_MANAGER_H 68