| OLD | NEW |
| (Empty) |
| 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 * Use of this source code is governed by a BSD-style license that can be | |
| 3 * found in the LICENSE file. | |
| 4 */ | |
| 5 #ifndef LIBRARIES_NACL_MOUNTS_TEST_PEPPER_INTERFACE_MOCK_H_ | |
| 6 #define LIBRARIES_NACL_MOUNTS_TEST_PEPPER_INTERFACE_MOCK_H_ | |
| 7 | |
| 8 #include "gmock/gmock.h" | |
| 9 #include "nacl_mounts/pepper_interface.h" | |
| 10 | |
| 11 // Mock interface class definitions. | |
| 12 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \ | |
| 13 class BaseClass##Mock : public BaseClass { \ | |
| 14 public: \ | |
| 15 BaseClass##Mock(); \ | |
| 16 virtual ~BaseClass##Mock(); | |
| 17 #define END_INTERFACE(BaseClass, PPInterface) \ | |
| 18 }; | |
| 19 #define METHOD1(Class, ReturnType, MethodName, Type0) \ | |
| 20 MOCK_METHOD1(MethodName, ReturnType(Type0)); | |
| 21 #define METHOD2(Class, ReturnType, MethodName, Type0, Type1) \ | |
| 22 MOCK_METHOD2(MethodName, ReturnType(Type0, Type1)); | |
| 23 #define METHOD3(Class, ReturnType, MethodName, Type0, Type1, Type2) \ | |
| 24 MOCK_METHOD3(MethodName, ReturnType(Type0, Type1, Type2)); | |
| 25 #define METHOD4(Class, ReturnType, MethodName, Type0, Type1, Type2, Type3) \ | |
| 26 MOCK_METHOD4(MethodName, ReturnType(Type0, Type1, Type2, Type3)); | |
| 27 #define METHOD5(Class, ReturnType, MethodName, Type0, Type1, Type2, Type3, \ | |
| 28 Type4) \ | |
| 29 MOCK_METHOD5(MethodName, ReturnType(Type0, Type1, Type2, Type3, Type4)); | |
| 30 #include "nacl_mounts/pepper/all_interfaces.h" | |
| 31 #include "nacl_mounts/pepper/undef_macros.h" | |
| 32 | |
| 33 | |
| 34 class PepperInterfaceMock : public PepperInterface { | |
| 35 public: | |
| 36 explicit PepperInterfaceMock(PP_Instance instance); | |
| 37 ~PepperInterfaceMock(); | |
| 38 | |
| 39 virtual PP_Instance GetInstance(); | |
| 40 MOCK_METHOD1(AddRefResource, void(PP_Resource)); | |
| 41 MOCK_METHOD1(ReleaseResource, void(PP_Resource)); | |
| 42 | |
| 43 // Interface getters. | |
| 44 #include "nacl_mounts/pepper/define_empty_macros.h" | |
| 45 #undef BEGIN_INTERFACE | |
| 46 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \ | |
| 47 virtual BaseClass##Mock* Get##BaseClass(); | |
| 48 #include "nacl_mounts/pepper/all_interfaces.h" | |
| 49 #include "nacl_mounts/pepper/undef_macros.h" | |
| 50 | |
| 51 private: | |
| 52 PP_Instance instance_; | |
| 53 | |
| 54 // Interface pointers. | |
| 55 #include "nacl_mounts/pepper/define_empty_macros.h" | |
| 56 #undef BEGIN_INTERFACE | |
| 57 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \ | |
| 58 BaseClass##Mock* BaseClass##interface_; | |
| 59 #include "nacl_mounts/pepper/all_interfaces.h" | |
| 60 #include "nacl_mounts/pepper/undef_macros.h" | |
| 61 | |
| 62 int dummy_; | |
| 63 }; | |
| 64 | |
| 65 | |
| 66 #endif // LIBRARIES_NACL_MOUNTS_TEST_PEPPER_INTERFACE_MOCK_H_ | |
| OLD | NEW |