1 /* 2 * Copyright (c) 2021-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 UNITTEST_OHOS_ABILITY_RUNTIME_ABILITY_SCHEDULE_STUB_MOCK_H 17 #define UNITTEST_OHOS_ABILITY_RUNTIME_ABILITY_SCHEDULE_STUB_MOCK_H 18 #include "ability_scheduler_stub.h" 19 20 namespace OHOS { 21 namespace AAFwk { 22 class AbilitySchedulerStubMock : public AbilitySchedulerStub { 23 public: ScheduleAbilityTransaction(const Want & want,const LifeCycleStateInfo & targetState)24 void ScheduleAbilityTransaction(const Want &want, const LifeCycleStateInfo &targetState) override 25 {} 26 SendResult(int requestCode,int resultCode,const Want & resultWant)27 void SendResult(int requestCode, int resultCode, const Want &resultWant) override 28 {} 29 ScheduleConnectAbility(const Want & want)30 void ScheduleConnectAbility(const Want &want) override 31 {} 32 ScheduleDisconnectAbility(const Want & want)33 void ScheduleDisconnectAbility(const Want &want) override 34 {} 35 ScheduleCommandAbility(const Want & want,bool restart,int startId)36 void ScheduleCommandAbility(const Want &want, bool restart, int startId) override 37 {} 38 ScheduleSaveAbilityState()39 void ScheduleSaveAbilityState() override 40 {} ScheduleRestoreAbilityState(const PacMap & inState)41 void ScheduleRestoreAbilityState(const PacMap &inState) override 42 {} 43 GetFileTypes(const Uri & uri,const std::string & mimeTypeFilter)44 std::vector<std::string> GetFileTypes(const Uri &uri, const std::string &mimeTypeFilter) override 45 { 46 std::vector<std::string> types; 47 return types; 48 } 49 OpenFile(const Uri & uri,const std::string & mode)50 int OpenFile(const Uri &uri, const std::string &mode) override 51 { 52 return -1; 53 } 54 Insert(const Uri & uri,const NativeRdb::ValuesBucket & value)55 int Insert(const Uri &uri, const NativeRdb::ValuesBucket &value) override 56 { 57 return -1; 58 } 59 Update(const Uri & uri,const NativeRdb::ValuesBucket & value,const NativeRdb::DataAbilityPredicates & predicates)60 int Update(const Uri &uri, 61 const NativeRdb::ValuesBucket &value, const NativeRdb::DataAbilityPredicates &predicates) override 62 { 63 return -1; 64 } 65 Delete(const Uri & uri,const NativeRdb::DataAbilityPredicates & predicates)66 int Delete(const Uri &uri, const NativeRdb::DataAbilityPredicates &predicates) override 67 { 68 return -1; 69 } 70 Query(const Uri & uri,std::vector<std::string> & columns,const NativeRdb::DataAbilityPredicates & predicates)71 std::shared_ptr<NativeRdb::AbsSharedResultSet> Query( 72 const Uri &uri, std::vector<std::string> &columns, const NativeRdb::DataAbilityPredicates &predicates) override 73 { 74 return nullptr; 75 } 76 Call(const Uri & uri,const std::string & method,const std::string & arg,const AppExecFwk::PacMap & pacMap)77 std::shared_ptr<AppExecFwk::PacMap> Call( 78 const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap) override 79 { 80 return nullptr; 81 } 82 GetType(const Uri & uri)83 std::string GetType(const Uri &uri) override 84 { 85 return " "; 86 } 87 OpenRawFile(const Uri & uri,const std::string & mode)88 int OpenRawFile(const Uri &uri, const std::string &mode) override 89 { 90 return -1; 91 } 92 Reload(const Uri & uri,const PacMap & extras)93 bool Reload(const Uri &uri, const PacMap &extras) override 94 { 95 return false; 96 } 97 BatchInsert(const Uri & uri,const std::vector<NativeRdb::ValuesBucket> & values)98 int BatchInsert(const Uri &uri, const std::vector<NativeRdb::ValuesBucket> &values) override 99 { 100 return -1; 101 } 102 NormalizeUri(const Uri & uri)103 Uri NormalizeUri(const Uri &uri) override 104 { 105 Uri urivalue(""); 106 return urivalue; 107 } 108 DenormalizeUri(const Uri & uri)109 Uri DenormalizeUri(const Uri &uri) override 110 { 111 Uri urivalue(""); 112 return urivalue; 113 } 114 ScheduleRegisterObserver(const Uri & uri,const sptr<IDataAbilityObserver> & dataObserver)115 bool ScheduleRegisterObserver(const Uri &uri, const sptr<IDataAbilityObserver> &dataObserver) override 116 { 117 return true; 118 } ScheduleUnregisterObserver(const Uri & uri,const sptr<IDataAbilityObserver> & dataObserver)119 bool ScheduleUnregisterObserver(const Uri &uri, const sptr<IDataAbilityObserver> &dataObserver) override 120 { 121 return true; 122 } ScheduleNotifyChange(const Uri & uri)123 bool ScheduleNotifyChange(const Uri &uri) override 124 { 125 return true; 126 } ExecuteBatch(const std::vector<std::shared_ptr<AppExecFwk::DataAbilityOperation>> & operations)127 std::vector<std::shared_ptr<AppExecFwk::DataAbilityResult>> ExecuteBatch( 128 const std::vector<std::shared_ptr<AppExecFwk::DataAbilityOperation>> &operations) override 129 { 130 return std::vector<std::shared_ptr<AppExecFwk::DataAbilityResult>>(); 131 } NotifyContinuationResult(int32_t result)132 void NotifyContinuationResult(int32_t result) override 133 {} ContinueAbility(const std::string & deviceId,uint32_t versionCode)134 void ContinueAbility(const std::string& deviceId, uint32_t versionCode) override 135 {} DumpAbilityInfo(const std::vector<std::string> & params,std::vector<std::string> & info)136 void DumpAbilityInfo(const std::vector<std::string> ¶ms, std::vector<std::string> &info) override 137 {} CallRequest()138 void CallRequest() override 139 { 140 return; 141 } 142 #ifdef ABILITY_COMMAND_FOR_TEST BlockAbility()143 int BlockAbility() override 144 { 145 return 0; 146 } 147 #endif 148 }; 149 } // namespace AAFwk 150 } // namespace OHOS 151 152 #endif 153