blob: 5566968c6859dd8634317236b3280284d81c1c93 [file] [log] [blame]
Michael Butler6e492a62020-12-10 15:38:45 -08001/*
2 * Copyright (C) 2020 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 ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_COMMON_TEST_MOCK_DEVICE
18#define ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_COMMON_TEST_MOCK_DEVICE
19
20#include <gmock/gmock.h>
21#include <gtest/gtest.h>
22#include <nnapi/IDevice.h>
23
24namespace android::nn {
25
26class MockDevice final : public IDevice {
27 public:
28 MOCK_METHOD(const std::string&, getName, (), (const, override));
29 MOCK_METHOD(const std::string&, getVersionString, (), (const, override));
30 MOCK_METHOD(Version, getFeatureLevel, (), (const, override));
31 MOCK_METHOD(DeviceType, getType, (), (const, override));
Michael Butler9adab0c2021-01-11 19:35:53 -080032 MOCK_METHOD(bool, isUpdatable, (), (const, override));
Michael Butler6e492a62020-12-10 15:38:45 -080033 MOCK_METHOD(const std::vector<Extension>&, getSupportedExtensions, (), (const, override));
34 MOCK_METHOD(const Capabilities&, getCapabilities, (), (const, override));
35 MOCK_METHOD((std::pair<uint32_t, uint32_t>), getNumberOfCacheFilesNeeded, (),
36 (const, override));
37 MOCK_METHOD(GeneralResult<void>, wait, (), (const, override));
38 MOCK_METHOD(GeneralResult<std::vector<bool>>, getSupportedOperations, (const Model& model),
39 (const, override));
40 MOCK_METHOD(GeneralResult<SharedPreparedModel>, prepareModel,
41 (const Model& model, ExecutionPreference preference, Priority priority,
42 OptionalTimePoint deadline, const std::vector<SharedHandle>& modelCache,
43 const std::vector<SharedHandle>& dataCache, const CacheToken& token),
44 (const, override));
45 MOCK_METHOD(GeneralResult<SharedPreparedModel>, prepareModelFromCache,
46 (OptionalTimePoint deadline, const std::vector<SharedHandle>& modelCache,
47 const std::vector<SharedHandle>& dataCache, const CacheToken& token),
48 (const, override));
49 MOCK_METHOD(GeneralResult<SharedBuffer>, allocate,
50 (const BufferDesc& desc, const std::vector<SharedPreparedModel>& preparedModels,
51 const std::vector<BufferRole>& inputRoles,
52 const std::vector<BufferRole>& outputRoles),
53 (const, override));
54};
55
56} // namespace android::nn
57
58#endif // ANDROID_HARDWARE_INTERFACES_NEURALNETWORKS_UTILS_COMMON_TEST_MOCK_DEVICE