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 OHOS_SCREEN_TRANS_TEST_UTILS_H 17 #define OHOS_SCREEN_TRANS_TEST_UTILS_H 18 19 #include <stddef.h> 20 21 #include "dscreen_errcode.h" 22 #include "dscreen_log.h" 23 #include "iimage_sink_processor_listener.h" 24 #include "iscreen_sink_trans_callback.h" 25 #include "iscreen_source_trans_callback.h" 26 #include "iscreen_channel_listener.h" 27 28 namespace OHOS { 29 namespace DistributedHardware { 30 constexpr int32_t VIDEO_CODEC_TYPE_INVALID = -1; 31 constexpr int32_t VIDEO_DATA_FORMAT_INVALID = -1; 32 constexpr int32_t WIDTH_INVALID = 9999; 33 constexpr int32_t HEIGHT_INVALID = 9999; 34 constexpr int32_t FPS = 30; 35 constexpr size_t DATA_LEN = 128; 36 37 class MockIScreenSinkTransCallback : public IScreenSinkTransCallback { 38 public: MockIScreenSinkTransCallback()39 explicit MockIScreenSinkTransCallback() 40 { 41 } 42 ~MockIScreenSinkTransCallback() override = default; 43 OnError(int32_t err,const std::string & content)44 virtual void OnError(int32_t err, const std::string &content) override 45 { 46 (void) err; 47 (void) content; 48 } 49 }; 50 51 class MockIImageSinkProcessorListener : public IImageSinkProcessorListener { 52 public: MockIImageSinkProcessorListener()53 explicit MockIImageSinkProcessorListener() 54 { 55 } 56 ~MockIImageSinkProcessorListener() override = default; 57 OnProcessorStateNotify(int32_t state)58 virtual void OnProcessorStateNotify(int32_t state) override 59 { 60 (void) state; 61 } 62 }; 63 64 class MockIScreenSourceTransCallback : public IScreenSourceTransCallback { 65 public: ~MockIScreenSourceTransCallback()66 ~MockIScreenSourceTransCallback() override {}; 67 OnError(int32_t err,const std::string & content)68 virtual void OnError(int32_t err, const std::string &content) override 69 { 70 (void) err; 71 (void) content; 72 } 73 }; 74 75 class MockIScreenChannelListener : public IScreenChannelListener { 76 public: OnSessionOpened()77 void OnSessionOpened() override {} OnSessionClosed()78 void OnSessionClosed() override {} OnDataReceived(const std::shared_ptr<DataBuffer> & data)79 void OnDataReceived(const std::shared_ptr<DataBuffer> &data) override {} 80 }; 81 } // namespace DistributedHardware 82 } // namespace OHOS 83 #endif