1 /* 2 * Copyright (c) 2025 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 USBD_ASYNC_INTERRUPT_TRANSFER_TEST_H 16 #define USBD_ASYNC_INTERRUPT_TRANSFER_TEST_H 17 18 #include <gtest/gtest.h> 19 20 #include "UsbSubscriberTest.h" 21 #include "v1_0/iusbd_subscriber.h" 22 #include "v1_2/usb_types.h" 23 #include "v1_2/iusbd_transfer_callback.h" 24 #include "hdf_log.h" 25 #include "securec.h" 26 27 using OHOS::HDI::Usb::V1_0::UsbDev; 28 29 namespace OHOS { 30 namespace USB { 31 namespace UsbdAsyncInterruptTransfer { 32 class UsbdAsyncInterruptTransferTest : public testing::Test { 33 public: 34 static void SetUpTestCase(); 35 static void TearDownTestCase(); 36 void SetUp(); 37 void TearDown(); 38 static void SubscriberEvent(); 39 40 static UsbDev dev_; 41 static OHOS::sptr<OHOS::USB::UsbSubscriberTest> subscriber_; 42 }; 43 44 class UsbdTransferCallbackTest : public OHOS::HDI::Usb::V1_2::IUsbdTransferCallback { 45 public: 46 UsbdTransferCallbackTest() = default; 47 ~UsbdTransferCallbackTest() = default; OnTransferWriteCallback(int32_t status,int32_t actLength,const std::vector<OHOS::HDI::Usb::V1_2::UsbIsoPacketDescriptor> & descs,const uint64_t userData)48 int32_t OnTransferWriteCallback(int32_t status, int32_t actLength, 49 const std::vector<OHOS::HDI::Usb::V1_2::UsbIsoPacketDescriptor>& descs, const uint64_t userData) override 50 { 51 return 0; 52 } OnTransferReadCallback(int32_t status,int32_t actLength,const std::vector<OHOS::HDI::Usb::V1_2::UsbIsoPacketDescriptor> & descs,const uint64_t userData)53 int32_t OnTransferReadCallback(int32_t status, int32_t actLength, 54 const std::vector<OHOS::HDI::Usb::V1_2::UsbIsoPacketDescriptor>& descs, const uint64_t userData) override 55 { 56 return 0; 57 } 58 }; 59 } // namespace UsbdAsyncInterruptTransfer 60 } // namespace USB 61 } // namespace OHOS 62 #endif // USBD_ASYNC_INTERRUPT_TRANSFER_TEST_H 63