• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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_I_DAEMON_H
17 #define MOCK_I_DAEMON_H
18 
19 #include <gmock/gmock.h>
20 #include <gtest/gtest.h>
21 
22 #include "dfs_error.h"
23 #include "ipc/i_daemon.h"
24 #include "iremote_stub.h"
25 #include "iremote_broker.h"
26 
27 
28 namespace OHOS::Storage::DistributedFile {
29 class DaemonServiceMock : public IRemoteStub<IDaemon> {
30 public:
31     int code_;
DaemonServiceMock()32     DaemonServiceMock() : code_(0) {}
~DaemonServiceMock()33     virtual ~DaemonServiceMock() {}
34 
35     MOCK_METHOD4(SendRequest, int(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option));
36 
InvokeSendRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)37     int32_t InvokeSendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
38     {
39         code_ = code;
40         reply.WriteInt32(FileManagement::E_OK);
41         return FileManagement::E_OK;
42     }
43 
OpenP2PConnection(const DistributedHardware::DmDeviceInfo & deviceInfo)44     int32_t OpenP2PConnection(const DistributedHardware::DmDeviceInfo &deviceInfo)
45     {
46         return FileManagement::E_OK;
47     }
48 
CloseP2PConnection(const DistributedHardware::DmDeviceInfo & deviceInfo)49     int32_t CloseP2PConnection(const DistributedHardware::DmDeviceInfo &deviceInfo)
50     {
51         return FileManagement::E_OK;
52     }
53 };
54 
55 } // namespace OHOS::Storage::DistributedFile
56 
57 #endif // MOCK_I_DAEMON_H
58