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 OHOS_MOCK_BUNDLE_INSTALLER_SERVICE_H
17 #define OHOS_MOCK_BUNDLE_INSTALLER_SERVICE_H
18 
19 #include "bundle_installer_interface.h"
20 #include "gmock/gmock.h"
21 #include "iremote_object.h"
22 #include "iremote_stub.h"
23 
24 namespace OHOS {
25 class MockBundleInstallerService : public IRemoteStub<AppExecFwk::IBundleInstaller> {
26 public:
MockBundleInstallerService()27     MockBundleInstallerService() {};
~MockBundleInstallerService()28     virtual ~MockBundleInstallerService() {};
29     MOCK_METHOD3(Install,
30         bool(const std::string &, const AppExecFwk::InstallParam &, const sptr<AppExecFwk::IStatusReceiver> &));
31     MOCK_METHOD4(OnRemoteRequest, int(uint32_t, MessageParcel &, MessageParcel &, MessageOption &));
32     MOCK_METHOD3(Recover,
33         bool(const std::string &, const AppExecFwk::InstallParam &, const sptr<AppExecFwk::IStatusReceiver> &));
34     MOCK_METHOD3(Install, bool(const std::vector<std::string> &, const AppExecFwk::InstallParam &,
35                               const sptr<AppExecFwk::IStatusReceiver> &));
36     MOCK_METHOD3(Uninstall,
37         bool(const std::string &, const AppExecFwk::InstallParam &, const sptr<AppExecFwk::IStatusReceiver> &));
38     MOCK_METHOD4(Uninstall, bool(const std::string &, const std::string &, const AppExecFwk::InstallParam &,
39                                 const sptr<AppExecFwk::IStatusReceiver> &));
40     MOCK_METHOD2(Uninstall, bool(const AppExecFwk::UninstallParam &, const sptr<AppExecFwk::IStatusReceiver> &));
41     MOCK_METHOD4(InstallSandboxApp, ErrCode(const std::string &, int32_t, int32_t, int32_t &));
42     MOCK_METHOD3(UninstallSandboxApp, ErrCode(const std::string &, int32_t, int32_t));
43     MOCK_METHOD3(CreateStreamInstaller, sptr<AppExecFwk::IBundleStreamInstaller>(const AppExecFwk::InstallParam &,
44                                             const sptr<AppExecFwk::IStatusReceiver> &,
45                                             const std::vector<std::string> &));
46     MOCK_METHOD1(DestoryBundleStreamInstaller, bool(uint32_t));
47     MOCK_METHOD3(StreamInstall, ErrCode(const std::vector<std::string> &, const AppExecFwk::InstallParam &,
48                                     const sptr<AppExecFwk::IStatusReceiver> &));
49 };
50 } // namespace OHOS
51 #endif // OHOS_MOCK_BUNDLE_INSTALLER_SERVICE_H