Commit 3b20cb11 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Store document as IHTMLDocument2 interface.

parent de3fa09c
......@@ -188,7 +188,7 @@ static const WCHAR doc_url[] = {'w','i','n','e','t','e','s','t',':','d','o','c',
static const WCHAR about_blank_url[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
static HRESULT QueryInterface(REFIID riid, void **ppv);
static void test_MSHTML_QueryStatus(IUnknown*,DWORD);
static void test_MSHTML_QueryStatus(IHTMLDocument2*,DWORD);
#define test_readyState(u) _test_readyState(__LINE__,u)
static void _test_readyState(unsigned,IUnknown*);
......@@ -2943,12 +2943,12 @@ static void test_ConnectionPoint(IConnectionPointContainer *container, REFIID ri
IConnectionPoint_Release(cp);
}
static void test_ConnectionPointContainer(IUnknown *unk)
static void test_ConnectionPointContainer(IHTMLDocument2 *doc)
{
IConnectionPointContainer *container;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IConnectionPointContainer, (void**)&container);
hres = IUnknown_QueryInterface(doc, &IID_IConnectionPointContainer, (void**)&container);
ok(hres == S_OK, "QueryInterface(IID_IConnectionPointContainer) failed: %08x\n", hres);
if(FAILED(hres))
return;
......@@ -3170,14 +3170,14 @@ static void test_download(DWORD flags)
test_readyState(NULL);
}
static void test_Persist(IUnknown *unk, IMoniker *mon)
static void test_Persist(IHTMLDocument2 *doc, IMoniker *mon)
{
IPersistMoniker *persist_mon;
IPersistFile *persist_file;
GUID guid;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IPersistFile, (void**)&persist_file);
hres = IUnknown_QueryInterface(doc, &IID_IPersistFile, (void**)&persist_file);
ok(hres == S_OK, "QueryInterface(IID_IPersist) failed: %08x\n", hres);
if(SUCCEEDED(hres)) {
hres = IPersist_GetClassID(persist_file, NULL);
......@@ -3190,7 +3190,7 @@ static void test_Persist(IUnknown *unk, IMoniker *mon)
IPersist_Release(persist_file);
}
hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&persist_mon);
hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&persist_mon);
ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres);
if(SUCCEEDED(hres)) {
hres = IPersistMoniker_GetClassID(persist_mon, NULL);
......@@ -3203,25 +3203,20 @@ static void test_Persist(IUnknown *unk, IMoniker *mon)
if(load_state == LD_DOLOAD)
test_Load(persist_mon, mon);
test_readyState(unk);
test_readyState((IUnknown*)doc);
IPersistMoniker_Release(persist_mon);
}
}
static void test_put_href(IUnknown *unk)
static void test_put_href(IHTMLDocument2 *doc)
{
IHTMLLocation *location;
IHTMLDocument2 *doc;
BSTR str;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
ok(hres == S_OK, "Could not get IHTMLDocument2 iface: %08x\n", hres);
location = NULL;
hres = IHTMLDocument2_get_location(doc, &location);
IHTMLDocument2_Release(doc);
ok(hres == S_OK, "get_location failed: %08x\n", hres);
ok(location != NULL, "location == NULL\n");
......@@ -3300,10 +3295,9 @@ static void _test_QueryStatus(unsigned line, IUnknown *unk, REFIID cgid, ULONG c
ok_(__FILE__,line) (olecmd.cmdf == cmdf, "(%u) cmdf=%08x, expected %08x\n", cmdid, olecmd.cmdf, cmdf);
}
static void test_MSHTML_QueryStatus(IUnknown *unk, DWORD cmdf)
static void test_MSHTML_QueryStatus(IHTMLDocument2 *doc, DWORD cmdf)
{
if(!unk)
unk = doc_unk;
IUnknown *unk = doc ? (IUnknown*)doc : doc_unk;
test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTNAME, cmdf);
test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTSIZE, cmdf);
......@@ -3323,14 +3317,14 @@ static void test_MSHTML_QueryStatus(IUnknown *unk, DWORD cmdf)
test_QueryStatus(unk, &CGID_MSHTML, IDM_DELETE, cmdf);
}
static void test_OleCommandTarget(IUnknown *unk)
static void test_OleCommandTarget(IHTMLDocument2 *doc)
{
IOleCommandTarget *cmdtrg;
OLECMD cmds[OLECMDID_GETPRINTTEMPLATE];
int i;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget failed: %08x\n", hres);
if(FAILED(hres))
return;
......@@ -3361,7 +3355,7 @@ static void test_OleCommandTarget(IUnknown *unk)
IOleCommandTarget_Release(cmdtrg);
}
static void test_OleCommandTarget_fail(IUnknown *unk)
static void test_OleCommandTarget_fail(IHTMLDocument2 *doc)
{
IOleCommandTarget *cmdtrg;
int i;
......@@ -3372,7 +3366,7 @@ static void test_OleCommandTarget_fail(IUnknown *unk)
{OLECMDID_GETPRINTTEMPLATE+1, 0xf0f0}
};
hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
ok(hres == S_OK, "QueryInterface(IIDIOleCommandTarget failed: %08x\n", hres);
if(FAILED(hres))
return;
......@@ -3413,13 +3407,13 @@ static void test_OleCommandTarget_fail(IUnknown *unk)
IOleCommandTarget_Release(cmdtrg);
}
static void test_exec_onunload(IUnknown *unk)
static void test_exec_onunload(IHTMLDocument2 *doc)
{
IOleCommandTarget *cmdtrg;
VARIANT var;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IOleCommandTarget, (void**)&cmdtrg);
hres = IUnknown_QueryInterface(doc, &IID_IOleCommandTarget, (void**)&cmdtrg);
ok(hres == S_OK, "QueryInterface(IID_IOleCommandTarget) failed: %08x\n", hres);
if(FAILED(hres))
return;
......@@ -3568,14 +3562,14 @@ static void test_exec_noargs(IUnknown *unk, DWORD cmdid)
IOleCommandTarget_Release(cmdtrg);
}
static void test_IsDirty(IUnknown *unk, HRESULT exhres)
static void test_IsDirty(IHTMLDocument2 *doc, HRESULT exhres)
{
IPersistStreamInit *perinit;
IPersistMoniker *permon;
IPersistFile *perfile;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IPersistStreamInit, (void**)&perinit);
hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&perinit);
ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit failed: %08x\n", hres);
if(SUCCEEDED(hres)) {
hres = IPersistStreamInit_IsDirty(perinit);
......@@ -3583,7 +3577,7 @@ static void test_IsDirty(IUnknown *unk, HRESULT exhres)
IPersistStreamInit_Release(perinit);
}
hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon);
hres = IUnknown_QueryInterface(doc, &IID_IPersistMoniker, (void**)&permon);
ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker failed: %08x\n", hres);
if(SUCCEEDED(hres)) {
hres = IPersistMoniker_IsDirty(permon);
......@@ -3591,7 +3585,7 @@ static void test_IsDirty(IUnknown *unk, HRESULT exhres)
IPersistMoniker_Release(permon);
}
hres = IUnknown_QueryInterface(unk, &IID_IPersistFile, (void**)&perfile);
hres = IUnknown_QueryInterface(doc, &IID_IPersistFile, (void**)&perfile);
ok(hres == S_OK, "QueryInterface(IID_IPersistFile failed: %08x\n", hres);
if(SUCCEEDED(hres)) {
hres = IPersistFile_IsDirty(perfile);
......@@ -3716,12 +3710,12 @@ static void test_ClientSite(IOleObject *oleobj, DWORD flags)
ok(clientsite == &ClientSite, "GetClientSite() = %p, expected %p\n", clientsite, &ClientSite);
}
static void test_OnAmbientPropertyChange(IUnknown *unk)
static void test_OnAmbientPropertyChange(IHTMLDocument2 *doc)
{
IOleControl *control = NULL;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IOleControl, (void**)&control);
hres = IUnknown_QueryInterface(doc, &IID_IOleControl, (void**)&control);
ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
if(FAILED(hres))
return;
......@@ -3765,12 +3759,12 @@ static void test_OnAmbientPropertyChange(IUnknown *unk)
static void test_OnAmbientPropertyChange2(IUnknown *unk)
static void test_OnAmbientPropertyChange2(IHTMLDocument2 *doc)
{
IOleControl *control = NULL;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IOleControl, (void**)&control);
hres = IUnknown_QueryInterface(doc, &IID_IOleControl, (void**)&control);
ok(hres == S_OK, "QueryInterface(IID_IOleControl failed: %08x\n", hres);
if(FAILED(hres))
return;
......@@ -3781,12 +3775,12 @@ static void test_OnAmbientPropertyChange2(IUnknown *unk)
IOleControl_Release(control);
}
static void test_Close(IUnknown *unk, BOOL set_client)
static void test_Close(IHTMLDocument2 *doc, BOOL set_client)
{
IOleObject *oleobj = NULL;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
if(FAILED(hres))
return;
......@@ -3806,14 +3800,14 @@ static void test_Close(IUnknown *unk, BOOL set_client)
IOleObject_Release(oleobj);
}
static void test_Advise(IUnknown *unk)
static void test_Advise(IHTMLDocument2 *doc)
{
IOleObject *oleobj = NULL;
IEnumSTATDATA *enum_advise = (void*)0xdeadbeef;
DWORD conn;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
if(FAILED(hres))
return;
......@@ -3898,12 +3892,12 @@ static void test_OnFrameWindowActivate(IUnknown *unk)
IOleInPlaceActiveObject_Release(inplaceact);
}
static void test_InPlaceDeactivate(IUnknown *unk, BOOL expect_call)
static void test_InPlaceDeactivate(IHTMLDocument2 *doc, BOOL expect_call)
{
IOleInPlaceObjectWindowless *windowlessobj = NULL;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IOleInPlaceObjectWindowless,
hres = IUnknown_QueryInterface(doc, &IID_IOleInPlaceObjectWindowless,
(void**)&windowlessobj);
ok(hres == S_OK, "QueryInterface(IID_IOleInPlaceObjectWindowless) failed: %08x\n", hres);
if(FAILED(hres))
......@@ -3929,7 +3923,7 @@ static void test_InPlaceDeactivate(IUnknown *unk, BOOL expect_call)
IOleInPlaceObjectWindowless_Release(windowlessobj);
}
static void test_Activate(IUnknown *unk, DWORD flags)
static void test_Activate(IHTMLDocument2 *doc, DWORD flags)
{
IOleObject *oleobj = NULL;
IOleDocumentView *docview;
......@@ -3942,7 +3936,7 @@ static void test_Activate(IUnknown *unk, DWORD flags)
IOleDocumentView_Release(view);
view = NULL;
hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
hres = IOleObject_GetUserClassID(oleobj, NULL);
......@@ -3952,10 +3946,10 @@ static void test_Activate(IUnknown *unk, DWORD flags)
ok(hres == S_OK, "GetUserClassID failed: %08x\n", hres);
ok(IsEqualGUID(&guid, &CLSID_HTMLDocument), "guid != CLSID_HTMLDocument\n");
test_OnFrameWindowActivate(unk);
test_OnFrameWindowActivate((IUnknown*)doc);
test_ClientSite(oleobj, flags);
test_InPlaceDeactivate(unk, FALSE);
test_InPlaceDeactivate(doc, FALSE);
test_DoVerb(oleobj);
if(call_UIActivate == CallUIActivate_AfterShow) {
......@@ -3983,10 +3977,10 @@ static void test_Activate(IUnknown *unk, DWORD flags)
IOleObject_Release(oleobj);
test_OnFrameWindowActivate(unk);
test_OnFrameWindowActivate((IUnknown*)doc);
}
static void test_Window(IUnknown *unk, BOOL expect_success)
static void test_Window(IHTMLDocument2 *doc, BOOL expect_success)
{
IOleInPlaceActiveObject *activeobject = NULL;
HWND tmp_hwnd;
......@@ -4069,34 +4063,34 @@ static void test_Hide(void)
ok(hres == S_OK, "Show failed: %08x\n", hres);
}
static HRESULT create_document(IUnknown **unk)
static HRESULT create_document(IHTMLDocument2 **doc)
{
IHTMLDocument5 *doc5;
HRESULT hres;
hres = CoCreateInstance(&CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_IUnknown, (void**)unk);
&IID_IHTMLDocument2, (void**)doc);
ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres);
if(FAILED(hres))
return hres;
hres = IUnknown_QueryInterface(*unk, &IID_IHTMLDocument5, (void**)&doc5);
hres = IHTMLDocument2_QueryInterface(*doc, &IID_IHTMLDocument5, (void**)&doc5);
if(SUCCEEDED(hres)) {
IHTMLDocument5_Release(doc5);
}else {
win_skip("Could not get IHTMLDocument5, probably too old IE\n");
IUnknown_Release(*unk);
IHTMLDocument2_Release(*doc);
}
return hres;
}
static void test_Navigate(IUnknown *unk)
static void test_Navigate(IHTMLDocument2 *doc)
{
IHlinkTarget *hlink;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IHlinkTarget, (void**)&hlink);
hres = IUnknown_QueryInterface(doc, &IID_IHlinkTarget, (void**)&hlink);
ok(hres == S_OK, "QueryInterface(IID_IHlinkTarget) failed: %08x\n", hres);
SET_EXPECT(ActivateMe);
......@@ -4107,18 +4101,13 @@ static void test_Navigate(IUnknown *unk)
IHlinkTarget_Release(hlink);
}
static void test_external(IUnknown *unk, BOOL initialized)
static void test_external(IHTMLDocument2 *doc, BOOL initialized)
{
IDispatch *external;
IHTMLDocument2 *doc;
IHTMLWindow2 *htmlwin;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
ok(hres == S_OK, "QueryInterface(IID_IHTMLWindow2) failed: %08x\n", hres);
hres = IHTMLDocument2_get_parentWindow(doc, &htmlwin);
IHTMLDocument2_Release(doc);
ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
if(initialized)
......@@ -4137,12 +4126,12 @@ static void test_external(IUnknown *unk, BOOL initialized)
IHTMLWindow2_Release(htmlwin);
}
static void test_StreamLoad(IUnknown *unk)
static void test_StreamLoad(IHTMLDocument2 *doc)
{
IPersistStreamInit *init;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IPersistStreamInit, (void**)&init);
hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
if(FAILED(hres))
return;
......@@ -4164,17 +4153,17 @@ static void test_StreamLoad(IUnknown *unk)
CHECK_CALLED(Read);
test_timer(EXPECT_SETTITLE);
test_GetCurMoniker(unk, NULL, about_blank_url);
test_GetCurMoniker((IUnknown*)doc, NULL, about_blank_url);
IPersistStreamInit_Release(init);
}
static void test_StreamInitNew(IUnknown *unk)
static void test_StreamInitNew(IHTMLDocument2 *doc)
{
IPersistStreamInit *init;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IPersistStreamInit, (void**)&init);
hres = IUnknown_QueryInterface(doc, &IID_IPersistStreamInit, (void**)&init);
ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
if(FAILED(hres))
return;
......@@ -4194,12 +4183,12 @@ static void test_StreamInitNew(IUnknown *unk)
CHECK_CALLED(OnChanged_READYSTATE);
test_timer(EXPECT_SETTITLE);
test_GetCurMoniker(unk, NULL, about_blank_url);
test_GetCurMoniker((IUnknown*)doc, NULL, about_blank_url);
IPersistStreamInit_Release(init);
}
static void test_QueryInterface(IUnknown *unk)
static void test_QueryInterface(IHTMLDocument2 *doc)
{
IUnknown *qi;
HRESULT hres;
......@@ -4208,32 +4197,32 @@ static void test_QueryInterface(IUnknown *unk)
{0x719c3050,0xf9d3,0x11cf,{0xa4,0x93,0x00,0x40,0x05,0x23,0xa8,0xa0}};
qi = (void*)0xdeadbeef;
hres = IUnknown_QueryInterface(unk, &IID_IRunnableObject, (void**)&qi);
hres = IUnknown_QueryInterface(doc, &IID_IRunnableObject, (void**)&qi);
ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
ok(qi == NULL, "qirunnable=%p, expected NULL\n", qi);
qi = (void*)0xdeadbeef;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode, (void**)&qi);
hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode, (void**)&qi);
ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
ok(qi == NULL, "qi=%p, expected NULL\n", qi);
qi = (void*)0xdeadbeef;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLDOMNode2, (void**)&qi);
hres = IUnknown_QueryInterface(doc, &IID_IHTMLDOMNode2, (void**)&qi);
ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
ok(qi == NULL, "qi=%p, expected NULL\n", qi);
qi = (void*)0xdeadbeef;
hres = IUnknown_QueryInterface(unk, &IID_IPersistPropertyBag, (void**)&qi);
hres = IUnknown_QueryInterface(doc, &IID_IPersistPropertyBag, (void**)&qi);
ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
ok(qi == NULL, "qi=%p, expected NULL\n", qi);
qi = (void*)0xdeadbeef;
hres = IUnknown_QueryInterface(unk, &IID_UndocumentedScriptIface, (void**)&qi);
hres = IUnknown_QueryInterface(doc, &IID_UndocumentedScriptIface, (void**)&qi);
ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
ok(qi == NULL, "qi=%p, expected NULL\n", qi);
qi = (void*)0xdeadbeef;
hres = IUnknown_QueryInterface(unk, &IID_IMarshal, (void**)&qi);
hres = IUnknown_QueryInterface(doc, &IID_IMarshal, (void**)&qi);
ok(hres == E_NOINTERFACE, "QueryInterface returned %08x, expected E_NOINTERFACE\n", hres);
ok(qi == NULL, "qi=%p, expected NULL\n", qi);
}
......@@ -4254,7 +4243,7 @@ static void init_test(enum load_state_t ls) {
static void test_HTMLDocument(BOOL do_load)
{
IUnknown *unk;
IHTMLDocument2 *doc;
HRESULT hres;
ULONG ref;
......@@ -4262,80 +4251,80 @@ static void test_HTMLDocument(BOOL do_load)
init_test(do_load ? LD_DOLOAD : LD_NO);
hres = create_document(&unk);
hres = create_document(&doc);
if(FAILED(hres))
return;
doc_unk = unk;
test_QueryInterface(unk);
test_Advise(unk);
test_IsDirty(unk, S_FALSE);
test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
test_external(unk, FALSE);
test_ConnectionPointContainer(unk);
test_GetCurMoniker(unk, NULL, NULL);
test_Persist(unk, &Moniker);
doc_unk = (IUnknown*)doc;
test_QueryInterface(doc);
test_Advise(doc);
test_IsDirty(doc, S_FALSE);
test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
test_external(doc, FALSE);
test_ConnectionPointContainer(doc);
test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
test_Persist(doc, &Moniker);
if(!do_load)
test_OnAmbientPropertyChange2(unk);
test_OnAmbientPropertyChange2(doc);
test_Activate(unk, CLIENTSITE_EXPECTPATH);
test_Activate(doc, CLIENTSITE_EXPECTPATH);
if(do_load) {
test_download(DWL_CSS|DWL_TRYCSS);
test_GetCurMoniker(unk, &Moniker, NULL);
test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
}
test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
test_OleCommandTarget_fail(unk);
test_OleCommandTarget(unk);
test_OnAmbientPropertyChange(unk);
test_Window(unk, TRUE);
test_external(unk, TRUE);
test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
test_OleCommandTarget_fail(doc);
test_OleCommandTarget(doc);
test_OnAmbientPropertyChange(doc);
test_Window(doc, TRUE);
test_external(doc, TRUE);
test_UIDeactivate();
test_OleCommandTarget(unk);
test_Window(unk, TRUE);
test_InPlaceDeactivate(unk, TRUE);
test_OleCommandTarget(doc);
test_Window(doc, TRUE);
test_InPlaceDeactivate(doc, TRUE);
/* Calling test_OleCommandTarget here causes Segmentation Fault with native
* MSHTML. It doesn't with Wine. */
test_Window(unk, FALSE);
test_Window(doc, FALSE);
test_Hide();
test_InPlaceDeactivate(unk, FALSE);
test_InPlaceDeactivate(doc, FALSE);
test_CloseView();
test_Close(unk, FALSE);
test_Close(doc, FALSE);
/* Activate HTMLDocument again */
test_Activate(unk, CLIENTSITE_SETNULL);
test_Window(unk, TRUE);
test_OleCommandTarget(unk);
test_Activate(doc, CLIENTSITE_SETNULL);
test_Window(doc, TRUE);
test_OleCommandTarget(doc);
test_UIDeactivate();
test_InPlaceDeactivate(unk, TRUE);
test_Close(unk, FALSE);
test_InPlaceDeactivate(doc, TRUE);
test_Close(doc, FALSE);
/* Activate HTMLDocument again, this time without UIActivate */
call_UIActivate = CallUIActivate_None;
test_Activate(unk, CLIENTSITE_SETNULL);
test_Window(unk, TRUE);
test_Activate(doc, CLIENTSITE_SETNULL);
test_Window(doc, TRUE);
test_UIDeactivate();
test_InPlaceDeactivate(unk, TRUE);
test_InPlaceDeactivate(doc, TRUE);
test_CloseView();
test_CloseView();
test_Close(unk, TRUE);
test_OnAmbientPropertyChange2(unk);
test_GetCurMoniker(unk, do_load ? &Moniker : NULL, NULL);
test_Close(doc, TRUE);
test_OnAmbientPropertyChange2(doc);
test_GetCurMoniker((IUnknown*)doc, do_load ? &Moniker : NULL, NULL);
if(!do_load) {
/* Activate HTMLDocument again, calling UIActivate after showing the window */
call_UIActivate = CallUIActivate_AfterShow;
test_Activate(unk, 0);
test_Window(unk, TRUE);
test_OleCommandTarget(unk);
test_Activate(doc, 0);
test_Window(doc, TRUE);
test_OleCommandTarget(doc);
test_UIDeactivate();
test_InPlaceDeactivate(unk, TRUE);
test_Close(unk, FALSE);
test_InPlaceDeactivate(doc, TRUE);
test_Close(doc, FALSE);
call_UIActivate = CallUIActivate_None;
}
......@@ -4345,7 +4334,7 @@ static void test_HTMLDocument(BOOL do_load)
ok(IsWindow(hwnd), "hwnd is destroyed\n");
ref = IUnknown_Release(unk);
ref = IHTMLDocument2_Release(doc);
ok(ref == 0, "ref=%d, expected 0\n", ref);
ok(!IsWindow(hwnd), "hwnd is not destroyed\n");
......@@ -4353,7 +4342,7 @@ static void test_HTMLDocument(BOOL do_load)
static void test_HTMLDocument_hlink(void)
{
IUnknown *unk;
IHTMLDocument2 *doc;
HRESULT hres;
ULONG ref;
......@@ -4362,52 +4351,48 @@ static void test_HTMLDocument_hlink(void)
init_test(LD_DOLOAD);
ipsex = TRUE;
hres = create_document(&unk);
hres = create_document(&doc);
if(FAILED(hres))
return;
doc_unk = unk;
doc_unk = (IUnknown*)doc;
test_ConnectionPointContainer(unk);
test_GetCurMoniker(unk, NULL, NULL);
test_Persist(unk, &Moniker);
test_Navigate(unk);
test_ConnectionPointContainer(doc);
test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
test_Persist(doc, &Moniker);
test_Navigate(doc);
if(show_failed) {
IUnknown_Release(unk);
IUnknown_Release(doc);
return;
}
test_download(DWL_CSS|DWL_TRYCSS);
test_IsDirty(unk, S_FALSE);
test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
test_IsDirty(doc, S_FALSE);
test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
test_exec_onunload(unk);
test_Window(unk, TRUE);
test_InPlaceDeactivate(unk, TRUE);
test_Close(unk, FALSE);
test_IsDirty(unk, S_FALSE);
test_GetCurMoniker(unk, &Moniker, NULL);
test_exec_onunload(doc);
test_Window(doc, TRUE);
test_InPlaceDeactivate(doc, TRUE);
test_Close(doc, FALSE);
test_IsDirty(doc, S_FALSE);
test_GetCurMoniker((IUnknown*)doc, &Moniker, NULL);
if(view)
IOleDocumentView_Release(view);
view = NULL;
ref = IUnknown_Release(unk);
ref = IHTMLDocument2_Release(doc);
ok(ref == 0, "ref=%d, expected 0\n", ref);
}
static void test_cookies(IUnknown *unk)
static void test_cookies(IHTMLDocument2 *doc)
{
WCHAR buf[1024];
IHTMLDocument2 *doc;
DWORD size;
BSTR str, str2;
BOOL b;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc);
ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
hres = IHTMLDocument2_get_cookie(doc, &str);
ok(hres == S_OK, "get_cookie failed: %08x\n", hres);
if(str) {
......@@ -4449,14 +4434,12 @@ static void test_cookies(IUnknown *unk)
ok(strstrW(str2, str) != NULL, "could not find %s in %s\n", wine_dbgstr_w(str), wine_dbgstr_w(str2));
SysFreeString(str);
SysFreeString(str2);
IHTMLDocument2_Release(doc);
}
static void test_HTMLDocument_http(void)
{
IMoniker *http_mon;
IUnknown *unk;
IHTMLDocument2 *doc;
ULONG ref;
HRESULT hres;
......@@ -4468,17 +4451,17 @@ static void test_HTMLDocument_http(void)
init_test(LD_DOLOAD);
ipsex = TRUE;
hres = create_document(&unk);
hres = create_document(&doc);
if(FAILED(hres))
return;
doc_unk = unk;
doc_unk = (IUnknown*)doc;
test_ConnectionPointContainer(unk);
test_GetCurMoniker(unk, NULL, NULL);
test_Persist(unk, http_mon);
test_Navigate(unk);
test_ConnectionPointContainer(doc);
test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
test_Persist(doc, http_mon);
test_Navigate(doc);
if(show_failed) {
IUnknown_Release(unk);
IUnknown_Release(doc);
return;
}
......@@ -4487,35 +4470,35 @@ static void test_HTMLDocument_http(void)
else
win_skip("IE running in Enhanced Security Configuration\n");
test_cookies(unk);
test_IsDirty(unk, S_FALSE);
test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
test_cookies(doc);
test_IsDirty(doc, S_FALSE);
test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
test_put_href(unk);
test_put_href(doc);
test_InPlaceDeactivate(unk, TRUE);
test_Close(unk, FALSE);
test_IsDirty(unk, S_FALSE);
test_GetCurMoniker(unk, http_mon, NULL);
test_InPlaceDeactivate(doc, TRUE);
test_Close(doc, FALSE);
test_IsDirty(doc, S_FALSE);
test_GetCurMoniker((IUnknown*)doc, http_mon, NULL);
if(view)
IOleDocumentView_Release(view);
view = NULL;
ref = IUnknown_Release(unk);
ref = IHTMLDocument2_Release(doc);
ok(!ref, "ref=%d, expected 0\n", ref);
ref = IMoniker_Release(http_mon);
ok(!ref, "ref=%d, expected 0\n", ref);
}
static void test_QueryService(IUnknown *unk, BOOL success)
static void test_QueryService(IHTMLDocument2 *doc, BOOL success)
{
IServiceProvider *sp;
IHlinkFrame *hf;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IServiceProvider, (void**)&sp);
hres = IUnknown_QueryInterface(doc, &IID_IServiceProvider, (void**)&sp);
ok(hres == S_OK, "QueryService returned %08x\n", hres);
hres = IServiceProvider_QueryService(sp, &IID_IHlinkFrame, &IID_IHlinkFrame, (void**)&hf);
......@@ -4529,8 +4512,8 @@ static void test_QueryService(IUnknown *unk, BOOL success)
static void test_HTMLDocument_StreamLoad(void)
{
IHTMLDocument2 *doc;
IOleObject *oleobj;
IUnknown *unk;
DWORD conn;
HRESULT hres;
ULONG ref;
......@@ -4540,39 +4523,39 @@ static void test_HTMLDocument_StreamLoad(void)
init_test(LD_DOLOAD);
load_from_stream = TRUE;
hres = create_document(&unk);
hres = create_document(&doc);
if(FAILED(hres))
return;
doc_unk = unk;
doc_unk = (IUnknown*)doc;
hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
hres = IOleObject_Advise(oleobj, &AdviseSink, &conn);
ok(hres == S_OK, "Advise failed: %08x\n", hres);
test_readyState(unk);
test_IsDirty(unk, S_FALSE);
test_ConnectionPointContainer(unk);
test_QueryService(unk, FALSE);
test_readyState((IUnknown*)doc);
test_IsDirty(doc, S_FALSE);
test_ConnectionPointContainer(doc);
test_QueryService(doc, FALSE);
test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
test_QueryService(unk, TRUE);
test_QueryService(doc, TRUE);
test_DoVerb(oleobj);
test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
IOleObject_Release(oleobj);
test_GetCurMoniker(unk, NULL, NULL);
test_StreamLoad(unk);
test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
test_StreamLoad(doc);
test_download(DWL_VERBDONE|DWL_TRYCSS);
test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
test_UIDeactivate();
test_InPlaceDeactivate(unk, TRUE);
test_InPlaceDeactivate(doc, TRUE);
SET_EXPECT(Advise_Close);
test_Close(unk, FALSE);
test_Close(doc, FALSE);
CHECK_CALLED(Advise_Close);
test_IsDirty(unk, S_FALSE);
test_IsDirty(doc, S_FALSE);
if(view) {
IOleDocumentView_Release(view);
......@@ -4580,14 +4563,14 @@ static void test_HTMLDocument_StreamLoad(void)
}
ref = IUnknown_Release(unk);
ref = IHTMLDocument2_Release(doc);
ok(ref == 0, "ref=%d, expected 0\n", ref);
}
static void test_HTMLDocument_StreamInitNew(void)
{
IHTMLDocument2 *doc;
IOleObject *oleobj;
IUnknown *unk;
DWORD conn;
HRESULT hres;
ULONG ref;
......@@ -4597,37 +4580,37 @@ static void test_HTMLDocument_StreamInitNew(void)
init_test(LD_DOLOAD);
load_from_stream = TRUE;
hres = create_document(&unk);
hres = create_document(&doc);
if(FAILED(hres))
return;
doc_unk = unk;
doc_unk = (IUnknown*)doc;
hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
hres = IOleObject_Advise(oleobj, &AdviseSink, &conn);
ok(hres == S_OK, "Advise failed: %08x\n", hres);
test_readyState(unk);
test_IsDirty(unk, S_FALSE);
test_ConnectionPointContainer(unk);
test_readyState((IUnknown*)doc);
test_IsDirty(doc, S_FALSE);
test_ConnectionPointContainer(doc);
test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
test_DoVerb(oleobj);
test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
IOleObject_Release(oleobj);
test_GetCurMoniker(unk, NULL, NULL);
test_StreamInitNew(unk);
test_GetCurMoniker((IUnknown*)doc, NULL, NULL);
test_StreamInitNew(doc);
test_download(DWL_VERBDONE|DWL_TRYCSS|DWL_EMPTY);
test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
test_UIDeactivate();
test_InPlaceDeactivate(unk, TRUE);
test_InPlaceDeactivate(doc, TRUE);
SET_EXPECT(Advise_Close);
test_Close(unk, FALSE);
test_Close(doc, FALSE);
CHECK_CALLED(Advise_Close);
test_IsDirty(unk, S_FALSE);
test_IsDirty(doc, S_FALSE);
if(view) {
IOleDocumentView_Release(view);
......@@ -4635,7 +4618,7 @@ static void test_HTMLDocument_StreamInitNew(void)
}
ref = IUnknown_Release(unk);
ref = IHTMLDocument2_Release(doc);
ok(ref == 0, "ref=%d, expected 0\n", ref);
}
......@@ -4668,6 +4651,7 @@ static void test_edit_uiactivate(IOleObject *oleobj)
static void test_editing_mode(BOOL do_load)
{
IHTMLDocument2 *doc;
IUnknown *unk;
IOleObject *oleobj;
DWORD conn;
......@@ -4679,40 +4663,40 @@ static void test_editing_mode(BOOL do_load)
init_test(do_load ? LD_DOLOAD : LD_NO);
call_UIActivate = CallUIActivate_AfterShow;
hres = create_document(&unk);
hres = create_document(&doc);
if(FAILED(hres))
return;
doc_unk = unk;
unk = doc_unk = (IUnknown*)doc;
hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
hres = IOleObject_Advise(oleobj, &AdviseSink, &conn);
ok(hres == S_OK, "Advise failed: %08x\n", hres);
test_readyState(unk);
test_ConnectionPointContainer(unk);
test_readyState((IUnknown*)doc);
test_ConnectionPointContainer(doc);
test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
test_DoVerb(oleobj);
test_edit_uiactivate(oleobj);
test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
if(do_load)
test_Persist(unk, &Moniker);
test_Persist(doc, &Moniker);
stream_read = protocol_read = 0;
test_exec_editmode(unk, do_load);
test_UIDeactivate();
call_UIActivate = CallUIActivate_None;
IOleObject_Release(oleobj);
test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
test_download(DWL_VERBDONE | (do_load ? DWL_CSS|DWL_TRYCSS : 0));
SET_EXPECT(SetStatusText); /* ignore race in native mshtml */
test_timer(EXPECT_UPDATEUI);
SET_CALLED(SetStatusText);
test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED|OLECMDF_ENABLED);
test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED|OLECMDF_ENABLED);
if(!do_load) {
test_exec_fontname(unk, NULL, wszTimesNewRoman);
......@@ -4739,9 +4723,9 @@ static void test_editing_mode(BOOL do_load)
}
test_UIDeactivate();
test_InPlaceDeactivate(unk, TRUE);
test_InPlaceDeactivate(doc, TRUE);
SET_EXPECT(Advise_Close);
test_Close(unk, FALSE);
test_Close(doc, FALSE);
CHECK_CALLED(Advise_Close);
if(view) {
......@@ -4755,7 +4739,7 @@ static void test_editing_mode(BOOL do_load)
static void test_UIActivate(BOOL do_load, BOOL use_ipsex, BOOL use_ipsw)
{
IUnknown *unk;
IHTMLDocument2 *doc;
IOleObject *oleobj;
IOleInPlaceSite *inplacesite;
HRESULT hres;
......@@ -4765,18 +4749,18 @@ static void test_UIActivate(BOOL do_load, BOOL use_ipsex, BOOL use_ipsw)
init_test(do_load ? LD_DOLOAD : LD_NO);
hres = create_document(&unk);
hres = create_document(&doc);
if(FAILED(hres))
return;
doc_unk = unk;
doc_unk = (IUnknown*)doc;
ipsex = use_ipsex;
ipsw = use_ipsw;
hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
hres = IUnknown_QueryInterface(doc, &IID_IOleObject, (void**)&oleobj);
ok(hres == S_OK, "QueryInterface(IID_IOleObject) failed: %08x\n", hres);
hres = IUnknown_QueryInterface(unk, &IID_IOleDocumentView, (void**)&view);
hres = IUnknown_QueryInterface(doc, &IID_IOleDocumentView, (void**)&view);
ok(hres == S_OK, "QueryInterface(IID_IOleDocumentView) failed: %08x\n", hres);
SET_EXPECT(Invoke_AMBIENT_USERMODE);
......@@ -4893,13 +4877,13 @@ static void test_UIActivate(BOOL do_load, BOOL use_ipsex, BOOL use_ipsw)
else
CHECK_CALLED(OnInPlaceDeactivate);
test_Close(unk, TRUE);
test_Close(doc, TRUE);
IOleObject_Release(oleobj);
IOleDocumentView_Release(view);
view = NULL;
ref = IUnknown_Release(unk);
ref = IHTMLDocument2_Release(doc);
ok(ref == 0, "ref=%d, expected 0\n", ref);
}
......@@ -4922,16 +4906,16 @@ static void register_protocol(void)
static void test_HTMLDoc_ISupportErrorInfo(void)
{
IHTMLDocument2 *doc;
HRESULT hres;
IUnknown *unk;
ISupportErrorInfo *sinfo;
LONG ref;
hres = create_document(&unk);
hres = create_document(&doc);
if(FAILED(hres))
return;
hres = IUnknown_QueryInterface(unk, &IID_ISupportErrorInfo, (void**)&sinfo);
hres = IUnknown_QueryInterface(doc, &IID_ISupportErrorInfo, (void**)&sinfo);
ok(hres == S_OK, "got %x\n", hres);
ok(sinfo != NULL, "got %p\n", sinfo);
if(sinfo)
......@@ -4941,27 +4925,27 @@ static void test_HTMLDoc_ISupportErrorInfo(void)
IUnknown_Release(sinfo);
}
ref = IUnknown_Release(unk);
ref = IHTMLDocument2_Release(doc);
ok(ref == 0, "ref=%d, expected 0\n", ref);
}
static void test_IPersistHistory(void)
{
IHTMLDocument2 *doc;
HRESULT hres;
IUnknown *unk;
LONG ref;
IPersistHistory *phist;
hres = create_document(&unk);
hres = create_document(&doc);
if(FAILED(hres))
return;
hres = IUnknown_QueryInterface(unk, &IID_IPersistHistory, (void**)&phist);
hres = IUnknown_QueryInterface(doc, &IID_IPersistHistory, (void**)&phist);
ok(hres == S_OK, "QueryInterface returned %08x, expected S_OK\n", hres);
if(hres == S_OK)
IPersistHistory_Release(phist);
ref = IUnknown_Release(unk);
ref = IHTMLDocument2_Release(doc);
ok(ref == 0, "ref=%d, expected 0\n", ref);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment