• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 MOCK_OHOS_AAFWK_ABILITY_SCHEDULER_INTERFACE_H
17 #define MOCK_OHOS_AAFWK_ABILITY_SCHEDULER_INTERFACE_H
18 
19 #include "want.h"
20 #include "lifecycle_state_info.h"
21 #include "gmock/gmock.h"
22 #include "ability_scheduler_interface.h"
23 
24 namespace OHOS {
25 namespace AAFwk {
26 class MockAbilityScheduler : public IAbilityScheduler {
27 public:
28     MOCK_METHOD2(ScheduleAbilityTransaction, void(const Want &want, const LifeCycleStateInfo &targetState));
29     MOCK_METHOD3(SendResult, void(int requestCode, int resultCode, const Want &resultWant));
30     MOCK_METHOD1(ScheduleConnectAbility, void(const Want &want));
31     MOCK_METHOD1(ScheduleDisconnectAbility, void(const Want &want));
32     MOCK_METHOD3(ScheduleCommandAbility, void(const Want &want, bool restart, int startid));
33     MOCK_METHOD0(AsObject, sptr<IRemoteObject>());
34     MOCK_METHOD1(ScheduleSaveAbilityState, void(PacMap &outState));
35     MOCK_METHOD1(ScheduleRestoreAbilityState, void(const PacMap &inState));
36     MOCK_METHOD1(ScheduleUpdateConfiguration, void(const DummyConfiguration &));
37     MOCK_METHOD1(ScheduleNewWant, void(const Want &want));
38     MOCK_METHOD1(NotifyTopActiveAbilityChanged, void(bool flag));
39     MOCK_METHOD2(NotifyMultiWinModeChanged, void(int32_t winModeKey, bool flag));
40     MOCK_METHOD2(ScheduleRegisterObserver, bool(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver));
41     MOCK_METHOD2(
42         ScheduleUnregisterObserver, bool(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver));
43     MOCK_METHOD1(ScheduleNotifyChange, bool(const Uri &uri));
44     MOCK_METHOD1(ExecuteBatch, std::vector<std::shared_ptr<AppExecFwk::DataAbilityResult>>(const std::vector<std::shared_ptr<AppExecFwk::DataAbilityOperation>> &operations));
GetFileTypes(const Uri & uri,const std::string & mimeTypeFilter)45     std::vector<std::string> GetFileTypes(const Uri &uri, const std::string &mimeTypeFilter)
46     {
47         std::vector<std::string> types;
48         return types;
49     }
50 
OpenFile(const Uri & uri,const std::string & mode)51     int OpenFile(const Uri &uri, const std::string &mode)
52     {
53         return -1;
54     }
55 
Insert(const Uri & uri,const NativeRdb::ValuesBucket & value)56     int Insert(const Uri &uri, const NativeRdb::ValuesBucket &value)
57     {
58         return -1;
59     }
60 
Update(const Uri & uri,const NativeRdb::ValuesBucket & value,const NativeRdb::DataAbilityPredicates & predicates)61     int Update(const Uri &uri, const NativeRdb::ValuesBucket &value, const NativeRdb::DataAbilityPredicates &predicates)
62     {
63         return -1;
64     }
65 
Delete(const Uri & uri,const NativeRdb::DataAbilityPredicates & predicates)66     int Delete(const Uri &uri, const NativeRdb::DataAbilityPredicates &predicates)
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)
73     {
74         return nullptr;
75     }
76 
GetType(const Uri & uri)77     virtual std::string GetType(const Uri &uri) override
78     {
79         return " ";
80     }
81 
OpenRawFile(const Uri & uri,const std::string & mode)82     virtual int OpenRawFile(const Uri &uri, const std::string &mode) override
83     {
84         return -1;
85     }
86 
Reload(const Uri & uri,const PacMap & extras)87     virtual bool Reload(const Uri &uri, const PacMap &extras) override
88     {
89         return false;
90     }
91 
BatchInsert(const Uri & uri,const std::vector<NativeRdb::ValuesBucket> & values)92     virtual int BatchInsert(const Uri &uri, const std::vector<NativeRdb::ValuesBucket> &values) override
93     {
94         return -1;
95     }
96 
NormalizeUri(const Uri & uri)97     virtual Uri NormalizeUri(const Uri &uri) override
98     {
99         Uri urivalue("");
100         return urivalue;
101     }
102 
DenormalizeUri(const Uri & uri)103     virtual Uri DenormalizeUri(const Uri &uri) override
104     {
105         Uri urivalue("");
106         return urivalue;
107     }
108 };
109 }  // namespace AAFwk
110 }  // namespace OHOS
111 
112 #endif  // MOCK_OHOS_AAFWK_ABILITY_SCHEDULER_INTERFACE_H
113