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 UNITTEST_OHOS_ABILITY_RUNTIME_WANT_RECEIVER_STUB_IMPL_MOCK_H 17 #define UNITTEST_OHOS_ABILITY_RUNTIME_WANT_RECEIVER_STUB_IMPL_MOCK_H 18 19 #define private public 20 #include "want_receiver_stub.h" 21 #undef private 22 23 #include <gmock/gmock.h> 24 #include <iremote_object.h> 25 #include <iremote_stub.h> 26 #include "want_sender_interface.h" 27 28 namespace OHOS { 29 namespace AAFwk { 30 class WantReceiverStubImplMock : public WantReceiverStub { 31 public: WantReceiverStubImplMock()32 WantReceiverStubImplMock() 33 {} ~WantReceiverStubImplMock()34 virtual ~WantReceiverStubImplMock() 35 {} 36 InvokeSendRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)37 int InvokeSendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) 38 { 39 code_ = code; 40 return 0; 41 } 42 InvokeErrorSendRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)43 int InvokeErrorSendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) 44 { 45 code_ = code; 46 return UNKNOWN_ERROR; 47 } 48 49 int code_ = 0; 50 Send(const int32_t resultCode)51 virtual void Send(const int32_t resultCode) {}; PerformReceive(const Want & want,int resultCode,const std::string & data,const WantParams & extras,bool serialized,bool sticky,int sendingUser)52 virtual void PerformReceive(const Want &want, int resultCode, const std::string &data, const WantParams &extras, 53 bool serialized, bool sticky, int sendingUser) {}; 54 }; 55 } // namespace AAFwk 56 } // namespace OHOS 57 58 #endif // UNITTEST_OHOS_ABILITY_RUNTIME_WANT_RECEIVER_STUB_IMPL_MOCK_H 59