• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 #ifndef BASE_ABILITYRUNTIME_MOCK_IQUERYERMSOBSERVER_H
16 #define BASE_ABILITYRUNTIME_MOCK_IQUERYERMSOBSERVER_H
17 
18 #include "query_erms_observer_interface.h"
19 
20 namespace OHOS {
21 namespace AbilityRuntime {
22 
23 class IQueryERMSObserverMock : public IQueryERMSObserver {
24 public:
25     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.aafwk.IQueryERMSObserver");
26 
OnQueryFinished(const std::string & appId,const std::string & startTime,const AtomicServiceStartupRule & rule,int resultCode)27     void OnQueryFinished(const std::string &appId, const std::string &startTime,
28                          const AtomicServiceStartupRule &rule, int resultCode)
29     {
30         return;
31     }
AsObject()32     sptr<IRemoteObject> AsObject()
33     {
34         return nullptr;
35     }
36     enum {
37         ON_QUERY_FINISHED = 1,
38     };
39 };
40 
41 class MockIRemoteObject : public IRemoteObject {
42 public:
MockIRemoteObject()43     MockIRemoteObject() : IRemoteObject(u"mock_i_remote_object") {}
44 
~MockIRemoteObject()45     ~MockIRemoteObject() {}
46 
GetObjectRefCount()47     int32_t GetObjectRefCount() override
48     {
49         return 0;
50     }
51 
SendRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)52     int SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override
53     {
54         return 0;
55     }
56 
IsProxyObject()57     bool IsProxyObject() const override
58     {
59         return true;
60     }
61 
CheckObjectLegality()62     bool CheckObjectLegality() const override
63     {
64         return true;
65     }
66 
AddDeathRecipient(const sptr<DeathRecipient> & recipient)67     bool AddDeathRecipient(const sptr<DeathRecipient> &recipient) override
68     {
69         return true;
70     }
71 
RemoveDeathRecipient(const sptr<DeathRecipient> & recipient)72     bool RemoveDeathRecipient(const sptr<DeathRecipient> &recipient) override
73     {
74         return true;
75     }
76 
Marshalling(Parcel & parcel)77     bool Marshalling(Parcel &parcel) const override
78     {
79         return true;
80     }
81 
AsInterface()82     sptr<IRemoteBroker> AsInterface() override
83     {
84         return nullptr;
85     }
86 
Dump(int fd,const std::vector<std::u16string> & args)87     int Dump(int fd, const std::vector<std::u16string> &args) override
88     {
89         return 0;
90     }
91 
GetObjectDescriptor()92     std::u16string GetObjectDescriptor() const
93     {
94         std::u16string descriptor = std::u16string();
95         return descriptor;
96     }
97 };
98 } // namespace AbilityRuntime
99 } // namespace OHOS
100 #endif