summaryrefslogtreecommitdiffstats
path: root/chrome_frame/test/urlmon_moniker_tests.h
blob: ce58b03e50a4fdb5339c8d9f9d23e30e2e51a983 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_FRAME_TEST_URLMON_MONIKER_TESTS_H_
#define CHROME_FRAME_TEST_URLMON_MONIKER_TESTS_H_

#include <atlbase.h>
#include <atlcom.h>

#include "gmock/gmock.h"
#include "gtest/gtest.h"

class MockBindStatusCallbackImpl
  : public CComObjectRootEx<CComSingleThreadModel>,
    public IBindStatusCallback {
 public:
BEGIN_COM_MAP(MockBindStatusCallbackImpl)
  COM_INTERFACE_ENTRY(IBindStatusCallback)
END_COM_MAP()

  MOCK_METHOD2_WITH_CALLTYPE(__stdcall, OnStartBinding,
      HRESULT (DWORD reserved, IBinding* binding));  // NOLINT

  MOCK_METHOD1_WITH_CALLTYPE(__stdcall, GetPriority,
      HRESULT (LONG* priority));  // NOLINT

  MOCK_METHOD1_WITH_CALLTYPE(__stdcall, OnLowResource,
      HRESULT (DWORD reserved));   // NOLINT

  MOCK_METHOD4_WITH_CALLTYPE(__stdcall, OnProgress,
      HRESULT (ULONG progress,  // NOLINT
               ULONG max,
               ULONG status,
               LPCWSTR text));

  MOCK_METHOD2_WITH_CALLTYPE(__stdcall, OnStopBinding,
      HRESULT (HRESULT hr,  // NOLINT
               LPCWSTR error));

  MOCK_METHOD2_WITH_CALLTYPE(__stdcall, GetBindInfo,
      HRESULT (DWORD* flags,  // NOLINT
               BINDINFO* bind_info));

  MOCK_METHOD4_WITH_CALLTYPE(__stdcall, OnDataAvailable,
      HRESULT (DWORD flags,  // NOLINT
               DWORD size,
               FORMATETC* format,
               STGMEDIUM* storage));

  MOCK_METHOD2_WITH_CALLTYPE(__stdcall, OnObjectAvailable,
      HRESULT (REFIID riid,  // NOLINT
               IUnknown* unk));
};

class MockBindCtxImpl
  : public CComObjectRootEx<CComSingleThreadModel>,
    public IBindCtx {
 public:
BEGIN_COM_MAP(MockBindCtxImpl)
  COM_INTERFACE_ENTRY(IBindCtx)
END_COM_MAP()

  MOCK_METHOD1_WITH_CALLTYPE(__stdcall, RegisterObjectBound,
      HRESULT (IUnknown* object));  // NOLINT

  MOCK_METHOD1_WITH_CALLTYPE(__stdcall, RevokeObjectBound,
      HRESULT (IUnknown* object));  // NOLINT

  MOCK_METHOD0_WITH_CALLTYPE(__stdcall, ReleaseBoundObjects,
      HRESULT ());  // NOLINT

  MOCK_METHOD1_WITH_CALLTYPE(__stdcall, SetBindOptions,
      HRESULT (BIND_OPTS* options));   // NOLINT

  MOCK_METHOD1_WITH_CALLTYPE(__stdcall, GetBindOptions,
      HRESULT (BIND_OPTS* options));   // NOLINT

  MOCK_METHOD1_WITH_CALLTYPE(__stdcall, GetRunningObjectTable,
      HRESULT (IRunningObjectTable** rot));  // NOLINT

  MOCK_METHOD2_WITH_CALLTYPE(__stdcall, RegisterObjectParam,
      HRESULT (LPOLESTR key,  // NOLINT
               IUnknown* param));

  MOCK_METHOD2_WITH_CALLTYPE(__stdcall, GetObjectParam,
      HRESULT (LPOLESTR key,  // NOLINT
               IUnknown** param));

  MOCK_METHOD1_WITH_CALLTYPE(__stdcall, EnumObjectParam,
      HRESULT (IEnumString** enum_params));  // NOLINT

  MOCK_METHOD1_WITH_CALLTYPE(__stdcall, RevokeObjectParam,
      HRESULT (LPOLESTR key));  // NOLINT
};

class MockMonikerImpl
  : public CComObjectRootEx<CComSingleThreadModel>,
    public IMoniker {
 public:
BEGIN_COM_MAP(MockMonikerImpl)
  COM_INTERFACE_ENTRY(IMoniker)
END_COM_MAP()

  MOCK_METHOD4_WITH_CALLTYPE(__stdcall, BindToObject,
      HRESULT (IBindCtx* bind_context,  // NOLINT
               IMoniker* left,
               REFIID result_iid,
               void** object));

  MOCK_METHOD4_WITH_CALLTYPE(__stdcall, BindToStorage,
      HRESULT (IBindCtx* bind_context,  // NOLINT
               IMoniker* left,
               REFIID result_iid,
               void** storage));

  MOCK_METHOD4_WITH_CALLTYPE(__stdcall, Reduce,
      HRESULT (IBindCtx* bind_context,  // NOLINT
               DWORD reduce_depth,
               IMoniker* left,
               IMoniker** reduced));

  MOCK_METHOD3_WITH_CALLTYPE(__stdcall, ComposeWith,
      HRESULT (IBindCtx* right,  // NOLINT
               BOOL is_not_generic,
               IMoniker** composite));

  MOCK_METHOD2_WITH_CALLTYPE(__stdcall, Enum,
      HRESULT (BOOL is_forward,  // NOLINT
               IEnumMoniker** moniker_enum));

  MOCK_METHOD1_WITH_CALLTYPE(__stdcall, IsEqual,
      HRESULT (IMoniker* other));  // NOLINT

  MOCK_METHOD3_WITH_CALLTYPE(__stdcall, IsRunning,
      HRESULT (IBindCtx* bind_context,  // NOLINT
               IMoniker* left,
               IMoniker** newly_running));

  MOCK_METHOD3_WITH_CALLTYPE(__stdcall, GetTimeOfLastChange,
      HRESULT (IBindCtx* bind_context,  // NOLINT
               IMoniker* left,
                FILETIME *pFileTime));

  MOCK_METHOD1_WITH_CALLTYPE(__stdcall, Inverse,
      HRESULT (IMoniker** inversed));   // NOLINT

  MOCK_METHOD2_WITH_CALLTYPE(__stdcall, CommonPrefixWith,
      HRESULT (IMoniker* other,  // NOLINT
               IMoniker** prefix));

  MOCK_METHOD2_WITH_CALLTYPE(__stdcall, RelativePathTo,
      HRESULT (IMoniker* other,  // NOLINT
               IMoniker** relative));

    MOCK_METHOD3_WITH_CALLTYPE(__stdcall, GetDisplayName,
      HRESULT (IBindCtx* bind_context,  // NOLINT
               IMoniker* left,
               LPOLESTR* display_name));

    MOCK_METHOD5_WITH_CALLTYPE(__stdcall, ParseDisplayName,
      HRESULT (IBindCtx* bind_context,  // NOLINT
               IMoniker* left,
               LPOLESTR display_name,
               ULONG *pchEaten,
               IMoniker** ret));

  MOCK_METHOD1_WITH_CALLTYPE(__stdcall, IsSystemMoniker,
      HRESULT (DWORD* is_system));  // NOLINT
};

#endif  // CHROME_FRAME_TEST_URLMON_MONIKER_TESTS_H_