hlink/tests: Add tests for navigating from a string reference.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2017-11-30 10:21:01 -06:00 committed by Alexandre Julliard
parent f39c6c3cbd
commit 46aba95642
1 changed files with 67 additions and 12 deletions

View File

@ -67,6 +67,9 @@ DEFINE_EXPECT(GetClassID);
DEFINE_EXPECT(Save);
DEFINE_EXPECT(HBC_QueryInterface_IHlinkHistory);
DEFINE_EXPECT(HBC_QueryInterface_IMarshal);
DEFINE_EXPECT(HBC_QueryInterface_IdentityUnmarshal);
DEFINE_EXPECT(HBC_QueryInterface_IUnknown);
DEFINE_EXPECT(HBC_GetObject);
DEFINE_EXPECT(HBC_UpdateHlink);
@ -77,8 +80,16 @@ DEFINE_EXPECT(HT_GetFriendlyName);
DEFINE_EXPECT(HLF_UpdateHlink);
DEFINE_GUID(CLSID_IdentityUnmarshal,0x0000001b,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46);
DEFINE_GUID(IID_IHlinkHistory,0x79eac9c8,0xbaf9,0x11ce,0x8c,0x82,0x00,0xaa,0x00,0x4b,0xa9,0x0b);
static const WCHAR winehq_urlW[] =
{'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',
'/','t','e','s','t','s','/','h','e','l','l','o','.','h','t','m','l',0};
static const WCHAR winehq_404W[] =
{'h','t','t','p',':','/','/','t','e','s','t','.','w','i','n','e','h','q','.','o','r','g',
'/','t','e','s','t','s','/','f','a','k','e','u','r','l',0};
static void test_HlinkIsShortcut(void)
{
UINT i;
@ -627,9 +638,6 @@ static void test_HlinkParseDisplayName(void)
IBindCtx *bctx;
HRESULT hres;
static const WCHAR winehq_urlW[] =
{'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',
'/','s','i','t','e','/','a','b','o','u','t',0};
static const WCHAR invalid_urlW[] = {'t','e','s','t',':','1','2','3','a','b','c',0};
static const WCHAR clsid_nameW[] = {'c','l','s','i','d',':',
'2','0','D','0','4','F','E','0','-','3','A','E','A','-','1','0','6','9','-','A','2','D','8',
@ -829,12 +837,17 @@ static HRESULT WINAPI HlinkBrowseContext_QueryInterface(
{
*ppv = NULL;
if(IsEqualGUID(&IID_IHlinkHistory, riid)) {
if (IsEqualGUID(&IID_IHlinkHistory, riid))
CHECK_EXPECT(HBC_QueryInterface_IHlinkHistory);
return E_NOINTERFACE;
}
else if (IsEqualGUID(&IID_IMarshal, riid))
CHECK_EXPECT2(HBC_QueryInterface_IMarshal);
else if (IsEqualGUID(&CLSID_IdentityUnmarshal, riid))
CHECK_EXPECT(HBC_QueryInterface_IdentityUnmarshal);
else if (IsEqualGUID(&IID_IUnknown, riid))
CHECK_EXPECT(HBC_QueryInterface_IUnknown);
else
ok(0, "unexpected interface: %s\n", wine_dbgstr_guid(riid));
ok(0, "unexpected interface: %s\n", wine_dbgstr_guid(riid));
return E_NOINTERFACE;
}
@ -859,9 +872,17 @@ static IMoniker Moniker;
static HRESULT WINAPI HlinkBrowseContext_GetObject(IHlinkBrowseContext *iface,
IMoniker *pimk, BOOL fBindIfRootRegistered, IUnknown **ppiunk)
{
IBindCtx *bctx;
WCHAR *name;
CHECK_EXPECT(HBC_GetObject);
ok(pimk == &Moniker, "pimk != &Moniker\n");
CreateBindCtx(0, &bctx);
IMoniker_GetDisplayName(pimk, bctx, NULL, &name);
ok(!lstrcmpW(winehq_urlW, name) || !lstrcmpW(winehq_404W, name), "got unexpected url\n");
CoTaskMemFree(name);
IBindCtx_Release(bctx);
ok(fBindIfRootRegistered == 1, "fBindIfRootRegistered = %x\n", fBindIfRootRegistered);
*ppiunk = NULL;
return S_FALSE;
@ -1205,10 +1226,6 @@ static HRESULT WINAPI Moniker_RelativePathTo(IMoniker *iface, IMoniker *pmkOther
static HRESULT WINAPI Moniker_GetDisplayName(IMoniker *iface, IBindCtx *pbc,
IMoniker *pmkToLeft, LPOLESTR *ppszDisplayName)
{
static const WCHAR winehq_urlW[] =
{'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',
'/','s','i','t','e','/','a','b','o','u','t',0};
CHECK_EXPECT2(GetDisplayName);
ok(pbc != NULL, "pbc == NULL\n");
@ -2206,6 +2223,44 @@ static void test_Hlink_Navigate(void)
CHECK_CALLED(HT_Navigate);
todo_wine CHECK_CALLED(HT_GetFriendlyName);
if (0) { /* these currently open a browser window on wine */
/* Test from string */
SET_EXPECT(HBC_GetObject);
hres = HlinkNavigateToStringReference(winehq_404W, NULL, NULL, 0, NULL, 0, pbc, NULL, &HlinkBrowseContext);
todo_wine ok(hres == INET_E_OBJECT_NOT_FOUND, "Expected INET_E_OBJECT_NOT_FOUND, got %08x\n", hres);
todo_wine CHECK_CALLED(HBC_GetObject);
/* MSDN claims browse context and bind context can't be null, but they can */
SET_EXPECT(HBC_GetObject);
hres = HlinkNavigateToStringReference(winehq_404W, NULL, NULL, 0, NULL, 0, NULL, NULL, &HlinkBrowseContext);
todo_wine ok(hres == INET_E_OBJECT_NOT_FOUND, "Expected INET_E_OBJECT_NOT_FOUND, got %08x\n", hres);
todo_wine CHECK_CALLED(HBC_GetObject);
}
/* these open a browser window, so mark them interactive only */
if (winetest_interactive)
{
/* both parameters null */
hres = HlinkNavigateToStringReference(winehq_404W, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);
todo_wine ok(hres == DRAGDROP_S_DROP, "Expected DRAGDROP_S_DROP, got %08x\n", hres);
/* try basic test with valid URL */
SET_EXPECT(HBC_GetObject);
SET_EXPECT(HBC_QueryInterface_IHlinkHistory);
SET_EXPECT(HBC_QueryInterface_IMarshal);
SET_EXPECT(HBC_QueryInterface_IdentityUnmarshal);
SET_EXPECT(HBC_QueryInterface_IUnknown);
hres = HlinkNavigateToStringReference(winehq_urlW, NULL, NULL, 0, NULL, 0, pbc, NULL, &HlinkBrowseContext);
ok(hres == S_OK, "Expected S_OK, got %08x\n", hres);
todo_wine CHECK_CALLED(HBC_GetObject);
todo_wine CHECK_CALLED(HBC_QueryInterface_IHlinkHistory);
todo_wine CHECK_CALLED(HBC_QueryInterface_IMarshal);
todo_wine CHECK_CALLED(HBC_QueryInterface_IdentityUnmarshal);
todo_wine CHECK_CALLED(HBC_QueryInterface_IUnknown);
}
else
skip("interactive IHlink_Navigate tests\n");
IHlink_Release(hlink);
IBindCtx_Release(pbc);
_bctx = NULL;