1 /* 2 * Copyright (c) 2022 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 EDM_UNIT_TEST_ENTERPRISE_ADMIN_STUB_MOCK_H 17 #define EDM_UNIT_TEST_ENTERPRISE_ADMIN_STUB_MOCK_H 18 19 #include <gmock/gmock.h> 20 #include <iremote_stub.h> 21 #include <map> 22 23 #include "ienterprise_admin.h" 24 25 namespace OHOS { 26 namespace EDM { 27 class EnterpriseAdminStubMock : public IRemoteStub<IEnterpriseAdmin> { 28 public: EnterpriseAdminStubMock()29 EnterpriseAdminStubMock() : code_(0) {} 30 ~EnterpriseAdminStubMock()31 virtual ~EnterpriseAdminStubMock() {} 32 33 MOCK_METHOD4(SendRequest, int(uint32_t, MessageParcel &, MessageParcel &, MessageOption &)); 34 InvokeSendRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)35 int InvokeSendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) 36 { 37 code_ = code; 38 return 0; 39 } 40 OnAdminEnabled()41 void OnAdminEnabled() override {} 42 OnAdminDisabled()43 void OnAdminDisabled() override {} 44 OnBundleAdded(const std::string & bundleName,int32_t accountId)45 void OnBundleAdded(const std::string &bundleName, int32_t accountId) override {} 46 OnBundleRemoved(const std::string & bundleName,int32_t accountId)47 void OnBundleRemoved(const std::string &bundleName, int32_t accountId) override {} 48 OnAppStart(const std::string & bundleName)49 void OnAppStart(const std::string &bundleName) override {} 50 OnAppStop(const std::string & bundleName)51 void OnAppStop(const std::string &bundleName) override {} 52 OnSystemUpdate(const UpdateInfo & updateInfo)53 void OnSystemUpdate(const UpdateInfo &updateInfo) override {} 54 55 uint32_t code_ = 0; 56 }; 57 } // namespace EDM 58 } // namespace OHOS 59 #endif // EDM_UNIT_TEST_ENTERPRISE_ADMIN_STUB_MOCK_H 60 61