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
)
8 : instance_(instance
) {
9 // Initialize interfaces.
10 #include "nacl_io/pepper/undef_macros.h"
11 #include "nacl_io/pepper/define_empty_macros.h"
12 #undef BEGIN_INTERFACE
13 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
14 BaseClass##interface_ = new BaseClass##Mock;
15 #include "nacl_io/pepper/all_interfaces.h"
18 PepperInterfaceMock::~PepperInterfaceMock() {
20 #include "nacl_io/pepper/undef_macros.h"
21 #include "nacl_io/pepper/define_empty_macros.h"
22 #undef BEGIN_INTERFACE
23 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
24 delete BaseClass##interface_;
25 #include "nacl_io/pepper/all_interfaces.h"
29 PP_Instance
PepperInterfaceMock::GetInstance() {
33 // Define Getter functions, constructors, destructors.
34 #include "nacl_io/pepper/undef_macros.h"
35 #include "nacl_io/pepper/define_empty_macros.h"
36 #undef BEGIN_INTERFACE
37 #define BEGIN_INTERFACE(BaseClass, PPInterface, InterfaceString) \
38 BaseClass##Mock* PepperInterfaceMock::Get##BaseClass() { \
39 return BaseClass##interface_; \
41 BaseClass##Mock::BaseClass##Mock() { \
43 BaseClass##Mock::~BaseClass##Mock() { \
45 #include "nacl_io/pepper/all_interfaces.h"