1 #ifndef __VTS_DRIVER__android_hardware_tests_memory_V1_0_IMemoryTest__
2 #define __VTS_DRIVER__android_hardware_tests_memory_V1_0_IMemoryTest__
3 
4 #undef LOG_TAG
5 #define LOG_TAG "FuzzerExtended_android_hardware_tests_memory_V1_0_IMemoryTest"
6 
7 #include <log/log.h>
8 #include <stdarg.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12 
13 #include <driver_base/DriverBase.h>
14 #include <driver_base/DriverCallbackBase.h>
15 
16 #include <VtsDriverCommUtil.h>
17 
18 #include <android/hardware/tests/memory/1.0/IMemoryTest.h>
19 #include <hidl/HidlSupport.h>
20 #include <android/hidl/base/1.0/types.h>
21 #include <android/hidl/memory/block/1.0/types.h>
22 #include <android/hidl/memory/block/1.0/types.vts.h>
23 #include <android/hidl/memory/token/1.0/IMemoryToken.h>
24 #include <android/hidl/memory/token/1.0/MemoryToken.vts.h>
25 
26 
27 using namespace android::hardware::tests::memory::V1_0;
28 namespace android {
29 namespace vts {
30 
31 class Vts_android_hardware_tests_memory_V1_0_IMemoryTest : public ::android::hardware::tests::memory::V1_0::IMemoryTest, public DriverCallbackBase {
32  public:
Vts_android_hardware_tests_memory_V1_0_IMemoryTest(const string & callback_socket_name)33     Vts_android_hardware_tests_memory_V1_0_IMemoryTest(const string& callback_socket_name)
34         : callback_socket_name_(callback_socket_name) {};
35 
36     virtual ~Vts_android_hardware_tests_memory_V1_0_IMemoryTest() = default;
37 
38     ::android::hardware::Return<void> haveSomeMemory(
39         const ::android::hardware::hidl_memory& arg0, std::function<void(const ::android::hardware::hidl_memory& arg0)> cb) override;
40 
41     ::android::hardware::Return<void> fillMemory(
42         const ::android::hardware::hidl_memory& arg0,
43         uint8_t arg1) override;
44 
45     ::android::hardware::Return<void> haveSomeMemoryBlock(
46         const ::android::hidl::memory::block::V1_0::MemoryBlock& arg0, std::function<void(const ::android::hidl::memory::block::V1_0::MemoryBlock& arg0)> cb) override;
47 
48     ::android::hardware::Return<void> set(
49         const ::android::hardware::hidl_memory& arg0) override;
50 
51     ::android::hardware::Return<sp<::android::hidl::memory::token::V1_0::IMemoryToken>> get(
52         ) override;
53 
54 
55  private:
56     string callback_socket_name_;
57 };
58 
59 sp<::android::hardware::tests::memory::V1_0::IMemoryTest> VtsFuzzerCreateVts_android_hardware_tests_memory_V1_0_IMemoryTest(const string& callback_socket_name);
60 
61 class FuzzerExtended_android_hardware_tests_memory_V1_0_IMemoryTest : public DriverBase {
62  public:
FuzzerExtended_android_hardware_tests_memory_V1_0_IMemoryTest()63     FuzzerExtended_android_hardware_tests_memory_V1_0_IMemoryTest() : DriverBase(HAL_HIDL), hw_binder_proxy_() {}
64 
FuzzerExtended_android_hardware_tests_memory_V1_0_IMemoryTest(::android::hardware::tests::memory::V1_0::IMemoryTest * hw_binder_proxy)65     explicit FuzzerExtended_android_hardware_tests_memory_V1_0_IMemoryTest(::android::hardware::tests::memory::V1_0::IMemoryTest* hw_binder_proxy) : DriverBase(HAL_HIDL), hw_binder_proxy_(hw_binder_proxy) {}
GetHidlInterfaceProxy()66     uint64_t GetHidlInterfaceProxy() const {
67         return reinterpret_cast<uintptr_t>(hw_binder_proxy_.get());
68     }
69  protected:
70     bool Fuzz(FunctionSpecificationMessage* func_msg, void** result, const string& callback_socket_name);
71     bool CallFunction(const FunctionSpecificationMessage& func_msg, const string& callback_socket_name, FunctionSpecificationMessage* result_msg);
72     bool VerifyResults(const FunctionSpecificationMessage& expected_result, const FunctionSpecificationMessage& actual_result);
73     bool GetAttribute(FunctionSpecificationMessage* func_msg, void** result);
74     bool GetService(bool get_stub, const char* service_name);
75 
76  private:
77     sp<::android::hardware::tests::memory::V1_0::IMemoryTest> hw_binder_proxy_;
78 };
79 
80 
81 extern "C" {
82 extern android::vts::DriverBase* vts_func_4_android_hardware_tests_memory_V1_0_IMemoryTest_();
83 extern android::vts::DriverBase* vts_func_4_android_hardware_tests_memory_V1_0_IMemoryTest_with_arg(uint64_t hw_binder_proxy);
84 }
85 }  // namespace vts
86 }  // namespace android
87 #endif
88