ReactOS  0.4.15-dev-1397-g19779b3
job.c File Reference
#include <stdio.h>
#include "wine/test.h"
#include "bits.h"
#include "initguid.h"
#include "bits2_0.h"
#include "bits2_5.h"
Include dependency graph for job.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Typedefs

typedef void(* test_t) (void)
 

Functions

static HRESULT test_create_manager (void)
 
static void init_paths (void)
 
static BOOL setup (void)
 
static void teardown (void)
 
static BOOL check_bits20 (void)
 
static BOOL check_bits25 (void)
 
static void test_GetId (void)
 
static void test_GetType (void)
 
static void test_GetName (void)
 
static void test_AddFile (void)
 
static void test_AddFileSet (void)
 
static void test_EnumFiles (void)
 
static void test_GetProgress_preTransfer (void)
 
static void test_GetState (void)
 
static void test_ResumeEmpty (void)
 
static void makeFile (WCHAR *name, const char *contents)
 
static void compareFiles (WCHAR *n1, WCHAR *n2)
 
static void test_CompleteLocal (void)
 
static void test_CompleteLocalURL (void)
 
static void test_NotifyFlags (void)
 
static void test_NotifyInterface (void)
 
static void test_Cancel (void)
 
static void test_HttpOptions (void)
 
 START_TEST (job)
 

Variables

static const WCHAR test_displayName [] = {'T', 'e', 's', 't', 0}
 
static WCHAR test_remotePathA [MAX_PATH]
 
static WCHAR test_remotePathB [MAX_PATH]
 
static WCHAR test_localPathA [MAX_PATH]
 
static WCHAR test_localPathB [MAX_PATH]
 
static IBackgroundCopyManagertest_manager
 
static IBackgroundCopyJobtest_job
 
static GUID test_jobId
 
static BG_JOB_TYPE test_type
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file job.c.

Typedef Documentation

◆ test_t

typedef void(* test_t) (void)

Definition at line 633 of file job.c.

Function Documentation

◆ check_bits20()

static BOOL check_bits20 ( void  )
static

Definition at line 111 of file job.c.

112 {
113  HRESULT hres;
114  IBackgroundCopyManager *manager;
115  IBackgroundCopyJob *job, *job3;
116 
117  hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL,
118  CLSCTX_LOCAL_SERVER, &IID_IBackgroundCopyManager,
119  (void **)&manager);
120  if (hres != S_OK) return FALSE;
121 
122  hres = IBackgroundCopyManager_CreateJob(manager, test_displayName, test_type, &test_jobId, &job);
123  if (hres != S_OK)
124  {
125  IBackgroundCopyManager_Release(manager);
126  return FALSE;
127  }
128 
129  hres = IBackgroundCopyJob_QueryInterface(job, &IID_IBackgroundCopyJob3, (void **)&job3);
130  IBackgroundCopyJob_Cancel(job);
131  IBackgroundCopyJob_Release(job);
132  if (hres != S_OK)
133  {
134  IBackgroundCopyManager_Release(manager);
135  return FALSE;
136  }
137 
138  IBackgroundCopyJob_Release(job3);
139  IBackgroundCopyManager_Release(manager);
140  return TRUE;
141 }
static HANDLE job
Definition: process.c:77
#define TRUE
Definition: types.h:120
static GUID test_jobId
Definition: job.c:39
#define FALSE
Definition: types.h:117
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
static BG_JOB_TYPE test_type
Definition: job.c:40
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
static const WCHAR test_displayName[]
Definition: job.c:32

Referenced by START_TEST().

◆ check_bits25()

static BOOL check_bits25 ( void  )
static

Definition at line 143 of file job.c.

144 {
145  HRESULT hres;
146  IBackgroundCopyManager *manager;
149 
150  hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL,
151  CLSCTX_LOCAL_SERVER, &IID_IBackgroundCopyManager,
152  (void **)&manager);
153  if (hres != S_OK) return FALSE;
154 
155  hres = IBackgroundCopyManager_CreateJob(manager, test_displayName, test_type, &test_jobId, &job);
156  if (hres != S_OK)
157  {
158  IBackgroundCopyManager_Release(manager);
159  return FALSE;
160  }
161 
162  hres = IBackgroundCopyJob_QueryInterface(job, &IID_IBackgroundCopyJobHttpOptions, (void **)&options);
163  IBackgroundCopyJob_Cancel(job);
164  IBackgroundCopyJob_Release(job);
165  if (hres != S_OK)
166  {
167  IBackgroundCopyManager_Release(manager);
168  return FALSE;
169  }
170 
171  IBackgroundCopyJobHttpOptions_Release(options);
172  IBackgroundCopyManager_Release(manager);
173  return TRUE;
174 }
static HANDLE job
Definition: process.c:77
#define TRUE
Definition: types.h:120
static GUID test_jobId
Definition: job.c:39
#define FALSE
Definition: types.h:117
int options
Definition: main.c:106
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
static BG_JOB_TYPE test_type
Definition: job.c:40
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
static const WCHAR test_displayName[]
Definition: job.c:32

Referenced by START_TEST().

◆ compareFiles()

static void compareFiles ( WCHAR n1,
WCHAR n2 
)
static

Definition at line 312 of file job.c.

313 {
314  char b1[256];
315  char b2[256];
316  DWORD s1, s2;
317  HANDLE f1, f2;
318 
321  ok(f1 != INVALID_HANDLE_VALUE, "CreateFile\n");
322 
325  ok(f2 != INVALID_HANDLE_VALUE, "CreateFile\n");
326 
327  /* Neither of these files is very big */
328  ok(ReadFile(f1, b1, sizeof b1, &s1, NULL), "ReadFile\n");
329  ok(ReadFile(f2, b2, sizeof b2, &s2, NULL), "ReadFile\n");
330 
331  CloseHandle(f1);
332  CloseHandle(f2);
333 
334  ok(s1 == s2, "Files differ in length\n");
335  ok(memcmp(b1, b2, s1) == 0, "Files differ in contents\n");
336 }
struct S2 s2
#define CloseHandle
Definition: compat.h:598
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define FILE_SHARE_READ
Definition: compat.h:136
static CRYPT_DATA_BLOB b1[]
Definition: msg.c:573
#define OPEN_EXISTING
Definition: compat.h:634
struct S1 s1
unsigned long DWORD
Definition: ntddk_ex.h:95
int n1
Definition: dwarfget.c:148
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define GENERIC_READ
Definition: compat.h:135
#define f1(x, y, z)
Definition: sha1.c:30
int n2
Definition: dwarfget.c:148
#define ok(value,...)
Definition: atltest.h:57
#define ReadFile(a, b, c, d, e)
Definition: compat.h:601
#define NULL
Definition: types.h:112
#define CreateFileW
Definition: compat.h:600
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:582
int f2(S1 &, S2 &)

Referenced by test_CompleteLocal(), and test_CompleteLocalURL().

◆ init_paths()

static void init_paths ( void  )
static

Definition at line 62 of file job.c.

63 {
64  WCHAR tmpDir[MAX_PATH];
65  WCHAR prefix[] = {'q', 'm', 'g', 'r', 0};
66 
67  GetTempPathW(MAX_PATH, tmpDir);
68 
69  GetTempFileNameW(tmpDir, prefix, 0, test_localPathA);
70  GetTempFileNameW(tmpDir, prefix, 0, test_localPathB);
71  GetTempFileNameW(tmpDir, prefix, 0, test_remotePathA);
72  GetTempFileNameW(tmpDir, prefix, 0, test_remotePathB);
73 }
static WCHAR test_localPathA[MAX_PATH]
Definition: job.c:35
static WCHAR test_localPathB[MAX_PATH]
Definition: job.c:36
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2079
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
static WCHAR test_remotePathB[MAX_PATH]
Definition: job.c:34
static WCHAR test_remotePathA[MAX_PATH]
Definition: job.c:33

Referenced by START_TEST().

◆ makeFile()

static void makeFile ( WCHAR name,
const char contents 
)
static

Definition at line 299 of file job.c.

300 {
301  HANDLE file;
302  DWORD w, len = strlen(contents);
303 
304  DeleteFileW(name);
307  ok(file != INVALID_HANDLE_VALUE, "CreateFile\n");
308  ok(WriteFile(file, contents, len, &w, NULL), "WriteFile\n");
309  CloseHandle(file);
310 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:598
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
#define GENERIC_WRITE
Definition: nt_native.h:90
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
const char file[]
Definition: icontest.c:11
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
GLenum GLsizei len
Definition: glext.h:6722
#define CREATE_ALWAYS
Definition: disk.h:72
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define CreateFileW
Definition: compat.h:600
Definition: name.c:38
Definition: fci.c:126

Referenced by test_CompleteLocal(), and test_CompleteLocalURL().

◆ setup()

static BOOL setup ( void  )
static

Definition at line 76 of file job.c.

77 {
78  HRESULT hres;
79 
81  test_job = NULL;
82  memset(&test_jobId, 0, sizeof test_jobId);
83  test_type = BG_JOB_TYPE_DOWNLOAD;
84 
85  hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL,
86  CLSCTX_LOCAL_SERVER,
87  &IID_IBackgroundCopyManager,
88  (void **) &test_manager);
89  if(hres != S_OK)
90  return FALSE;
91 
92  hres = IBackgroundCopyManager_CreateJob(test_manager, test_displayName,
94  if(hres != S_OK)
95  {
96  IBackgroundCopyManager_Release(test_manager);
97  return FALSE;
98  }
99 
100  return TRUE;
101 }
#define TRUE
Definition: types.h:120
static GUID test_jobId
Definition: job.c:39
#define FALSE
Definition: types.h:117
static IBackgroundCopyJob * test_job
Definition: job.c:38
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
static BG_JOB_TYPE test_type
Definition: job.c:40
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
#define memset(x, y, z)
Definition: compat.h:39
static const WCHAR test_displayName[]
Definition: job.c:32

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( job  )

Definition at line 635 of file job.c.

636 {
637  static const test_t tests[] = {
638  test_GetId,
639  test_GetType,
640  test_GetName,
646  0
647  };
648  static const test_t tests_bits20[] = {
649  test_AddFile,
654  test_Cancel, /* must be last */
655  0
656  };
657  static const test_t tests_bits25[] = {
659  0
660  };
661  const test_t *test;
662  int i;
663 
664  init_paths();
665 
667 
669  {
670  CoUninitialize();
671  win_skip("Failed to create Manager instance, skipping tests\n");
672  return;
673  }
674 
675  for (test = tests, i = 0; *test; ++test, ++i)
676  {
677  /* Keep state separate between tests. */
678  if (!setup())
679  {
680  ok(0, "tests:%d: Unable to setup test\n", i);
681  break;
682  }
683  (*test)();
684  teardown();
685  }
686 
687  if (check_bits20())
688  {
689  for (test = tests_bits20, i = 0; *test; ++test, ++i)
690  {
691  /* Keep state separate between tests. */
692  if (!setup())
693  {
694  ok(0, "tests_bits20:%d: Unable to setup test\n", i);
695  break;
696  }
697  (*test)();
698  teardown();
699  }
700  }
701  else
702  {
703  win_skip("Tests need BITS 2.0 or higher\n");
704  }
705 
706  if (check_bits25())
707  {
708  for (test = tests_bits25, i = 0; *test; ++test, ++i)
709  {
710  /* Keep state separate between tests. */
711  if (!setup())
712  {
713  ok(0, "tests_bits25:%d: Unable to setup test\n", i);
714  break;
715  }
716  (*test)();
717  teardown();
718  }
719  }
720  else
721  {
722  win_skip("Tests need BITS 2.5 or higher\n");
723  }
724 
725  CoUninitialize();
726 }
static void test_CompleteLocal(void)
Definition: job.c:339
static void test_HttpOptions(void)
Definition: job.c:509
static struct test_info tests[]
static void test_GetState(void)
Definition: job.c:273
static void teardown(void)
Definition: job.c:104
#define test
Definition: rosglue.h:37
static void test_AddFileSet(void)
Definition: job.c:225
static BOOL check_bits25(void)
Definition: job.c:143
static void test_NotifyFlags(void)
Definition: job.c:464
static void test_EnumFiles(void)
Definition: job.c:238
static void test_CompleteLocalURL(void)
Definition: job.c:392
static void test_GetType(void)
Definition: job.c:188
void(* test_t)(void)
Definition: job.c:633
static void test_ResumeEmpty(void)
Definition: job.c:285
static BOOL setup(void)
Definition: job.c:76
static void test_GetId(void)
Definition: job.c:177
static void test_AddFile(void)
Definition: job.c:211
static BOOL check_bits20(void)
Definition: job.c:111
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
static HRESULT test_create_manager(void)
Definition: job.c:42
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
static void test_GetProgress_preTransfer(void)
Definition: job.c:256
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
static void test_NotifyInterface(void)
Definition: job.c:476
static void test_GetName(void)
Definition: job.c:199
#define win_skip
Definition: test.h:149
static void test_Cancel(void)
Definition: job.c:487
static void init_paths(void)
Definition: job.c:62

◆ teardown()

static void teardown ( void  )
static

Definition at line 104 of file job.c.

105 {
106  IBackgroundCopyJob_Cancel(test_job);
107  IBackgroundCopyJob_Release(test_job);
108  IBackgroundCopyManager_Release(test_manager);
109 }
static IBackgroundCopyJob * test_job
Definition: job.c:38

Referenced by START_TEST().

◆ test_AddFile()

static void test_AddFile ( void  )
static

Definition at line 211 of file job.c.

212 {
213  HRESULT hres;
214 
215  hres = IBackgroundCopyJob_AddFile(test_job, test_remotePathA,
217  ok(hres == S_OK, "First call to AddFile failed: 0x%08x\n", hres);
218 
219  hres = IBackgroundCopyJob_AddFile(test_job, test_remotePathB,
221  ok(hres == S_OK, "Second call to AddFile failed: 0x%08x\n", hres);
222 }
static WCHAR test_localPathA[MAX_PATH]
Definition: job.c:35
static WCHAR test_localPathB[MAX_PATH]
Definition: job.c:36
static IBackgroundCopyJob * test_job
Definition: job.c:38
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
static WCHAR test_remotePathB[MAX_PATH]
Definition: job.c:34
static WCHAR test_remotePathA[MAX_PATH]
Definition: job.c:33

Referenced by START_TEST().

◆ test_AddFileSet()

static void test_AddFileSet ( void  )
static

Definition at line 225 of file job.c.

226 {
227  HRESULT hres;
228  BG_FILE_INFO files[2] =
229  {
232  };
233  hres = IBackgroundCopyJob_AddFileSet(test_job, 2, files);
234  ok(hres == S_OK, "AddFileSet failed: 0x%08x\n", hres);
235 }
static WCHAR test_localPathA[MAX_PATH]
Definition: job.c:35
static WCHAR test_localPathB[MAX_PATH]
Definition: job.c:36
static IBackgroundCopyJob * test_job
Definition: job.c:38
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
static WCHAR test_remotePathB[MAX_PATH]
Definition: job.c:34
static WCHAR test_remotePathA[MAX_PATH]
Definition: job.c:33

Referenced by START_TEST().

◆ test_Cancel()

static void test_Cancel ( void  )
static

Definition at line 487 of file job.c.

488 {
489  HRESULT hr;
490  BG_JOB_STATE state;
491 
492  state = BG_JOB_STATE_ERROR;
493  hr = IBackgroundCopyJob_GetState(test_job, &state);
494  ok(hr == S_OK, "got 0x%08x\n", hr);
495  ok(state != BG_JOB_STATE_CANCELLED, "got %u\n", state);
496 
497  hr = IBackgroundCopyJob_Cancel(test_job);
498  ok(hr == S_OK, "got 0x%08x\n", hr);
499 
500  state = BG_JOB_STATE_ERROR;
501  hr = IBackgroundCopyJob_GetState(test_job, &state);
502  ok(hr == S_OK, "got 0x%08x\n", hr);
503  ok(state == BG_JOB_STATE_CANCELLED, "got %u\n", state);
504 
505  hr = IBackgroundCopyJob_Cancel(test_job);
506  ok(hr == BG_E_INVALID_STATE, "got 0x%08x\n", hr);
507 }
HRESULT hr
Definition: shlfolder.c:183
#define BG_E_INVALID_STATE
Definition: bitsmsg.h:39
static IBackgroundCopyJob * test_job
Definition: job.c:38
LONG HRESULT
Definition: typedefs.h:79
static int state
Definition: maze.c:121
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_CompleteLocal()

static void test_CompleteLocal ( void  )
static

Definition at line 339 of file job.c.

340 {
341  static const int timeout_sec = 30;
342  HRESULT hres;
343  BG_JOB_STATE state;
344  int i;
345 
348  makeFile(test_remotePathA, "This is a WINE test file for BITS\n");
349  makeFile(test_remotePathB, "This is another WINE test file for BITS\n");
350 
351  hres = IBackgroundCopyJob_AddFile(test_job, test_remotePathA,
353  ok(hres == S_OK, "got 0x%08x\n", hres);
354 
355  hres = IBackgroundCopyJob_AddFile(test_job, test_remotePathB,
357  ok(hres == S_OK, "got 0x%08x\n", hres);
358 
359  hres = IBackgroundCopyJob_Resume(test_job);
360  ok(hres == S_OK, "IBackgroundCopyJob_Resume\n");
361 
363  for (i = 0; i < timeout_sec; ++i)
364  {
365  hres = IBackgroundCopyJob_GetState(test_job, &state);
366  ok(hres == S_OK, "IBackgroundCopyJob_GetState\n");
367  ok(state == BG_JOB_STATE_QUEUED || state == BG_JOB_STATE_CONNECTING
368  || state == BG_JOB_STATE_TRANSFERRING || state == BG_JOB_STATE_TRANSFERRED,
369  "Bad state: %d\n", state);
370  if (state == BG_JOB_STATE_TRANSFERRED)
371  break;
372  Sleep(1000);
373  }
374 
375  ok(i < timeout_sec, "BITS jobs timed out\n");
376  hres = IBackgroundCopyJob_Complete(test_job);
377  ok(hres == S_OK, "IBackgroundCopyJob_Complete\n");
378  hres = IBackgroundCopyJob_GetState(test_job, &state);
379  ok(hres == S_OK, "IBackgroundCopyJob_GetState\n");
380  ok(state == BG_JOB_STATE_ACKNOWLEDGED, "Bad state: %d\n", state);
381 
384 
385  ok(DeleteFileW(test_remotePathA), "DeleteFile\n");
386  ok(DeleteFileW(test_remotePathB), "DeleteFile\n");
389 }
static WCHAR test_localPathA[MAX_PATH]
Definition: job.c:35
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
static WCHAR test_localPathB[MAX_PATH]
Definition: job.c:36
static IBackgroundCopyJob * test_job
Definition: job.c:38
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
#define disable_success_count
Definition: test.h:170
static int state
Definition: maze.c:121
static void compareFiles(WCHAR *n1, WCHAR *n2)
Definition: job.c:312
#define S_OK
Definition: intsafe.h:51
static void makeFile(WCHAR *name, const char *contents)
Definition: job.c:299
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ok(value,...)
Definition: atltest.h:57
static WCHAR test_remotePathB[MAX_PATH]
Definition: job.c:34
static WCHAR test_remotePathA[MAX_PATH]
Definition: job.c:33

Referenced by START_TEST().

◆ test_CompleteLocalURL()

static void test_CompleteLocalURL ( void  )
static

Definition at line 392 of file job.c.

393 {
394  static const WCHAR prot[] = {'f','i','l','e',':','/','/', 0};
395  static const int timeout_sec = 30;
396  WCHAR *urlA, *urlB;
397  HRESULT hres;
398  BG_JOB_STATE state;
399  int i;
400 
403  makeFile(test_remotePathA, "This is a WINE test file for BITS\n");
404  makeFile(test_remotePathB, "This is another WINE test file for BITS\n");
405 
406  urlA = HeapAlloc(GetProcessHeap(), 0,
407  (7 + lstrlenW(test_remotePathA) + 1) * sizeof urlA[0]);
408  urlB = HeapAlloc(GetProcessHeap(), 0,
409  (7 + lstrlenW(test_remotePathB) + 1) * sizeof urlB[0]);
410  if (!urlA || !urlB)
411  {
412  skip("Unable to allocate memory for URLs\n");
413  HeapFree(GetProcessHeap(), 0, urlA);
414  HeapFree(GetProcessHeap(), 0, urlB);
415  return;
416  }
417 
418  lstrcpyW(urlA, prot);
419  lstrcatW(urlA, test_remotePathA);
420  lstrcpyW(urlB, prot);
421  lstrcatW(urlB, test_remotePathB);
422 
423  hres = IBackgroundCopyJob_AddFile(test_job, urlA, test_localPathA);
424  ok(hres == S_OK, "got 0x%08x\n", hres);
425 
426  hres = IBackgroundCopyJob_AddFile(test_job, urlB, test_localPathB);
427  ok(hres == S_OK, "got 0x%08x\n", hres);
428 
429  hres = IBackgroundCopyJob_Resume(test_job);
430  ok(hres == S_OK, "IBackgroundCopyJob_Resume\n");
431 
433  for (i = 0; i < timeout_sec; ++i)
434  {
435  hres = IBackgroundCopyJob_GetState(test_job, &state);
436  ok(hres == S_OK, "IBackgroundCopyJob_GetState\n");
437  ok(state == BG_JOB_STATE_QUEUED || state == BG_JOB_STATE_CONNECTING
438  || state == BG_JOB_STATE_TRANSFERRING || state == BG_JOB_STATE_TRANSFERRED,
439  "Bad state: %d\n", state);
440  if (state == BG_JOB_STATE_TRANSFERRED)
441  break;
442  Sleep(1000);
443  }
444 
445  ok(i < timeout_sec, "BITS jobs timed out\n");
446  hres = IBackgroundCopyJob_Complete(test_job);
447  ok(hres == S_OK, "IBackgroundCopyJob_Complete\n");
448  hres = IBackgroundCopyJob_GetState(test_job, &state);
449  ok(hres == S_OK, "IBackgroundCopyJob_GetState\n");
450  ok(state == BG_JOB_STATE_ACKNOWLEDGED, "Bad state: %d\n", state);
451 
454 
455  ok(DeleteFileW(test_remotePathA), "DeleteFile\n");
456  ok(DeleteFileW(test_remotePathB), "DeleteFile\n");
459 
460  HeapFree(GetProcessHeap(), 0, urlA);
461  HeapFree(GetProcessHeap(), 0, urlB);
462 }
static WCHAR test_localPathA[MAX_PATH]
Definition: job.c:35
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
#define lstrlenW
Definition: compat.h:609
static WCHAR test_localPathB[MAX_PATH]
Definition: job.c:36
static IBackgroundCopyJob * test_job
Definition: job.c:38
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
HRESULT hres
Definition: protocol.c:465
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define disable_success_count
Definition: test.h:170
static int state
Definition: maze.c:121
static void compareFiles(WCHAR *n1, WCHAR *n2)
Definition: job.c:312
#define S_OK
Definition: intsafe.h:51
static void makeFile(WCHAR *name, const char *contents)
Definition: job.c:299
#define lstrcpyW
Definition: compat.h:608
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
static WCHAR test_remotePathB[MAX_PATH]
Definition: job.c:34
static WCHAR test_remotePathA[MAX_PATH]
Definition: job.c:33
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by START_TEST().

◆ test_create_manager()

static HRESULT test_create_manager ( void  )
static

Definition at line 42 of file job.c.

43 {
44  HRESULT hres;
45  IBackgroundCopyManager *manager = NULL;
46 
47  /* Creating BITS instance */
48  hres = CoCreateInstance(&CLSID_BackgroundCopyManager, NULL, CLSCTX_LOCAL_SERVER,
49  &IID_IBackgroundCopyManager, (void **) &manager);
50 
52  win_skip("Needed Service is disabled\n");
53  return hres;
54  }
55 
56  if (hres == S_OK)
57  IBackgroundCopyManager_Release(manager);
58 
59  return hres;
60 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define ERROR_SERVICE_DISABLED
Definition: winerror.h:609
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
#define win_skip
Definition: test.h:149

Referenced by START_TEST().

◆ test_EnumFiles()

static void test_EnumFiles ( void  )
static

Definition at line 238 of file job.c.

239 {
240  HRESULT hres;
241  IEnumBackgroundCopyFiles *enumFiles;
242  ULONG res;
243 
244  hres = IBackgroundCopyJob_AddFile(test_job, test_remotePathA,
246  ok(hres == S_OK, "got 0x%08x\n", hres);
247 
248  hres = IBackgroundCopyJob_EnumFiles(test_job, &enumFiles);
249  ok(hres == S_OK, "EnumFiles failed: 0x%08x\n", hres);
250 
251  res = IEnumBackgroundCopyFiles_Release(enumFiles);
252  ok(res == 0, "Bad ref count on release: %u\n", res);
253 }
static WCHAR test_localPathA[MAX_PATH]
Definition: job.c:35
static IBackgroundCopyJob * test_job
Definition: job.c:38
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
GLuint res
Definition: glext.h:9613
static WCHAR test_remotePathA[MAX_PATH]
Definition: job.c:33
unsigned int ULONG
Definition: retypes.h:1

Referenced by START_TEST().

◆ test_GetId()

static void test_GetId ( void  )
static

Definition at line 177 of file job.c.

178 {
179  HRESULT hres;
180  GUID tmpId;
181 
182  hres = IBackgroundCopyJob_GetId(test_job, &tmpId);
183  ok(hres == S_OK, "GetId failed: %08x\n", hres);
184  ok(memcmp(&tmpId, &test_jobId, sizeof tmpId) == 0, "Got incorrect GUID\n");
185 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static GUID test_jobId
Definition: job.c:39
static IBackgroundCopyJob * test_job
Definition: job.c:38
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_GetName()

static void test_GetName ( void  )
static

Definition at line 199 of file job.c.

200 {
201  HRESULT hres;
203 
204  hres = IBackgroundCopyJob_GetDisplayName(test_job, &displayName);
205  ok(hres == S_OK, "GetName failed: %08x\n", hres);
206  ok(lstrcmpW(displayName, test_displayName) == 0, "Got incorrect type\n");
208 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
char displayName[]
Definition: tftpd.cpp:35
static IBackgroundCopyJob * test_job
Definition: job.c:38
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static const WCHAR test_displayName[]
Definition: job.c:32

Referenced by START_TEST().

◆ test_GetProgress_preTransfer()

static void test_GetProgress_preTransfer ( void  )
static

Definition at line 256 of file job.c.

257 {
258  HRESULT hres;
259  BG_JOB_PROGRESS progress;
260 
261  hres = IBackgroundCopyJob_GetProgress(test_job, &progress);
262  ok(hres == S_OK, "GetProgress failed: 0x%08x\n", hres);
263 
264  ok(progress.BytesTotal == 0, "Incorrect BytesTotal: %s\n",
265  wine_dbgstr_longlong(progress.BytesTotal));
266  ok(progress.BytesTransferred == 0, "Incorrect BytesTransferred: %s\n",
267  wine_dbgstr_longlong(progress.BytesTransferred));
268  ok(progress.FilesTotal == 0, "Incorrect FilesTotal: %u\n", progress.FilesTotal);
269  ok(progress.FilesTransferred == 0, "Incorrect FilesTransferred %u\n", progress.FilesTransferred);
270 }
static IBackgroundCopyJob * test_job
Definition: job.c:38
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
cd_progress_ptr progress
Definition: cdjpeg.h:152
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49

Referenced by START_TEST().

◆ test_GetState()

static void test_GetState ( void  )
static

Definition at line 273 of file job.c.

274 {
275  HRESULT hres;
276  BG_JOB_STATE state;
277 
278  state = BG_JOB_STATE_ERROR;
279  hres = IBackgroundCopyJob_GetState(test_job, &state);
280  ok(hres == S_OK, "GetState failed: 0x%08x\n", hres);
281  ok(state == BG_JOB_STATE_SUSPENDED, "Incorrect job state: %d\n", state);
282 }
static IBackgroundCopyJob * test_job
Definition: job.c:38
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
static int state
Definition: maze.c:121
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

◆ test_GetType()

static void test_GetType ( void  )
static

Definition at line 188 of file job.c.

189 {
190  HRESULT hres;
191  BG_JOB_TYPE type;
192 
193  hres = IBackgroundCopyJob_GetType(test_job, &type);
194  ok(hres == S_OK, "GetType failed: %08x\n", hres);
195  ok(type == test_type, "Got incorrect type\n");
196 }
static IBackgroundCopyJob * test_job
Definition: job.c:38
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
static BG_JOB_TYPE test_type
Definition: job.c:40
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by START_TEST().

◆ test_HttpOptions()

static void test_HttpOptions ( void  )
static

Definition at line 509 of file job.c.

510 {
511  static const WCHAR urlW[] =
512  {'h','t','t','p','s',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g','/',0};
513  static const WCHAR winetestW[] =
514  {'W','i','n','e',':',' ','t','e','s','t','\r','\n',0};
515  static const unsigned int timeout = 30;
516  HRESULT hr;
519  BG_JOB_STATE state;
520  unsigned int i;
521  WCHAR *headers;
522  ULONG flags, orig_flags;
523 
525  hr = IBackgroundCopyJob_AddFile(test_job, urlW, test_localPathA);
526  ok(hr == S_OK, "got 0x%08x\n", hr);
527 
528  hr = IBackgroundCopyJob_QueryInterface(test_job, &IID_IBackgroundCopyJobHttpOptions, (void **)&options);
529  ok(hr == S_OK, "got 0x%08x\n", hr);
530 
531  if (options)
532  {
533  headers = (WCHAR *)0xdeadbeef;
534  hr = IBackgroundCopyJobHttpOptions_GetCustomHeaders(options, &headers);
535  ok(hr == S_FALSE, "got 0x%08x\n", hr);
536  ok(headers == NULL, "got %p\n", headers);
537 
538  hr = IBackgroundCopyJobHttpOptions_SetCustomHeaders(options, winetestW);
539  ok(hr == S_OK, "got 0x%08x\n", hr);
540 
541  headers = (WCHAR *)0xdeadbeef;
542  hr = IBackgroundCopyJobHttpOptions_GetCustomHeaders(options, &headers);
543  ok(hr == S_OK, "got 0x%08x\n", hr);
544  if (hr == S_OK)
545  {
546  ok(!lstrcmpW(headers, winetestW), "got %s\n", wine_dbgstr_w(headers));
548  }
549 
550  hr = IBackgroundCopyJobHttpOptions_SetCustomHeaders(options, NULL);
551  ok(hr == S_OK, "got 0x%08x\n", hr);
552 
553  headers = (WCHAR *)0xdeadbeef;
554  hr = IBackgroundCopyJobHttpOptions_GetCustomHeaders(options, &headers);
555  ok(hr == S_FALSE, "got 0x%08x\n", hr);
556  ok(headers == NULL, "got %p\n", headers);
557 
558  orig_flags = 0xdeadbeef;
559  hr = IBackgroundCopyJobHttpOptions_GetSecurityFlags(options, &orig_flags);
560  ok(hr == S_OK, "got 0x%08x\n", hr);
561  ok(!orig_flags, "got 0x%08x\n", orig_flags);
562 
563  hr = IBackgroundCopyJobHttpOptions_SetSecurityFlags(options, 0);
564  ok(hr == S_OK, "got 0x%08x\n", hr);
565 
566  flags = 0xdeadbeef;
567  hr = IBackgroundCopyJobHttpOptions_GetSecurityFlags(options, &flags);
568  ok(hr == S_OK, "got 0x%08x\n", hr);
569  ok(!flags, "got 0x%08x\n", flags);
570  }
571 
572  hr = IBackgroundCopyJob_Resume(test_job);
573  ok(hr == S_OK, "got 0x%08x\n", hr);
574 
576  for (i = 0; i < timeout; i++)
577  {
578  hr = IBackgroundCopyJob_GetState(test_job, &state);
579  ok(hr == S_OK, "got 0x%08x\n", hr);
580 
581  ok(state == BG_JOB_STATE_QUEUED ||
582  state == BG_JOB_STATE_CONNECTING ||
583  state == BG_JOB_STATE_TRANSFERRING ||
584  state == BG_JOB_STATE_TRANSFERRED, "unexpected state: %u\n", state);
585 
586  if (state == BG_JOB_STATE_TRANSFERRED) break;
587  Sleep(1000);
588  }
589  ok(i < timeout, "BITS job timed out\n");
590  if (i < timeout)
591  {
592  hr = IBackgroundCopyJob_GetError(test_job, &error);
593  ok(hr == BG_E_ERROR_INFORMATION_UNAVAILABLE, "got 0x%08x\n", hr);
594  }
595 
596  if (options)
597  {
598  headers = (WCHAR *)0xdeadbeef;
599  hr = IBackgroundCopyJobHttpOptions_GetCustomHeaders(options, &headers);
600  ok(hr == S_FALSE, "got 0x%08x\n", hr);
601  ok(headers == NULL, "got %p\n", headers);
602 
603  hr = IBackgroundCopyJobHttpOptions_SetCustomHeaders(options, NULL);
604  ok(hr == S_OK, "got 0x%08x\n", hr);
605 
606  hr = IBackgroundCopyJobHttpOptions_GetCustomHeaders(options, &headers);
607  ok(hr == S_FALSE, "got 0x%08x\n", hr);
608 
609  flags = 0xdeadbeef;
610  hr = IBackgroundCopyJobHttpOptions_GetSecurityFlags(options, &flags);
611  ok(hr == S_OK, "got 0x%08x\n", hr);
612  ok(!flags, "got 0x%08x\n", flags);
613 
614  hr = IBackgroundCopyJobHttpOptions_SetSecurityFlags(options, orig_flags);
615  ok(hr == S_OK, "got 0x%08x\n", hr);
616 
617  IBackgroundCopyJobHttpOptions_Release(options);
618  }
619 
620  hr = IBackgroundCopyJob_Complete(test_job);
621  ok(hr == S_OK, "got 0x%08x\n", hr);
622 
623  hr = IBackgroundCopyJob_GetState(test_job, &state);
624  ok(hr == S_OK, "got 0x%08x\n", hr);
625  ok(state == BG_JOB_STATE_ACKNOWLEDGED, "unexpected state: %u\n", state);
626 
627  hr = IBackgroundCopyJob_Complete(test_job);
628  ok(hr == BG_E_INVALID_STATE, "got 0x%08x\n", hr);
629 
631 }
static WCHAR test_localPathA[MAX_PATH]
Definition: job.c:35
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
HRESULT hr
Definition: shlfolder.c:183
#define error(str)
Definition: mkdosfs.c:1605
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
vector< Header * > headers
Definition: sdkparse.cpp:39
Definition: dhcpd.h:245
GLbitfield GLuint64 timeout
Definition: glext.h:7164
#define BG_E_INVALID_STATE
Definition: bitsmsg.h:39
static IBackgroundCopyJob * test_job
Definition: job.c:38
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
#define S_FALSE
Definition: winerror.h:2357
static const WCHAR winetestW[]
Definition: shelldispatch.c:47
int options
Definition: main.c:106
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
#define disable_success_count
Definition: test.h:170
GLbitfield flags
Definition: glext.h:7161
static int state
Definition: maze.c:121
#define S_OK
Definition: intsafe.h:51
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define BG_E_ERROR_INFORMATION_UNAVAILABLE
Definition: bitsmsg.h:45
unsigned int ULONG
Definition: retypes.h:1

Referenced by START_TEST().

◆ test_NotifyFlags()

static void test_NotifyFlags ( void  )
static

Definition at line 464 of file job.c.

465 {
466  ULONG flags;
467  HRESULT hr;
468 
469  /* check default flags */
470  flags = 0;
471  hr = IBackgroundCopyJob_GetNotifyFlags(test_job, &flags);
472  ok(hr == S_OK, "got 0x%08x\n", hr);
473  ok(flags == (BG_NOTIFY_JOB_ERROR | BG_NOTIFY_JOB_TRANSFERRED), "flags 0x%08x\n", flags);
474 }
HRESULT hr
Definition: shlfolder.c:183
static IBackgroundCopyJob * test_job
Definition: job.c:38
LONG HRESULT
Definition: typedefs.h:79
GLbitfield flags
Definition: glext.h:7161
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
unsigned int ULONG
Definition: retypes.h:1

Referenced by START_TEST().

◆ test_NotifyInterface()

static void test_NotifyInterface ( void  )
static

Definition at line 476 of file job.c.

477 {
478  HRESULT hr;
479  IUnknown *unk;
480 
481  unk = (IUnknown*)0xdeadbeef;
482  hr = IBackgroundCopyJob_GetNotifyInterface(test_job, &unk);
483  ok(hr == S_OK, "got 0x%08x\n", hr);
484  ok(unk == NULL, "got %p\n", unk);
485 }
HRESULT hr
Definition: shlfolder.c:183
static IBackgroundCopyJob * test_job
Definition: job.c:38
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112

Referenced by START_TEST().

◆ test_ResumeEmpty()

static void test_ResumeEmpty ( void  )
static

Definition at line 285 of file job.c.

286 {
287  HRESULT hres;
288  BG_JOB_STATE state;
289 
290  hres = IBackgroundCopyJob_Resume(test_job);
291  ok(hres == BG_E_EMPTY, "Resume failed to return BG_E_EMPTY error: 0x%08x\n", hres);
292 
293  state = BG_JOB_STATE_ERROR;
294  hres = IBackgroundCopyJob_GetState(test_job, &state);
295  ok(hres == S_OK, "got 0x%08x\n", hres);
296  ok(state == BG_JOB_STATE_SUSPENDED, "Incorrect job state: %d\n", state);
297 }
#define BG_E_EMPTY
Definition: bitsmsg.h:40
static IBackgroundCopyJob * test_job
Definition: job.c:38
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
static int state
Definition: maze.c:121
#define S_OK
Definition: intsafe.h:51
#define ok(value,...)
Definition: atltest.h:57

Referenced by START_TEST().

Variable Documentation

◆ test_displayName

const WCHAR test_displayName[] = {'T', 'e', 's', 't', 0}
static

Definition at line 32 of file job.c.

Referenced by check_bits20(), check_bits25(), setup(), and test_GetName().

◆ test_job

◆ test_jobId

GUID test_jobId
static

Definition at line 39 of file job.c.

Referenced by check_bits20(), check_bits25(), setup(), and test_GetId().

◆ test_localPathA

◆ test_localPathB

WCHAR test_localPathB[MAX_PATH]
static

◆ test_manager

Definition at line 37 of file job.c.

◆ test_remotePathA

WCHAR test_remotePathA[MAX_PATH]
static

◆ test_remotePathB

WCHAR test_remotePathB[MAX_PATH]
static

◆ test_type

BG_JOB_TYPE test_type
static

Definition at line 40 of file job.c.

Referenced by check_bits20(), check_bits25(), setup(), test_GetType(), and test_ICInfo().