2 * Copyright (C) 2017 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef VTS_HAL_NEURALNETWORKS_V1_0_TARGET_TESTS_H
18 #define VTS_HAL_NEURALNETWORKS_V1_0_TARGET_TESTS_H
20 #include <android/hardware/neuralnetworks/1.0/IDevice.h>
21 #include <android/hardware/neuralnetworks/1.0/IPreparedModel.h>
22 #include <android/hardware/neuralnetworks/1.0/types.h>
23 #include <android/hidl/allocator/1.0/IAllocator.h>
25 #include <VtsHalHidlTargetTestBase.h>
26 #include <VtsHalHidlTargetTestEnvBase.h>
27 #include <gtest/gtest.h>
30 using ::android::hardware::neuralnetworks::V1_0::IDevice;
31 using ::android::hardware::neuralnetworks::V1_0::IPreparedModel;
32 using ::android::hardware::neuralnetworks::V1_0::Capabilities;
33 using ::android::hardware::neuralnetworks::V1_0::DeviceStatus;
34 using ::android::hardware::neuralnetworks::V1_0::FusedActivationFunc;
35 using ::android::hardware::neuralnetworks::V1_0::Model;
36 using ::android::hardware::neuralnetworks::V1_0::OperationType;
37 using ::android::hardware::neuralnetworks::V1_0::PerformanceInfo;
38 using ::android::hardware::Return;
39 using ::android::hardware::Void;
40 using ::android::hardware::hidl_memory;
41 using ::android::hardware::hidl_string;
42 using ::android::hardware::hidl_vec;
43 using ::android::hidl::allocator::V1_0::IAllocator;
44 using ::android::hidl::memory::V1_0::IMemory;
49 namespace neuralnetworks {
52 namespace functional {
54 // A class for test environment setup
55 class NeuralnetworksHidlEnvironment : public ::testing::VtsHalHidlTargetTestEnvBase {
56 NeuralnetworksHidlEnvironment();
57 NeuralnetworksHidlEnvironment(const NeuralnetworksHidlEnvironment&) = delete;
58 NeuralnetworksHidlEnvironment(NeuralnetworksHidlEnvironment&&) = delete;
59 NeuralnetworksHidlEnvironment& operator=(const NeuralnetworksHidlEnvironment&) = delete;
60 NeuralnetworksHidlEnvironment& operator=(NeuralnetworksHidlEnvironment&&) = delete;
63 ~NeuralnetworksHidlEnvironment() override;
64 static NeuralnetworksHidlEnvironment* getInstance();
65 void registerTestServices() override;
68 // The main test class for NEURALNETWORKS HIDL HAL.
69 class NeuralnetworksHidlTest : public ::testing::VtsHalHidlTargetTestBase {
71 ~NeuralnetworksHidlTest() override;
72 void SetUp() override;
73 void TearDown() override;
75 sp<IPreparedModel> doPrepareModelShortcut(const Model& model);
80 } // namespace functional
83 } // namespace neuralnetworks
84 } // namespace hardware
85 } // namespace android
87 #endif // VTS_HAL_NEURALNETWORKS_V1_0_TARGET_TESTS_H