Home | History | Annotate | Download | only in DRIVER
      1 #ifndef __VTS_DRIVER__android_hardware_tests_bar_V1_0_IBar__
      2 #define __VTS_DRIVER__android_hardware_tests_bar_V1_0_IBar__
      3 
      4 #undef LOG_TAG
      5 #define LOG_TAG "FuzzerExtended_android_hardware_tests_bar_V1_0_IBar"
      6 
      7 #include <stdio.h>
      8 #include <stdarg.h>
      9 #include <stdlib.h>
     10 #include <string.h>
     11 #include <utils/Log.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/bar/1.0/IBar.h>
     19 #include <hidl/HidlSupport.h>
     20 #include <android/hardware/tests/foo/1.0/IFoo.h>
     21 #include <android/hardware/tests/foo/1.0/Foo.vts.h>
     22 #include <android/hardware/tests/foo/1.0/IFooCallback.h>
     23 #include <android/hardware/tests/foo/1.0/FooCallback.vts.h>
     24 #include <android/hardware/tests/foo/1.0/IMyTypes.h>
     25 #include <android/hardware/tests/foo/1.0/MyTypes.vts.h>
     26 #include <android/hardware/tests/foo/1.0/ISimple.h>
     27 #include <android/hardware/tests/foo/1.0/Simple.vts.h>
     28 #include <android/hardware/tests/foo/1.0/ITheirTypes.h>
     29 #include <android/hardware/tests/foo/1.0/TheirTypes.vts.h>
     30 #include <android/hardware/tests/foo/1.0/types.h>
     31 #include <android/hardware/tests/foo/1.0/types.vts.h>
     32 #include <android/hidl/base/1.0/types.h>
     33 
     34 
     35 using namespace android::hardware::tests::bar::V1_0;
     36 namespace android {
     37 namespace vts {
     38 void MessageTo__android__hardware__tests__bar__V1_0__IBar__SomethingRelated(const VariableSpecificationMessage& var_msg, ::android::hardware::tests::bar::V1_0::IBar::SomethingRelated* arg, const string& callback_socket_name);
     39 bool Verify__android__hardware__tests__bar__V1_0__IBar__SomethingRelated(const VariableSpecificationMessage& expected_result, const VariableSpecificationMessage& actual_result);
     40 void SetResult__android__hardware__tests__bar__V1_0__IBar__SomethingRelated(VariableSpecificationMessage* result_msg, ::android::hardware::tests::bar::V1_0::IBar::SomethingRelated result_value);
     41 
     42 class Vts_android_hardware_tests_bar_V1_0_IBar : public ::android::hardware::tests::bar::V1_0::IBar, public DriverCallbackBase {
     43  public:
     44     Vts_android_hardware_tests_bar_V1_0_IBar(const string& callback_socket_name)
     45         : callback_socket_name_(callback_socket_name) {};
     46 
     47     virtual ~Vts_android_hardware_tests_bar_V1_0_IBar() = default;
     48 
     49     ::android::hardware::Return<void> convertToBoolIfSmall(
     50         ::android::hardware::tests::foo::V1_0::IFoo::Discriminator arg0,
     51         const ::android::hardware::hidl_vec<::android::hardware::tests::foo::V1_0::IFoo::Union>& arg1, std::function<void(const ::android::hardware::hidl_vec<::android::hardware::tests::foo::V1_0::IFoo::ContainsUnion>& arg0)> cb) override;
     52 
     53     ::android::hardware::Return<void> doThis(
     54         float arg0) override;
     55 
     56     ::android::hardware::Return<int32_t> doThatAndReturnSomething(
     57         int64_t arg0) override;
     58 
     59     ::android::hardware::Return<double> doQuiteABit(
     60         int32_t arg0,
     61         int64_t arg1,
     62         float arg2,
     63         double arg3) override;
     64 
     65     ::android::hardware::Return<void> doSomethingElse(
     66         const ::android::hardware::hidl_array<int32_t, 15>& arg0, std::function<void(const ::android::hardware::hidl_array<int32_t, 32>& arg0)> cb) override;
     67 
     68     ::android::hardware::Return<void> doStuffAndReturnAString(
     69         std::function<void(const ::android::hardware::hidl_string& arg0)> cb) override;
     70 
     71     ::android::hardware::Return<void> mapThisVector(
     72         const ::android::hardware::hidl_vec<int32_t>& arg0, std::function<void(const ::android::hardware::hidl_vec<int32_t>& arg0)> cb) override;
     73 
     74     ::android::hardware::Return<void> callMe(
     75         const sp<::android::hardware::tests::foo::V1_0::IFooCallback>& arg0) override;
     76 
     77     ::android::hardware::Return<::android::hardware::tests::foo::V1_0::IFoo::SomeEnum> useAnEnum(
     78         ::android::hardware::tests::foo::V1_0::IFoo::SomeEnum arg0) override;
     79 
     80     ::android::hardware::Return<void> haveAGooberVec(
     81         const ::android::hardware::hidl_vec<::android::hardware::tests::foo::V1_0::IFoo::Goober>& arg0) override;
     82 
     83     ::android::hardware::Return<void> haveAGoober(
     84         const ::android::hardware::tests::foo::V1_0::IFoo::Goober& arg0) override;
     85 
     86     ::android::hardware::Return<void> haveAGooberArray(
     87         const ::android::hardware::hidl_array<::android::hardware::tests::foo::V1_0::IFoo::Goober, 20>& arg0) override;
     88 
     89     ::android::hardware::Return<void> haveATypeFromAnotherFile(
     90         const ::android::hardware::tests::foo::V1_0::Abc& arg0) override;
     91 
     92     ::android::hardware::Return<void> haveSomeStrings(
     93         const ::android::hardware::hidl_array<::android::hardware::hidl_string, 3>& arg0, std::function<void(const ::android::hardware::hidl_array<::android::hardware::hidl_string, 2>& arg0)> cb) override;
     94 
     95     ::android::hardware::Return<void> haveAStringVec(
     96         const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& arg0, std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_string>& arg0)> cb) override;
     97 
     98     ::android::hardware::Return<void> transposeMe(
     99         const ::android::hardware::hidl_array<float, 3, 5>& arg0, std::function<void(const ::android::hardware::hidl_array<float, 5, 3>& arg0)> cb) override;
    100 
    101     ::android::hardware::Return<void> callingDrWho(
    102         const ::android::hardware::tests::foo::V1_0::IFoo::MultiDimensional& arg0, std::function<void(const ::android::hardware::tests::foo::V1_0::IFoo::MultiDimensional& arg0)> cb) override;
    103 
    104     ::android::hardware::Return<void> transpose(
    105         const ::android::hardware::tests::foo::V1_0::IFoo::StringMatrix5x3& arg0, std::function<void(const ::android::hardware::tests::foo::V1_0::IFoo::StringMatrix3x5& arg0)> cb) override;
    106 
    107     ::android::hardware::Return<void> transpose2(
    108         const ::android::hardware::hidl_array<::android::hardware::hidl_string, 5, 3>& arg0, std::function<void(const ::android::hardware::hidl_array<::android::hardware::hidl_string, 3, 5>& arg0)> cb) override;
    109 
    110     ::android::hardware::Return<void> sendVec(
    111         const ::android::hardware::hidl_vec<uint8_t>& arg0, std::function<void(const ::android::hardware::hidl_vec<uint8_t>& arg0)> cb) override;
    112 
    113     ::android::hardware::Return<void> sendVecVec(
    114         std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_vec<uint8_t>>& arg0)> cb) override;
    115 
    116     ::android::hardware::Return<void> haveAVectorOfInterfaces(
    117         const ::android::hardware::hidl_vec<sp<::android::hardware::tests::foo::V1_0::ISimple>>& arg0, std::function<void(const ::android::hardware::hidl_vec<sp<::android::hardware::tests::foo::V1_0::ISimple>>& arg0)> cb) override;
    118 
    119     ::android::hardware::Return<void> haveAVectorOfGenericInterfaces(
    120         const ::android::hardware::hidl_vec<sp<::android::hidl::base::V1_0::IBase>>& arg0, std::function<void(const ::android::hardware::hidl_vec<sp<::android::hidl::base::V1_0::IBase>>& arg0)> cb) override;
    121 
    122     ::android::hardware::Return<void> echoNullInterface(
    123         const sp<::android::hardware::tests::foo::V1_0::IFooCallback>& arg0, std::function<void(bool arg0,const sp<::android::hardware::tests::foo::V1_0::IFooCallback>& arg1)> cb) override;
    124 
    125     ::android::hardware::Return<void> createMyHandle(
    126         std::function<void(const ::android::hardware::tests::foo::V1_0::IFoo::MyHandle& arg0)> cb) override;
    127 
    128     ::android::hardware::Return<void> createHandles(
    129         uint32_t arg0, std::function<void(const ::android::hardware::hidl_vec<::android::hardware::hidl_handle>& arg0)> cb) override;
    130 
    131     ::android::hardware::Return<void> closeHandles(
    132         ) override;
    133 
    134     ::android::hardware::Return<void> thisIsNew(
    135         ) override;
    136 
    137     ::android::hardware::Return<void> expectNullHandle(
    138         const ::android::hardware::hidl_handle& arg0,
    139         const ::android::hardware::tests::foo::V1_0::Abc& arg1, std::function<void(bool arg0,bool arg1)> cb) override;
    140 
    141     ::android::hardware::Return<void> takeAMask(
    142         ::android::hardware::tests::foo::V1_0::IFoo::BitField arg0,
    143         uint8_t arg1,
    144         const ::android::hardware::tests::foo::V1_0::IFoo::MyMask& arg2,
    145         uint8_t arg3, std::function<void(::android::hardware::tests::foo::V1_0::IFoo::BitField arg0,uint8_t arg1,uint8_t arg2,uint8_t arg3)> cb) override;
    146 
    147     ::android::hardware::Return<sp<::android::hardware::tests::foo::V1_0::ISimple>> haveAInterface(
    148         const sp<::android::hardware::tests::foo::V1_0::ISimple>& arg0) override;
    149 
    150 
    151  private:
    152     string callback_socket_name_;
    153 };
    154 
    155 sp<::android::hardware::tests::bar::V1_0::IBar> VtsFuzzerCreateVts_android_hardware_tests_bar_V1_0_IBar(const string& callback_socket_name);
    156 
    157 class FuzzerExtended_android_hardware_tests_bar_V1_0_IBar : public DriverBase {
    158  public:
    159     FuzzerExtended_android_hardware_tests_bar_V1_0_IBar() : DriverBase(HAL_HIDL), hw_binder_proxy_() {}
    160 
    161     explicit FuzzerExtended_android_hardware_tests_bar_V1_0_IBar(::android::hardware::tests::bar::V1_0::IBar* hw_binder_proxy) : DriverBase(HAL_HIDL), hw_binder_proxy_(hw_binder_proxy) {}
    162     uint64_t GetHidlInterfaceProxy() const {
    163         return reinterpret_cast<uintptr_t>(hw_binder_proxy_.get());
    164     }
    165  protected:
    166     bool Fuzz(FunctionSpecificationMessage* func_msg, void** result, const string& callback_socket_name);
    167     bool CallFunction(const FunctionSpecificationMessage& func_msg, const string& callback_socket_name, FunctionSpecificationMessage* result_msg);
    168     bool VerifyResults(const FunctionSpecificationMessage& expected_result, const FunctionSpecificationMessage& actual_result);
    169     bool GetAttribute(FunctionSpecificationMessage* func_msg, void** result);
    170     bool GetService(bool get_stub, const char* service_name);
    171 
    172  private:
    173     sp<::android::hardware::tests::bar::V1_0::IBar> hw_binder_proxy_;
    174 };
    175 
    176 
    177 extern "C" {
    178 extern android::vts::DriverBase* vts_func_4_android_hardware_tests_bar_V1_0_IBar_();
    179 extern android::vts::DriverBase* vts_func_4_android_hardware_tests_bar_V1_0_IBar_with_arg(uint64_t hw_binder_proxy);
    180 }
    181 }  // namespace vts
    182 }  // namespace android
    183 #endif
    184