Home | History | Annotate | Download | only in test
      1 // Copyright (c) 2010 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 CHROME_FRAME_TEST_URLMON_MONIKER_TESTS_H_
      6 #define CHROME_FRAME_TEST_URLMON_MONIKER_TESTS_H_
      7 
      8 #include <atlbase.h>
      9 #include <atlcom.h>
     10 
     11 #include "gmock/gmock.h"
     12 #include "gtest/gtest.h"
     13 
     14 class MockBindStatusCallbackImpl
     15   : public CComObjectRootEx<CComSingleThreadModel>,
     16     public IBindStatusCallback {
     17  public:
     18 BEGIN_COM_MAP(MockBindStatusCallbackImpl)
     19   COM_INTERFACE_ENTRY(IBindStatusCallback)
     20 END_COM_MAP()
     21 
     22   MOCK_METHOD2_WITH_CALLTYPE(__stdcall, OnStartBinding,
     23       HRESULT (DWORD reserved, IBinding* binding));  // NOLINT
     24 
     25   MOCK_METHOD1_WITH_CALLTYPE(__stdcall, GetPriority,
     26       HRESULT (LONG* priority));  // NOLINT
     27 
     28   MOCK_METHOD1_WITH_CALLTYPE(__stdcall, OnLowResource,
     29       HRESULT (DWORD reserved));   // NOLINT
     30 
     31   MOCK_METHOD4_WITH_CALLTYPE(__stdcall, OnProgress,
     32       HRESULT (ULONG progress,  // NOLINT
     33                ULONG max,
     34                ULONG status,
     35                LPCWSTR text));
     36 
     37   MOCK_METHOD2_WITH_CALLTYPE(__stdcall, OnStopBinding,
     38       HRESULT (HRESULT hr,  // NOLINT
     39                LPCWSTR error));
     40 
     41   MOCK_METHOD2_WITH_CALLTYPE(__stdcall, GetBindInfo,
     42       HRESULT (DWORD* flags,  // NOLINT
     43                BINDINFO* bind_info));
     44 
     45   MOCK_METHOD4_WITH_CALLTYPE(__stdcall, OnDataAvailable,
     46       HRESULT (DWORD flags,  // NOLINT
     47                DWORD size,
     48                FORMATETC* format,
     49                STGMEDIUM* storage));
     50 
     51   MOCK_METHOD2_WITH_CALLTYPE(__stdcall, OnObjectAvailable,
     52       HRESULT (REFIID riid,  // NOLINT
     53                IUnknown* unk));
     54 };
     55 
     56 class MockBindCtxImpl
     57   : public CComObjectRootEx<CComSingleThreadModel>,
     58     public IBindCtx {
     59  public:
     60 BEGIN_COM_MAP(MockBindCtxImpl)
     61   COM_INTERFACE_ENTRY(IBindCtx)
     62 END_COM_MAP()
     63 
     64   MOCK_METHOD1_WITH_CALLTYPE(__stdcall, RegisterObjectBound,
     65       HRESULT (IUnknown* object));  // NOLINT
     66 
     67   MOCK_METHOD1_WITH_CALLTYPE(__stdcall, RevokeObjectBound,
     68       HRESULT (IUnknown* object));  // NOLINT
     69 
     70   MOCK_METHOD0_WITH_CALLTYPE(__stdcall, ReleaseBoundObjects,
     71       HRESULT ());  // NOLINT
     72 
     73   MOCK_METHOD1_WITH_CALLTYPE(__stdcall, SetBindOptions,
     74       HRESULT (BIND_OPTS* options));   // NOLINT
     75 
     76   MOCK_METHOD1_WITH_CALLTYPE(__stdcall, GetBindOptions,
     77       HRESULT (BIND_OPTS* options));   // NOLINT
     78 
     79   MOCK_METHOD1_WITH_CALLTYPE(__stdcall, GetRunningObjectTable,
     80       HRESULT (IRunningObjectTable** rot));  // NOLINT
     81 
     82   MOCK_METHOD2_WITH_CALLTYPE(__stdcall, RegisterObjectParam,
     83       HRESULT (LPOLESTR key,  // NOLINT
     84                IUnknown* param));
     85 
     86   MOCK_METHOD2_WITH_CALLTYPE(__stdcall, GetObjectParam,
     87       HRESULT (LPOLESTR key,  // NOLINT
     88                IUnknown** param));
     89 
     90   MOCK_METHOD1_WITH_CALLTYPE(__stdcall, EnumObjectParam,
     91       HRESULT (IEnumString** enum_params));  // NOLINT
     92 
     93   MOCK_METHOD1_WITH_CALLTYPE(__stdcall, RevokeObjectParam,
     94       HRESULT (LPOLESTR key));  // NOLINT
     95 };
     96 
     97 class MockMonikerImpl
     98   : public CComObjectRootEx<CComSingleThreadModel>,
     99     public IMoniker {
    100  public:
    101 BEGIN_COM_MAP(MockMonikerImpl)
    102   COM_INTERFACE_ENTRY(IMoniker)
    103 END_COM_MAP()
    104 
    105   MOCK_METHOD4_WITH_CALLTYPE(__stdcall, BindToObject,
    106       HRESULT (IBindCtx* bind_context,  // NOLINT
    107                IMoniker* left,
    108                REFIID result_iid,
    109                void** object));
    110 
    111   MOCK_METHOD4_WITH_CALLTYPE(__stdcall, BindToStorage,
    112       HRESULT (IBindCtx* bind_context,  // NOLINT
    113                IMoniker* left,
    114                REFIID result_iid,
    115                void** storage));
    116 
    117   MOCK_METHOD4_WITH_CALLTYPE(__stdcall, Reduce,
    118       HRESULT (IBindCtx* bind_context,  // NOLINT
    119                DWORD reduce_depth,
    120                IMoniker* left,
    121                IMoniker** reduced));
    122 
    123   MOCK_METHOD3_WITH_CALLTYPE(__stdcall, ComposeWith,
    124       HRESULT (IBindCtx* right,  // NOLINT
    125                BOOL is_not_generic,
    126                IMoniker** composite));
    127 
    128   MOCK_METHOD2_WITH_CALLTYPE(__stdcall, Enum,
    129       HRESULT (BOOL is_forward,  // NOLINT
    130                IEnumMoniker** moniker_enum));
    131 
    132   MOCK_METHOD1_WITH_CALLTYPE(__stdcall, IsEqual,
    133       HRESULT (IMoniker* other));  // NOLINT
    134 
    135   MOCK_METHOD3_WITH_CALLTYPE(__stdcall, IsRunning,
    136       HRESULT (IBindCtx* bind_context,  // NOLINT
    137                IMoniker* left,
    138                IMoniker** newly_running));
    139 
    140   MOCK_METHOD3_WITH_CALLTYPE(__stdcall, GetTimeOfLastChange,
    141       HRESULT (IBindCtx* bind_context,  // NOLINT
    142                IMoniker* left,
    143                 FILETIME *pFileTime));
    144 
    145   MOCK_METHOD1_WITH_CALLTYPE(__stdcall, Inverse,
    146       HRESULT (IMoniker** inversed));   // NOLINT
    147 
    148   MOCK_METHOD2_WITH_CALLTYPE(__stdcall, CommonPrefixWith,
    149       HRESULT (IMoniker* other,  // NOLINT
    150                IMoniker** prefix));
    151 
    152   MOCK_METHOD2_WITH_CALLTYPE(__stdcall, RelativePathTo,
    153       HRESULT (IMoniker* other,  // NOLINT
    154                IMoniker** relative));
    155 
    156     MOCK_METHOD3_WITH_CALLTYPE(__stdcall, GetDisplayName,
    157       HRESULT (IBindCtx* bind_context,  // NOLINT
    158                IMoniker* left,
    159                LPOLESTR* display_name));
    160 
    161     MOCK_METHOD5_WITH_CALLTYPE(__stdcall, ParseDisplayName,
    162       HRESULT (IBindCtx* bind_context,  // NOLINT
    163                IMoniker* left,
    164                LPOLESTR display_name,
    165                ULONG *pchEaten,
    166                IMoniker** ret));
    167 
    168   MOCK_METHOD1_WITH_CALLTYPE(__stdcall, IsSystemMoniker,
    169       HRESULT (DWORD* is_system));  // NOLINT
    170 };
    171 
    172 #endif  // CHROME_FRAME_TEST_URLMON_MONIKER_TESTS_H_
    173