taskschd/tests: Use IP 0.0.0.0 as a bad server name and test that unsuccessful connection attempt shouldn't trash an existing connection.
This commit is contained in:
parent
134697b69f
commit
3826fc844a
|
@ -30,13 +30,14 @@
|
|||
|
||||
static void test_Connect(void)
|
||||
{
|
||||
static const WCHAR deadbeefW[] = { 'd','e','a','d','b','e','e','f',0 };
|
||||
static const WCHAR deadbeefW[] = { '0','.','0','.','0','.','0',0 };
|
||||
WCHAR comp_name[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
DWORD len;
|
||||
HRESULT hr;
|
||||
BSTR bstr;
|
||||
VARIANT v_null, v_comp;
|
||||
VARIANT_BOOL vbool;
|
||||
BOOL was_connected;
|
||||
ITaskService *service;
|
||||
|
||||
hr = CoCreateInstance(&CLSID_TaskScheduler, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskService, (void **)&service);
|
||||
|
@ -73,17 +74,20 @@ static void test_Connect(void)
|
|||
|
||||
hr = ITaskService_Connect(service, v_comp, v_null, v_null, v_null);
|
||||
ok(hr == S_OK || hr == E_ACCESSDENIED /* not an administrator */, "Connect error %#x\n", hr);
|
||||
was_connected = hr == S_OK;
|
||||
|
||||
SysFreeString(V_BSTR(&v_comp));
|
||||
V_BSTR(&v_comp) = SysAllocString(deadbeefW);
|
||||
|
||||
hr = ITaskService_Connect(service, v_comp, v_null, v_null, v_null);
|
||||
ok(hr == HRESULT_FROM_WIN32(ERROR_BAD_NETPATH), "expected ERROR_BAD_NETPATH, got %#x\n", hr);
|
||||
todo_wine
|
||||
ok(hr == HRESULT_FROM_WIN32(RPC_S_INVALID_NET_ADDR), "expected RPC_S_INVALID_NET_ADDR, got %#x\n", hr);
|
||||
|
||||
vbool = 0xdead;
|
||||
hr = ITaskService_get_Connected(service, &vbool);
|
||||
ok(hr == S_OK, "get_Connected error %#x\n", hr);
|
||||
ok(vbool == VARIANT_TRUE, "expected VARIANT_TRUE, got %d\n", vbool);
|
||||
ok(vbool == VARIANT_FALSE || (was_connected && vbool == VARIANT_TRUE),
|
||||
"Connect shouldn't trash an existing connection, got %d (was connected %d)\n", vbool, was_connected);
|
||||
|
||||
hr = ITaskService_Connect(service, v_null, v_null, v_null, v_null);
|
||||
ok(hr == S_OK, "Connect error %#x\n", hr);
|
||||
|
@ -95,12 +99,12 @@ static void test_Connect(void)
|
|||
|
||||
hr = ITaskService_get_TargetServer(service, &bstr);
|
||||
ok(hr == S_OK, "get_TargetServer error %#x\n", hr);
|
||||
if (hr == S_OK)
|
||||
{
|
||||
ok(!lstrcmpW(comp_name, bstr), "compname %s != server name %s\n", wine_dbgstr_w(comp_name), wine_dbgstr_w(bstr));
|
||||
SysFreeString(bstr);
|
||||
}
|
||||
ok(!lstrcmpW(comp_name, bstr), "compname %s != server name %s\n", wine_dbgstr_w(comp_name), wine_dbgstr_w(bstr));
|
||||
SysFreeString(bstr);
|
||||
|
||||
SysFreeString(V_BSTR(&v_comp));
|
||||
|
||||
ITaskService_Release(service);
|
||||
}
|
||||
|
||||
START_TEST(scheduler)
|
||||
|
|
Loading…
Reference in New Issue