1545fdf9bSopenharmony_ci/*
2545fdf9bSopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd.
3545fdf9bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4545fdf9bSopenharmony_ci * you may not use this file except in compliance with the License.
5545fdf9bSopenharmony_ci * You may obtain a copy of the License at
6545fdf9bSopenharmony_ci *
7545fdf9bSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8545fdf9bSopenharmony_ci *
9545fdf9bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10545fdf9bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11545fdf9bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12545fdf9bSopenharmony_ci * See the License for the specific language governing permissions and
13545fdf9bSopenharmony_ci * limitations under the License.
14545fdf9bSopenharmony_ci */
15545fdf9bSopenharmony_ci
16545fdf9bSopenharmony_ci#ifndef FOUNDATION_APPEXECFWK_STANDARD_TOOLS_TEST_MOCK_MOCK_BUNDLE_INSTALLER_HOST_H
17545fdf9bSopenharmony_ci#define FOUNDATION_APPEXECFWK_STANDARD_TOOLS_TEST_MOCK_MOCK_BUNDLE_INSTALLER_HOST_H
18545fdf9bSopenharmony_ci
19545fdf9bSopenharmony_ci#include "gmock/gmock.h"
20545fdf9bSopenharmony_ci
21545fdf9bSopenharmony_ci#include "iremote_stub.h"
22545fdf9bSopenharmony_ci#include "bundle_installer_interface.h"
23545fdf9bSopenharmony_ci
24545fdf9bSopenharmony_ci#include "app_log_wrapper.h"
25545fdf9bSopenharmony_ci#include "bundle_installer_host.h"
26545fdf9bSopenharmony_ci
27545fdf9bSopenharmony_cinamespace OHOS {
28545fdf9bSopenharmony_cinamespace AppExecFwk {
29545fdf9bSopenharmony_cinamespace {
30545fdf9bSopenharmony_ciconst std::string MSG_SUCCESS = "[SUCCESS]";
31545fdf9bSopenharmony_ciconst std::string STRING_BUNDLE_PATH = "/data/test/bundle_test/testdemo.hap";
32545fdf9bSopenharmony_ciconst std::string STRING_OTHER_BUNDLE_PATH = "/data/test/bundle_test/othertestdemo.hap";
33545fdf9bSopenharmony_ciconst std::string STRING_BUNDLE_INSTALL_PATH1 = "../../test/bundle_test1/";
34545fdf9bSopenharmony_ciconst std::string STRING_BUNDLE_INSTALL_PATH2 = "../../test/bundle_test2/";
35545fdf9bSopenharmony_ciconst std::string STRING_BUNDLE_NAME = "name";
36545fdf9bSopenharmony_ciconst std::string STRING_MODULE_NAME = "module";
37545fdf9bSopenharmony_ciconst std::string STRING_ABILITY_NAME = "ability";
38545fdf9bSopenharmony_ciconst std::string DEFAULT_USER_ID = "100";
39545fdf9bSopenharmony_ciconst std::string ERR_USER_ID = "-1";
40545fdf9bSopenharmony_ciconst std::string DEFAULT_WAIT_TIME = "200";
41545fdf9bSopenharmony_ciconst std::string MINIMUMT_WAIT_TIME = "1";
42545fdf9bSopenharmony_ciconst std::string MAXIMUM_WAIT_TIME = "700";
43545fdf9bSopenharmony_ciconst std::string DEFAULT_DEVICE_TIME = "0";
44545fdf9bSopenharmony_ciconst std::string STRING_SIGNATURE_FILE_PATH = "/data/test/bundle_test/test.sig";
45545fdf9bSopenharmony_ciconst std::string STRING_TEST_BUNDLE_PATH = "/data/test/";
46545fdf9bSopenharmony_ciconst std::string STRING_DATA_TEST = "/data/test/demoTest/";
47545fdf9bSopenharmony_ciconst std::string STRING_EMPTY = "";
48545fdf9bSopenharmony_ci}  // namespace
49545fdf9bSopenharmony_ci
50545fdf9bSopenharmony_ciclass MockBundleInstallerHost : public IRemoteStub<IBundleInstaller> {
51545fdf9bSopenharmony_cipublic:
52545fdf9bSopenharmony_ci    MockBundleInstallerHost();
53545fdf9bSopenharmony_ci    ~MockBundleInstallerHost() override;
54545fdf9bSopenharmony_ci    bool Install(const std::string &bundleFilePath, const InstallParam &installParam,
55545fdf9bSopenharmony_ci        const sptr<IStatusReceiver> &statusReceiver);
56545fdf9bSopenharmony_ci    bool Install(const std::vector<std::string> &bundleFilePath, const InstallParam &installParam,
57545fdf9bSopenharmony_ci        const sptr<IStatusReceiver> &statusReceiver);
58545fdf9bSopenharmony_ci    bool Uninstall(
59545fdf9bSopenharmony_ci        const std::string &bundleName, const InstallParam &installParam, const sptr<IStatusReceiver> &statusReceiver);
60545fdf9bSopenharmony_ci
61545fdf9bSopenharmony_ci    bool Uninstall(const std::string &bundleName, const std::string &modulePackage, const InstallParam &installParam,
62545fdf9bSopenharmony_ci        const sptr<IStatusReceiver> &statusReceiver);
63545fdf9bSopenharmony_ci
64545fdf9bSopenharmony_ci    bool Uninstall(const UninstallParam &uninstallParam, const sptr<IStatusReceiver> &statusReceiver);
65545fdf9bSopenharmony_ci
66545fdf9bSopenharmony_ci    bool Recover(const std::string &bundleName, const InstallParam &installParam,
67545fdf9bSopenharmony_ci        const sptr<IStatusReceiver> &statusReceiver);
68545fdf9bSopenharmony_ci
69545fdf9bSopenharmony_ci    ErrCode StreamInstall(const std::vector<std::string> &bundleFilePaths, const InstallParam &installParam,
70545fdf9bSopenharmony_ci        const sptr<IStatusReceiver> &statusReceiver);
71545fdf9bSopenharmony_ci
72545fdf9bSopenharmony_ci    ErrCode InstallSandboxApp(const std::string &bundleName, int32_t dplType, int32_t userId,
73545fdf9bSopenharmony_ci        int32_t &appIndex);
74545fdf9bSopenharmony_ci
75545fdf9bSopenharmony_ci    ErrCode UninstallSandboxApp(const std::string &bundleName, int32_t appIndex, int32_t userId);
76545fdf9bSopenharmony_ci
77545fdf9bSopenharmony_ci    sptr<IBundleStreamInstaller> CreateStreamInstaller(const InstallParam &installParam,
78545fdf9bSopenharmony_ci        const sptr<IStatusReceiver> &statusReceiver);
79545fdf9bSopenharmony_ci
80545fdf9bSopenharmony_ci    bool DestoryBundleStreamInstaller(uint32_t streamInstallerId);
81545fdf9bSopenharmony_ciprivate:
82545fdf9bSopenharmony_ci    DISALLOW_COPY_AND_MOVE(MockBundleInstallerHost);
83545fdf9bSopenharmony_ci};
84545fdf9bSopenharmony_ci}  // namespace AppExecFwk
85545fdf9bSopenharmony_ci}  // namespace OHOS
86545fdf9bSopenharmony_ci
87545fdf9bSopenharmony_ci#endif  // FOUNDATION_APPEXECFWK_STANDARD_TOOLS_TEST_MOCK_MOCK_BUNDLE_INSTALLER_HOST_H
88