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 #ifndef MOCK_PRINT_CALLBACK_STUB_H 16 #define MOCK_PRINT_CALLBACK_STUB_H 17 18 #include <gmock/gmock.h> 19 #include "print_callback_stub.h" 20 21 namespace OHOS { 22 namespace Print { 23 class DummyPrintCallbackStub : public PrintCallbackStub { 24 public: OnCallback()25 bool OnCallback() override 26 { 27 return true; 28 } OnCallback(uint32_t state,const PrinterInfo & info)29 bool OnCallback(uint32_t state, const PrinterInfo &info) override 30 { 31 return true; 32 } OnCallback(uint32_t state,const PrintJob & info)33 bool OnCallback(uint32_t state, const PrintJob &info) override 34 { 35 return true; 36 } OnCallback(const std::string & extensionId,const std::string & info)37 bool OnCallback(const std::string &extensionId, const std::string &info) override 38 { 39 return true; 40 } OnCallbackAdapterLayout(const std::string & jobId,const PrintAttributes & oldAttrs,const PrintAttributes & newAttrs,uint32_t fd)41 bool OnCallbackAdapterLayout(const std::string &jobId, const PrintAttributes &oldAttrs, 42 const PrintAttributes &newAttrs, uint32_t fd) override 43 { 44 return true; 45 } onCallbackAdapterJobStateChanged(const std::string jobId,const uint32_t state,const uint32_t subState)46 bool onCallbackAdapterJobStateChanged(const std::string jobId, const uint32_t state, 47 const uint32_t subState) override 48 { 49 return true; 50 } OnCallbackAdapterGetFile(uint32_t state)51 bool OnCallbackAdapterGetFile(uint32_t state) override 52 { 53 return true; 54 } 55 }; 56 57 class MockPrintCallbackStub final : public DummyPrintCallbackStub { 58 public: 59 MOCK_METHOD0(OnCallback, bool()); 60 MOCK_METHOD2(OnCallback, bool(uint32_t, const PrinterInfo&)); 61 MOCK_METHOD2(OnCallback, bool(uint32_t, const PrintJob&)); 62 MOCK_METHOD2(OnCallback, bool(const std::string&, const std::string&)); 63 }; 64 } // namespace Print 65 } // namespace OHOS 66 #endif // MOCK_PRINT_CALLBACK_STUB_H 67