OSDN Git Service

1b3b3342d145f7c6032550556b5fba04cf82412a
[android-x86/hardware-interfaces.git] / neuralnetworks / 1.0 / vts / functional / VtsHalNeuralnetworksV1_0TargetTest.h
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
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
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef VTS_HAL_NEURALNETWORKS_V1_0_TARGET_TESTS_H
18 #define VTS_HAL_NEURALNETWORKS_V1_0_TARGET_TESTS_H
19
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>
24
25 #include <VtsHalHidlTargetTestBase.h>
26 #include <VtsHalHidlTargetTestEnvBase.h>
27 #include <gtest/gtest.h>
28 #include <string>
29
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;
45 using ::android::sp;
46
47 namespace android {
48 namespace hardware {
49 namespace neuralnetworks {
50 namespace V1_0 {
51 namespace vts {
52 namespace functional {
53
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;
61
62    public:
63     ~NeuralnetworksHidlEnvironment() override;
64     static NeuralnetworksHidlEnvironment* getInstance();
65     void registerTestServices() override;
66 };
67
68 // The main test class for NEURALNETWORKS HIDL HAL.
69 class NeuralnetworksHidlTest : public ::testing::VtsHalHidlTargetTestBase {
70    public:
71     ~NeuralnetworksHidlTest() override;
72     void SetUp() override;
73     void TearDown() override;
74
75     sp<IPreparedModel> doPrepareModelShortcut(const Model& model);
76
77     sp<IDevice> device;
78 };
79
80 }  // namespace functional
81 }  // namespace vts
82 }  // namespace V1_0
83 }  // namespace neuralnetworks
84 }  // namespace hardware
85 }  // namespace android
86
87 #endif  // VTS_HAL_NEURALNETWORKS_V1_0_TARGET_TESTS_H