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.
5 #include "pepper_interface_mock.h"
7 PepperInterfaceMock::PepperInterfaceMock(PP_Instance instance)
10 // Initialize interfaces.
11 #include "nacl_io/pepper/undef_macros.h"
12 #include "nacl_io/pepper/define_empty_macros.h"
13 #undef BEGIN_INTERFACE
14 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
15 BaseClass##interface_(new BaseClass##Mock),
16 #include "nacl_io/pepper/all_interfaces.h"
18 // Dummy value so we can ensure that no interface ends the initializer list.
22 PepperInterfaceMock::~PepperInterfaceMock() {
25 #include "nacl_io/pepper/undef_macros.h"
26 #include "nacl_io/pepper/define_empty_macros.h"
27 #undef BEGIN_INTERFACE
28 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
29 delete BaseClass##interface_;
30 #include "nacl_io/pepper/all_interfaces.h"
34 PP_Instance PepperInterfaceMock::GetInstance() {
38 // Define Getter functions, constructors, destructors.
39 #include "nacl_io/pepper/undef_macros.h"
40 #include "nacl_io/pepper/define_empty_macros.h"
41 #undef BEGIN_INTERFACE
42 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
43 BaseClass##Mock* PepperInterfaceMock::Get##BaseClass() { \
44 return BaseClass##interface_; \
46 BaseClass##Mock::BaseClass##Mock() { \
48 BaseClass##Mock::~BaseClass##Mock() { \
50 #include "nacl_io/pepper/all_interfaces.h"