ReactOS  0.4.15-dev-3302-ga37d9a4
stream.c File Reference
#include <wine/test.h>
#include <stdarg.h>
#include <stddef.h>
#include "windef.h"
#include "winbase.h"
#include "ole2.h"
#include "urlmon.h"
#include "wininet.h"
Include dependency graph for stream.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define DEFINE_EXPECT(func)   static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
 
#define SET_EXPECT(func)   expect_ ## func = TRUE
 
#define CHECK_EXPECT(func)
 
#define CHECK_EXPECT2(func)
 
#define CHECK_CALLED(func)
 
#define CHECK_NOT_CALLED(func)
 
#define CLEAR_CALLED(func)   expect_ ## func = called_ ## func = FALSE
 

Functions

 DEFINE_EXPECT (QueryInterface_IServiceProvider)
 
 DEFINE_EXPECT (OnStartBinding)
 
 DEFINE_EXPECT (OnProgress_FINDINGRESOURCE)
 
 DEFINE_EXPECT (OnProgress_CONNECTING)
 
 DEFINE_EXPECT (OnProgress_SENDINGREQUEST)
 
 DEFINE_EXPECT (OnProgress_MIMETYPEAVAILABLE)
 
 DEFINE_EXPECT (OnProgress_BEGINDOWNLOADDATA)
 
 DEFINE_EXPECT (OnProgress_DOWNLOADINGDATA)
 
 DEFINE_EXPECT (OnProgress_ENDDOWNLOADDATA)
 
 DEFINE_EXPECT (OnStopBinding)
 
 DEFINE_EXPECT (OnDataAvailable)
 
 DEFINE_EXPECT (GetBindInfo)
 
static HRESULT WINAPI statusclb_QueryInterface (IBindStatusCallback *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI statusclb_AddRef (IBindStatusCallback *iface)
 
static ULONG WINAPI statusclb_Release (IBindStatusCallback *iface)
 
static HRESULT WINAPI statusclb_OnStartBinding (IBindStatusCallback *iface, DWORD dwReserved, IBinding *pib)
 
static HRESULT WINAPI statusclb_GetPriority (IBindStatusCallback *iface, LONG *pnPriority)
 
static HRESULT WINAPI statusclb_OnLowResource (IBindStatusCallback *iface, DWORD reserved)
 
static HRESULT WINAPI statusclb_OnProgress (IBindStatusCallback *iface, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
 
static HRESULT WINAPI statusclb_OnStopBinding (IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError)
 
static HRESULT WINAPI statusclb_GetBindInfo (IBindStatusCallback *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
 
static HRESULT WINAPI statusclb_OnDataAvailable (IBindStatusCallback *iface, DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
 
static HRESULT WINAPI statusclb_OnObjectAvailable (IBindStatusCallback *iface, REFIID riid, IUnknown *punk)
 
static void set_file_url (char *path)
 
static void create_file (void)
 
static void test_URLOpenBlockingStreamW (void)
 
static void test_URLOpenStreamW (void)
 
 START_TEST (stream)
 

Variables

static const CHAR wszIndexHtmlA [] = "index.html"
 
static WCHAR INDEX_HTML [MAX_PATH]
 
static const char szHtmlDoc [] = "<HTML></HTML>"
 
static const IBindStatusCallbackVtbl BindStatusCallbackVtbl
 
static IBindStatusCallback BindStatusCallback = { &BindStatusCallbackVtbl }
 

Macro Definition Documentation

◆ CHECK_CALLED

#define CHECK_CALLED (   func)
Value:
do { \
ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
GLenum func
Definition: glext.h:6028
#define FALSE
Definition: types.h:117

Definition at line 51 of file stream.c.

◆ CHECK_EXPECT

#define CHECK_EXPECT (   func)
Value:
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
expect_ ## func = FALSE; \
called_ ## func = TRUE; \
}while(0)
GLenum func
Definition: glext.h:6028
#define TRUE
Definition: types.h:120
#define expect_(expected, got, precision)
Definition: font.c:29
#define FALSE
Definition: types.h:117

Definition at line 38 of file stream.c.

◆ CHECK_EXPECT2

#define CHECK_EXPECT2 (   func)
Value:
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)
GLenum func
Definition: glext.h:6028
#define TRUE
Definition: types.h:120
#define expect_(expected, got, precision)
Definition: font.c:29

Definition at line 45 of file stream.c.

◆ CHECK_NOT_CALLED

#define CHECK_NOT_CALLED (   func)
Value:
do { \
ok(!called_ ## func, "unexpected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
GLenum func
Definition: glext.h:6028
#define FALSE
Definition: types.h:117

Definition at line 57 of file stream.c.

◆ CLEAR_CALLED

#define CLEAR_CALLED (   func)    expect_ ## func = called_ ## func = FALSE

Definition at line 63 of file stream.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 19 of file stream.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 20 of file stream.c.

◆ DEFINE_EXPECT

#define DEFINE_EXPECT (   func)    static BOOL expect_ ## func = FALSE, called_ ## func = FALSE

Definition at line 32 of file stream.c.

◆ SET_EXPECT

#define SET_EXPECT (   func)    expect_ ## func = TRUE

Definition at line 35 of file stream.c.

Function Documentation

◆ create_file()

static void create_file ( void  )
static

Definition at line 272 of file stream.c.

273 {
274  HANDLE file;
275  DWORD size;
276  CHAR path[MAX_PATH];
277 
280  ok(file != INVALID_HANDLE_VALUE, "CreateFile failed\n");
282  return;
283 
284  WriteFile(file, szHtmlDoc, sizeof(szHtmlDoc)-1, &size, NULL);
285  CloseHandle(file);
286 
288  lstrcatA(path, "\\");
291 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
static const CHAR wszIndexHtmlA[]
Definition: stream.c:79
#define CloseHandle
Definition: compat.h:598
char CHAR
Definition: xmlstorage.h:175
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define GENERIC_WRITE
Definition: nt_native.h:90
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
GLsizeiptr size
Definition: glext.h:5919
#define MAX_PATH
Definition: compat.h:34
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
static void set_file_url(char *path)
Definition: stream.c:263
#define CREATE_ALWAYS
Definition: disk.h:72
#define ok(value,...)
Definition: atltest.h:57
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2145
#define NULL
Definition: types.h:112
#define CreateFileA(a, b, c, d, e, f, g)
Definition: compat.h:599
static const char szHtmlDoc[]
Definition: stream.c:81
Definition: fci.c:126

Referenced by START_TEST().

◆ DEFINE_EXPECT() [1/12]

DEFINE_EXPECT ( QueryInterface_IServiceProvider  )

◆ DEFINE_EXPECT() [2/12]

DEFINE_EXPECT ( OnStartBinding  )

◆ DEFINE_EXPECT() [3/12]

DEFINE_EXPECT ( OnProgress_FINDINGRESOURCE  )

◆ DEFINE_EXPECT() [4/12]

DEFINE_EXPECT ( OnProgress_CONNECTING  )

◆ DEFINE_EXPECT() [5/12]

DEFINE_EXPECT ( OnProgress_SENDINGREQUEST  )

◆ DEFINE_EXPECT() [6/12]

DEFINE_EXPECT ( OnProgress_MIMETYPEAVAILABLE  )

◆ DEFINE_EXPECT() [7/12]

DEFINE_EXPECT ( OnProgress_BEGINDOWNLOADDATA  )

◆ DEFINE_EXPECT() [8/12]

DEFINE_EXPECT ( OnProgress_DOWNLOADINGDATA  )

◆ DEFINE_EXPECT() [9/12]

DEFINE_EXPECT ( OnProgress_ENDDOWNLOADDATA  )

◆ DEFINE_EXPECT() [10/12]

DEFINE_EXPECT ( OnStopBinding  )

◆ DEFINE_EXPECT() [11/12]

DEFINE_EXPECT ( OnDataAvailable  )

◆ DEFINE_EXPECT() [12/12]

DEFINE_EXPECT ( GetBindInfo  )

◆ set_file_url()

static void set_file_url ( char path)
static

Definition at line 263 of file stream.c.

264 {
265  char INDEX_HTML_A[MAX_PATH];
266 
267  lstrcpyA(INDEX_HTML_A, "file:///");
268  lstrcatA(INDEX_HTML_A, path);
269  MultiByteToWideChar(CP_ACP, 0, INDEX_HTML_A, -1, INDEX_HTML, MAX_PATH);
270 }
static WCHAR INDEX_HTML[MAX_PATH]
Definition: stream.c:80
#define CP_ACP
Definition: compat.h:109
LPSTR WINAPI lstrcatA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:123
#define MAX_PATH
Definition: compat.h:34
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define MultiByteToWideChar
Definition: compat.h:110

Referenced by create_file().

◆ START_TEST()

START_TEST ( stream  )

Definition at line 388 of file stream.c.

389 {
390  if(!GetProcAddress(GetModuleHandleA("urlmon.dll"), "CompareSecurityIds")) {
391  win_skip("Too old IE\n");
392  return;
393  }
394 
395  create_file();
399 }
static const CHAR wszIndexHtmlA[]
Definition: stream.c:79
static void test_URLOpenBlockingStreamW(void)
Definition: stream.c:293
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
static void test_URLOpenStreamW(void)
Definition: stream.c:354
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define GetProcAddress(x, y)
Definition: compat.h:612
static void create_file(void)
Definition: stream.c:272
#define win_skip
Definition: test.h:151

◆ statusclb_AddRef()

static ULONG WINAPI statusclb_AddRef ( IBindStatusCallback iface)
static

Definition at line 99 of file stream.c.

100 {
101  return 2;
102 }

◆ statusclb_GetBindInfo()

static HRESULT WINAPI statusclb_GetBindInfo ( IBindStatusCallback iface,
DWORD grfBINDF,
BINDINFO *  pbindinfo 
)
static

Definition at line 189 of file stream.c.

190 {
191  DWORD cbSize;
192 
193  CHECK_EXPECT(GetBindInfo);
194 
195  *grfBINDF = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
196  cbSize = pbindinfo->cbSize;
197  memset(pbindinfo, 0, cbSize);
198  pbindinfo->cbSize = cbSize;
199 
200  return S_OK;
201 }
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:52
#define CHECK_EXPECT(func)
Definition: stream.c:38
#define memset(x, y, z)
Definition: compat.h:39

◆ statusclb_GetPriority()

static HRESULT WINAPI statusclb_GetPriority ( IBindStatusCallback iface,
LONG pnPriority 
)
static

Definition at line 127 of file stream.c.

128 {
129  ok(0, "unexpected call\n");
130  return E_NOTIMPL;
131 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ statusclb_OnDataAvailable()

static HRESULT WINAPI statusclb_OnDataAvailable ( IBindStatusCallback iface,
DWORD  grfBSCF,
DWORD  dwSize,
FORMATETC *  pformatetc,
STGMEDIUM *  pstgmed 
)
static

Definition at line 203 of file stream.c.

205 {
206  HRESULT hres;
207  DWORD readed;
208  BYTE buf[512];
209 
210  CHECK_EXPECT2(OnDataAvailable);
211 
212  if (0)
213  {
214  /* FIXME: Uncomment after removing BindToStorage hack. */
215  ok(pformatetc != NULL, "pformatetx == NULL\n");
216  if(pformatetc) {
217  ok(pformatetc->cfFormat == 0xc02d, "clipformat=%x\n", pformatetc->cfFormat);
218  ok(pformatetc->ptd == NULL, "ptd = %p\n", pformatetc->ptd);
219  ok(pformatetc->dwAspect == 1, "dwAspect=%u\n", pformatetc->dwAspect);
220  ok(pformatetc->lindex == -1, "lindex=%d\n", pformatetc->lindex);
221  ok(pformatetc->tymed == TYMED_ISTREAM, "tymed=%u\n", pformatetc->tymed);
222  }
223 
224  ok(pstgmed != NULL, "stgmeg == NULL\n");
225  if(pstgmed) {
226  ok(pstgmed->tymed == TYMED_ISTREAM, "tymed=%u\n", pstgmed->tymed);
227  ok(U(*pstgmed).pstm != NULL, "pstm == NULL\n");
228  ok(pstgmed->pUnkForRelease != NULL, "pUnkForRelease == NULL\n");
229  }
230  }
231 
232  if(U(*pstgmed).pstm) {
233  do hres = IStream_Read(U(*pstgmed).pstm, buf, 512, &readed);
234  while(hres == S_OK);
235  ok(hres == S_FALSE || hres == E_PENDING, "IStream_Read returned %08x\n", hres);
236  }
237 
238  return S_OK;
239 }
#define U(x)
Definition: wordpad.c:45
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define S_FALSE
Definition: winerror.h:2357
HRESULT hres
Definition: protocol.c:465
#define CHECK_EXPECT2(func)
Definition: stream.c:45
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: xxhash.c:193
#define S_OK
Definition: intsafe.h:52
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define E_PENDING
Definition: dinput.h:172

◆ statusclb_OnLowResource()

static HRESULT WINAPI statusclb_OnLowResource ( IBindStatusCallback iface,
DWORD  reserved 
)
static

Definition at line 133 of file stream.c.

134 {
135  ok(0, "unexpected call\n");
136  return E_NOTIMPL;
137 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ statusclb_OnObjectAvailable()

static HRESULT WINAPI statusclb_OnObjectAvailable ( IBindStatusCallback iface,
REFIID  riid,
IUnknown punk 
)
static

Definition at line 241 of file stream.c.

242 {
243  ok(0, "unexpected call\n");
244  return E_NOTIMPL;
245 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ statusclb_OnProgress()

static HRESULT WINAPI statusclb_OnProgress ( IBindStatusCallback iface,
ULONG  ulProgress,
ULONG  ulProgressMax,
ULONG  ulStatusCode,
LPCWSTR  szStatusText 
)
static

Definition at line 139 of file stream.c.

141 {
142  switch(ulStatusCode) {
143  case BINDSTATUS_FINDINGRESOURCE:
144  CHECK_EXPECT(OnProgress_FINDINGRESOURCE);
145  break;
146  case BINDSTATUS_CONNECTING:
147  CHECK_EXPECT(OnProgress_CONNECTING);
148  break;
149  case BINDSTATUS_SENDINGREQUEST:
150  CHECK_EXPECT(OnProgress_SENDINGREQUEST);
151  break;
152  case BINDSTATUS_MIMETYPEAVAILABLE:
153  CHECK_EXPECT(OnProgress_MIMETYPEAVAILABLE);
154  break;
155  case BINDSTATUS_BEGINDOWNLOADDATA:
156  CHECK_EXPECT(OnProgress_BEGINDOWNLOADDATA);
157  ok(szStatusText != NULL, "szStatusText == NULL\n");
158  break;
159  case BINDSTATUS_DOWNLOADINGDATA:
160  CHECK_EXPECT2(OnProgress_DOWNLOADINGDATA);
161  break;
162  case BINDSTATUS_ENDDOWNLOADDATA:
163  CHECK_EXPECT(OnProgress_ENDDOWNLOADDATA);
164  ok(szStatusText != NULL, "szStatusText == NULL\n");
165  break;
166  case BINDSTATUS_CACHEFILENAMEAVAILABLE:
167  ok(szStatusText != NULL, "szStatusText == NULL\n");
168  break;
169  default:
170  todo_wine { ok(0, "unexpected code %d\n", ulStatusCode); }
171  };
172  return S_OK;
173 }
#define CHECK_EXPECT2(func)
Definition: stream.c:45
#define todo_wine
Definition: test.h:164
#define S_OK
Definition: intsafe.h:52
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define CHECK_EXPECT(func)
Definition: stream.c:38

◆ statusclb_OnStartBinding()

static HRESULT WINAPI statusclb_OnStartBinding ( IBindStatusCallback iface,
DWORD  dwReserved,
IBinding pib 
)
static

Definition at line 109 of file stream.c.

111 {
112  HRESULT hres;
113  IMoniker *mon;
114 
115  CHECK_EXPECT(OnStartBinding);
116 
117  ok(pib != NULL, "pib should not be NULL\n");
118 
119  hres = IBinding_QueryInterface(pib, &IID_IMoniker, (void**)&mon);
120  ok(hres == E_NOINTERFACE, "IBinding should not have IMoniker interface\n");
121  if(SUCCEEDED(hres))
122  IMoniker_Release(mon);
123 
124  return S_OK;
125 }
#define E_NOINTERFACE
Definition: winerror.h:2364
if SUCCEEDED(hr)
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:52
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define CHECK_EXPECT(func)
Definition: stream.c:38

◆ statusclb_OnStopBinding()

static HRESULT WINAPI statusclb_OnStopBinding ( IBindStatusCallback iface,
HRESULT  hresult,
LPCWSTR  szError 
)
static

Definition at line 175 of file stream.c.

176 {
177  CHECK_EXPECT(OnStopBinding);
178 
179  /* ignore DNS failure */
181  {
182  ok(SUCCEEDED(hresult), "Download failed: %08x\n", hresult);
183  ok(szError == NULL, "szError should be NULL\n");
184  }
185 
186  return S_OK;
187 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
if SUCCEEDED(hr)
#define ERROR_INTERNET_NAME_NOT_RESOLVED
Definition: wininet.h:1996
#define S_OK
Definition: intsafe.h:52
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define CHECK_EXPECT(func)
Definition: stream.c:38

◆ statusclb_QueryInterface()

static HRESULT WINAPI statusclb_QueryInterface ( IBindStatusCallback iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 83 of file stream.c.

84 {
85  if (IsEqualGUID(&IID_IBindStatusCallback, riid) ||
87  {
88  *ppv = iface;
89  return S_OK;
90  }
91  else if (IsEqualGUID(&IID_IServiceProvider, riid))
92  {
93  CHECK_EXPECT(QueryInterface_IServiceProvider);
94  }
95 
96  return E_NOINTERFACE;
97 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:52
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define CHECK_EXPECT(func)
Definition: stream.c:38

◆ statusclb_Release()

static ULONG WINAPI statusclb_Release ( IBindStatusCallback iface)
static

Definition at line 104 of file stream.c.

105 {
106  return 1;
107 }

◆ test_URLOpenBlockingStreamW()

static void test_URLOpenBlockingStreamW ( void  )
static

Definition at line 293 of file stream.c.

294 {
295  HRESULT hr;
296  IStream *pStream = NULL;
297  char buffer[256];
298 
300  ok(hr == E_INVALIDARG, "URLOpenBlockingStreamW should have failed with E_INVALIDARG instead of 0x%08x\n", hr);
301  if (0) /* crashes on Win2k */
302  {
304  ok(hr == E_INVALIDARG, "URLOpenBlockingStreamW should have failed with E_INVALIDARG instead of 0x%08x\n", hr);
305  }
306 
307  SET_EXPECT(GetBindInfo);
308  SET_EXPECT(QueryInterface_IServiceProvider);
309  SET_EXPECT(OnStartBinding);
310  SET_EXPECT(OnProgress_SENDINGREQUEST);
311  SET_EXPECT(OnProgress_MIMETYPEAVAILABLE);
312  SET_EXPECT(OnProgress_BEGINDOWNLOADDATA);
313  SET_EXPECT(OnProgress_ENDDOWNLOADDATA);
314  SET_EXPECT(OnStopBinding);
315 
317  ok(hr == S_OK, "URLOpenBlockingStreamW failed with error 0x%08x\n", hr);
318 
319  CHECK_CALLED(GetBindInfo);
320  todo_wine CHECK_CALLED(QueryInterface_IServiceProvider);
321  CHECK_CALLED(OnStartBinding);
322  CHECK_CALLED(OnProgress_SENDINGREQUEST);
323  CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE);
324  CHECK_CALLED(OnProgress_BEGINDOWNLOADDATA);
325  CHECK_CALLED(OnProgress_ENDDOWNLOADDATA);
326  CHECK_CALLED(OnStopBinding);
327 
328  ok(pStream != NULL, "pStream is NULL\n");
329  if(pStream)
330  {
331  buffer[0] = 0;
332  hr = IStream_Read(pStream, buffer, sizeof(buffer), NULL);
333  ok(hr == S_OK, "IStream_Read failed with error 0x%08x\n", hr);
334  ok(!memcmp(buffer, szHtmlDoc, sizeof(szHtmlDoc)-1), "read data differs from file\n");
335 
336  IStream_Release(pStream);
337  }
338 
339  hr = URLOpenBlockingStreamW(NULL, INDEX_HTML, &pStream, 0, NULL);
340  ok(hr == S_OK, "URLOpenBlockingStreamW failed with error 0x%08x\n", hr);
341 
342  ok(pStream != NULL, "pStream is NULL\n");
343  if(pStream)
344  {
345  buffer[0] = 0;
346  hr = IStream_Read(pStream, buffer, sizeof(buffer), NULL);
347  ok(hr == S_OK, "IStream_Read failed with error 0x%08x\n", hr);
348  ok(!memcmp(buffer, szHtmlDoc, sizeof(szHtmlDoc)-1), "read data differs from file\n");
349 
350  IStream_Release(pStream);
351  }
352 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
HRESULT hr
Definition: shlfolder.c:183
static WCHAR INDEX_HTML[MAX_PATH]
Definition: stream.c:80
GLuint buffer
Definition: glext.h:5915
#define SET_EXPECT(func)
Definition: stream.c:35
#define E_INVALIDARG
Definition: ddrawi.h:101
LONG HRESULT
Definition: typedefs.h:79
#define todo_wine
Definition: test.h:164
HRESULT WINAPI URLOpenBlockingStreamW(LPUNKNOWN pCaller, LPCWSTR szURL, LPSTREAM *ppStream, DWORD dwReserved, LPBINDSTATUSCALLBACK lpfnCB)
Definition: umstream.c:290
#define S_OK
Definition: intsafe.h:52
#define ok(value,...)
Definition: atltest.h:57
#define CHECK_CALLED(func)
Definition: stream.c:51
#define NULL
Definition: types.h:112
static const char szHtmlDoc[]
Definition: stream.c:81

Referenced by START_TEST().

◆ test_URLOpenStreamW()

static void test_URLOpenStreamW ( void  )
static

Definition at line 354 of file stream.c.

355 {
356  HRESULT hr;
357 
359  ok(hr == E_INVALIDARG, "URLOpenStreamW should have failed with E_INVALIDARG instead of 0x%08x\n", hr);
360 
361  SET_EXPECT(GetBindInfo);
362  SET_EXPECT(QueryInterface_IServiceProvider);
363  SET_EXPECT(OnStartBinding);
364  SET_EXPECT(OnProgress_SENDINGREQUEST);
365  SET_EXPECT(OnProgress_MIMETYPEAVAILABLE);
366  SET_EXPECT(OnProgress_BEGINDOWNLOADDATA);
367  SET_EXPECT(OnProgress_ENDDOWNLOADDATA);
368  SET_EXPECT(OnDataAvailable);
369  SET_EXPECT(OnStopBinding);
370 
372  ok(hr == S_OK, "URLOpenStreamW failed with error 0x%08x\n", hr);
373 
374  CHECK_CALLED(GetBindInfo);
375  todo_wine CHECK_CALLED(QueryInterface_IServiceProvider);
376  CHECK_CALLED(OnStartBinding);
377  CHECK_CALLED(OnProgress_SENDINGREQUEST);
378  CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE);
379  CHECK_CALLED(OnProgress_BEGINDOWNLOADDATA);
380  CHECK_CALLED(OnProgress_ENDDOWNLOADDATA);
381  CHECK_CALLED(OnDataAvailable);
382  CHECK_CALLED(OnStopBinding);
383 
385  ok(hr == S_OK, "URLOpenStreamW failed with error 0x%08x\n", hr);
386 }
HRESULT hr
Definition: shlfolder.c:183
static WCHAR INDEX_HTML[MAX_PATH]
Definition: stream.c:80
#define SET_EXPECT(func)
Definition: stream.c:35
#define E_INVALIDARG
Definition: ddrawi.h:101
LONG HRESULT
Definition: typedefs.h:79
HRESULT WINAPI URLOpenStreamW(LPUNKNOWN pCaller, LPCWSTR szURL, DWORD dwReserved, LPBINDSTATUSCALLBACK lpfnCB)
Definition: umstream.c:339
#define todo_wine
Definition: test.h:164
#define S_OK
Definition: intsafe.h:52
#define ok(value,...)
Definition: atltest.h:57
#define CHECK_CALLED(func)
Definition: stream.c:51
#define NULL
Definition: types.h:112

Referenced by START_TEST().

Variable Documentation

◆ BindStatusCallback

Definition at line 261 of file stream.c.

◆ BindStatusCallbackVtbl

const IBindStatusCallbackVtbl BindStatusCallbackVtbl
static
Initial value:
= {
}
static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError)
Definition: stream.c:175
static ULONG WINAPI statusclb_Release(IBindStatusCallback *iface)
Definition: stream.c:104
static HRESULT WINAPI statusclb_OnObjectAvailable(IBindStatusCallback *iface, REFIID riid, IUnknown *punk)
Definition: stream.c:241
static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallback *iface, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: stream.c:139
static ULONG WINAPI statusclb_AddRef(IBindStatusCallback *iface)
Definition: stream.c:99
static HRESULT WINAPI statusclb_OnStartBinding(IBindStatusCallback *iface, DWORD dwReserved, IBinding *pib)
Definition: stream.c:109
static HRESULT WINAPI statusclb_GetBindInfo(IBindStatusCallback *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
Definition: stream.c:189
static HRESULT WINAPI statusclb_OnLowResource(IBindStatusCallback *iface, DWORD reserved)
Definition: stream.c:133
static HRESULT WINAPI statusclb_QueryInterface(IBindStatusCallback *iface, REFIID riid, void **ppv)
Definition: stream.c:83
static HRESULT WINAPI statusclb_GetPriority(IBindStatusCallback *iface, LONG *pnPriority)
Definition: stream.c:127
static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallback *iface, DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
Definition: stream.c:203

Definition at line 247 of file stream.c.

◆ INDEX_HTML

WCHAR INDEX_HTML[MAX_PATH]
static

Definition at line 80 of file stream.c.

Referenced by set_file_url(), test_URLOpenBlockingStreamW(), and test_URLOpenStreamW().

◆ szHtmlDoc

const char szHtmlDoc[] = "<HTML></HTML>"
static

Definition at line 81 of file stream.c.

Referenced by create_file(), and test_URLOpenBlockingStreamW().

◆ wszIndexHtmlA

const CHAR wszIndexHtmlA[] = "index.html"
static

Definition at line 79 of file stream.c.

Referenced by create_file(), and START_TEST().