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