• 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_CLOUD_SYNC_SERVICE_H
17 #define MOCK_I_CLOUD_SYNC_SERVICE_H
18 
19 #include "i_cloud_sync_service.h"
20 
21 #include <gmock/gmock.h>
22 #include <gtest/gtest.h>
23 
24 #include "iremote_broker.h"
25 #include "cloud_sync_constants.h"
26 #include "dfs_error.h"
27 
28 namespace OHOS::FileManagement::CloudSync {
29 class CloudSyncServiceMock : public IRemoteStub<ICloudSyncService> {
30 public:
31     int code_;
CloudSyncServiceMock()32     CloudSyncServiceMock() : code_(0) {}
~CloudSyncServiceMock()33     virtual ~CloudSyncServiceMock() {}
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(E_OK);
41         return E_OK;
42     }
43 
UnRegisterCallbackInner()44     int32_t UnRegisterCallbackInner() override
45     {
46         return E_OK;
47     }
48 
RegisterCallbackInner(const sptr<IRemoteObject> & remoteObject)49     int32_t RegisterCallbackInner(const sptr<IRemoteObject> &remoteObject) override
50     {
51         return E_OK;
52     }
53 
StartSyncInner(bool forceFlag)54     int32_t StartSyncInner(bool forceFlag) override
55     {
56         return E_OK;
57     }
58 
StopSyncInner()59     int32_t StopSyncInner() override
60     {
61         return E_OK;
62     }
63 
ChangeAppSwitch(const std::string & accoutId,const std::string & bundleName,bool status)64     int32_t ChangeAppSwitch(const std::string &accoutId, const std::string &bundleName, bool status) override
65     {
66         return E_OK;
67     }
68 
Clean(const std::string & accountId,const CleanOptions & cleanOptions)69     int32_t Clean(const std::string &accountId, const CleanOptions &cleanOptions) override
70     {
71         return E_OK;
72     }
73 
NotifyDataChange(const std::string & accoutId,const std::string & bundleName)74     int32_t NotifyDataChange(const std::string &accoutId, const std::string &bundleName) override
75     {
76         return E_OK;
77     }
EnableCloud(const std::string & accoutId,const SwitchDataObj & switchData)78     int32_t EnableCloud(const std::string &accoutId, const SwitchDataObj &switchData) override
79     {
80         return E_OK;
81     }
DisableCloud(const std::string & accoutId)82     int32_t DisableCloud(const std::string &accoutId) override
83     {
84         return E_OK;
85     }
StartDownloadFile(const std::string & path)86     int32_t StartDownloadFile(const std::string &path)
87     {
88         return E_OK;
89     }
StopDownloadFile(const std::string & path)90     int32_t StopDownloadFile(const std::string &path)
91     {
92         return E_OK;
93     }
RegisterDownloadFileCallback(const sptr<IRemoteObject> & downloadCallback)94     int32_t RegisterDownloadFileCallback(const sptr<IRemoteObject> &downloadCallback)
95     {
96         return E_OK;
97     }
UnregisterDownloadFileCallback()98     int32_t UnregisterDownloadFileCallback()
99     {
100         return E_OK;
101     }
UploadAsset(const int32_t userId,const std::string & request,std::string & result)102     int32_t UploadAsset(const int32_t userId, const std::string &request, std::string &result)
103     {
104         return E_OK;
105     }
DownloadFile(const int32_t userId,const std::string & bundleName,AssetInfoObj & assetInfoObj)106     int32_t DownloadFile(const int32_t userId, const std::string &bundleName, AssetInfoObj &assetInfoObj)
107     {
108         return E_OK;
109     }
110 };
111 
112 } // namespace OHOS::FileManagement::CloudSync
113 
114 #endif // MOCK_I_CLOUD_SYNC_SERVICE_H
115