Home | History | Annotate | Download | only in nacl_io_test
      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 #include "pepper_interface_mock.h"
      6 
      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"
     16 }
     17 
     18 PepperInterfaceMock::~PepperInterfaceMock() {
     19   // Delete interfaces.
     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"
     26 
     27 }
     28 
     29 PP_Instance PepperInterfaceMock::GetInstance() {
     30   return instance_;
     31 }
     32 
     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_; \
     40     } \
     41     BaseClass##Mock::BaseClass##Mock() { \
     42     } \
     43     BaseClass##Mock::~BaseClass##Mock() { \
     44     }
     45 #include "nacl_io/pepper/all_interfaces.h"
     46 
     47