Commit 66067781 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IPersistStreamInit::Load test.

parent 920f628c
...@@ -120,10 +120,11 @@ DEFINE_EXPECT(Protocol_Read); ...@@ -120,10 +120,11 @@ DEFINE_EXPECT(Protocol_Read);
DEFINE_EXPECT(LockRequest); DEFINE_EXPECT(LockRequest);
DEFINE_EXPECT(UnlockRequest); DEFINE_EXPECT(UnlockRequest);
static IUnknown *doc_unk;
static BOOL expect_LockContainer_fLock; static BOOL expect_LockContainer_fLock;
static BOOL expect_SetActiveObject_active; static BOOL expect_SetActiveObject_active;
static BOOL set_clientsite = FALSE, container_locked = FALSE; static BOOL set_clientsite = FALSE, container_locked = FALSE;
static BOOL readystate_set_loading = FALSE; static BOOL readystate_set_loading = FALSE, load_from_stream;
static BOOL editmode = FALSE; static BOOL editmode = FALSE;
static int stream_read, protocol_read; static int stream_read, protocol_read;
static enum load_state_t { static enum load_state_t {
...@@ -2054,8 +2055,6 @@ static void test_readyState(IUnknown *unk) ...@@ -2054,8 +2055,6 @@ static void test_readyState(IUnknown *unk)
BSTR state; BSTR state;
HRESULT hres; HRESULT hres;
static IUnknown *_unk;
static const WCHAR wszUninitialized[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0}; static const WCHAR wszUninitialized[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
static const WCHAR wszLoading[] = {'l','o','a','d','i','n','g',0}; static const WCHAR wszLoading[] = {'l','o','a','d','i','n','g',0};
static const WCHAR wszInteractive[] = {'i','n','t','e','r','a','c','t','i','v','e',0}; static const WCHAR wszInteractive[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
...@@ -2069,8 +2068,8 @@ static void test_readyState(IUnknown *unk) ...@@ -2069,8 +2068,8 @@ static void test_readyState(IUnknown *unk)
wszUninitialized wszUninitialized
}; };
if(!unk) unk = _unk; if(!unk)
else _unk = unk; unk = doc_unk;
hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&htmldoc); hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&htmldoc);
ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres); ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres);
...@@ -2239,7 +2238,8 @@ static void test_download(BOOL verb_done, BOOL css_dwl) ...@@ -2239,7 +2238,8 @@ static void test_download(BOOL verb_done, BOOL css_dwl)
if(verb_done) { if(verb_done) {
SET_EXPECT(Exec_SETPROGRESSMAX); SET_EXPECT(Exec_SETPROGRESSMAX);
SET_EXPECT(GetHostInfo); if(!load_from_stream)
SET_EXPECT(GetHostInfo);
} }
SET_EXPECT(SetStatusText); SET_EXPECT(SetStatusText);
SET_EXPECT(Exec_SETDOWNLOADSTATE_1); SET_EXPECT(Exec_SETDOWNLOADSTATE_1);
...@@ -2268,7 +2268,8 @@ static void test_download(BOOL verb_done, BOOL css_dwl) ...@@ -2268,7 +2268,8 @@ static void test_download(BOOL verb_done, BOOL css_dwl)
if(verb_done) { if(verb_done) {
CHECK_CALLED(Exec_SETPROGRESSMAX); CHECK_CALLED(Exec_SETPROGRESSMAX);
CHECK_CALLED(GetHostInfo); if(!load_from_stream)
CHECK_CALLED(GetHostInfo);
} }
CHECK_CALLED(SetStatusText); CHECK_CALLED(SetStatusText);
CHECK_CALLED(Exec_SETDOWNLOADSTATE_1); CHECK_CALLED(Exec_SETDOWNLOADSTATE_1);
...@@ -2408,10 +2409,8 @@ static void test_QueryStatus(IUnknown *unk, REFIID cgid, ULONG cmdid, DWORD cmdf ...@@ -2408,10 +2409,8 @@ static void test_QueryStatus(IUnknown *unk, REFIID cgid, ULONG cmdid, DWORD cmdf
static void test_MSHTML_QueryStatus(IUnknown *unk, DWORD cmdf) static void test_MSHTML_QueryStatus(IUnknown *unk, DWORD cmdf)
{ {
static IUnknown *_unk; if(!unk)
unk = doc_unk;
if(unk) _unk = unk;
else unk = _unk;
test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTNAME, cmdf); test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTNAME, cmdf);
test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTSIZE, cmdf); test_QueryStatus(unk, &CGID_MSHTML, IDM_FONTSIZE, cmdf);
...@@ -2987,6 +2986,35 @@ static void test_Navigate(IUnknown *unk) ...@@ -2987,6 +2986,35 @@ static void test_Navigate(IUnknown *unk)
IHlinkTarget_Release(hlink); IHlinkTarget_Release(hlink);
} }
static void test_StreamLoad(IUnknown *unk)
{
IPersistStreamInit *init;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IPersistStreamInit, (void**)&init);
ok(hres == S_OK, "QueryInterface(IID_IPersistStreamInit) failed: %08x\n", hres);
if(FAILED(hres))
return;
SET_EXPECT(Invoke_AMBIENT_SILENT);
SET_EXPECT(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
SET_EXPECT(Exec_ShellDocView_37);
SET_EXPECT(OnChanged_READYSTATE);
SET_EXPECT(Read);
readystate_set_loading = TRUE;
hres = IPersistStreamInit_Load(init, &Stream);
ok(hres == S_OK, "Load failed: %08x\n", hres);
CHECK_CALLED(Invoke_AMBIENT_SILENT);
CHECK_CALLED(Invoke_AMBIENT_OFFLINEIFNOTCONNECTED);
CHECK_CALLED(Exec_ShellDocView_37);
CHECK_CALLED(OnChanged_READYSTATE);
CHECK_CALLED(Read);
IPersistStreamInit_Release(init);
}
static void test_QueryInterface(IUnknown *unk) static void test_QueryInterface(IUnknown *unk)
{ {
IRunnableObject *runnable = (IRunnableObject*)0xdeadbeef; IRunnableObject *runnable = (IRunnableObject*)0xdeadbeef;
...@@ -2998,8 +3026,10 @@ static void test_QueryInterface(IUnknown *unk) ...@@ -2998,8 +3026,10 @@ static void test_QueryInterface(IUnknown *unk)
} }
static void init_test(enum load_state_t ls) { static void init_test(enum load_state_t ls) {
doc_unk = NULL;
hwnd = last_hwnd = NULL; hwnd = last_hwnd = NULL;
set_clientsite = FALSE; set_clientsite = FALSE;
load_from_stream = FALSE;
call_UIActivate = FALSE; call_UIActivate = FALSE;
load_state = ls; load_state = ls;
editmode = FALSE; editmode = FALSE;
...@@ -3020,6 +3050,7 @@ static void test_HTMLDocument(enum load_state_t ls) ...@@ -3020,6 +3050,7 @@ static void test_HTMLDocument(enum load_state_t ls)
hres = create_document(&unk); hres = create_document(&unk);
if(FAILED(hres)) if(FAILED(hres))
return; return;
doc_unk = unk;
test_QueryInterface(unk); test_QueryInterface(unk);
test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED); test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
...@@ -3100,6 +3131,7 @@ static void test_HTMLDocument_hlink(void) ...@@ -3100,6 +3131,7 @@ static void test_HTMLDocument_hlink(void)
hres = create_document(&unk); hres = create_document(&unk);
if(FAILED(hres)) if(FAILED(hres))
return; return;
doc_unk = unk;
test_ConnectionPointContainer(unk); test_ConnectionPointContainer(unk);
test_Persist(unk); test_Persist(unk);
...@@ -3121,6 +3153,52 @@ static void test_HTMLDocument_hlink(void) ...@@ -3121,6 +3153,52 @@ static void test_HTMLDocument_hlink(void)
ok(ref == 0, "ref=%d, expected 0\n", ref); ok(ref == 0, "ref=%d, expected 0\n", ref);
} }
static void test_HTMLDocument_StreamLoad(void)
{
IOleObject *oleobj;
IUnknown *unk;
HRESULT hres;
ULONG ref;
trace("Testing HTMLDocument (IPersistStreamInit)...\n");
init_test(LD_DOLOAD);
load_from_stream = TRUE;
hres = create_document(&unk);
if(FAILED(hres))
return;
doc_unk = unk;
hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
test_readyState(unk);
test_ConnectionPointContainer(unk);
test_ClientSite(oleobj, CLIENTSITE_EXPECTPATH);
test_DoVerb(oleobj);
test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
IOleObject_Release(oleobj);
test_StreamLoad(unk);
test_download(TRUE, FALSE);
test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED);
test_UIDeactivate();
test_InPlaceDeactivate(unk, TRUE);
test_Close(unk, FALSE);
if(view) {
IOleDocumentView_Release(view);
view = NULL;
}
ref = IUnknown_Release(unk);
ok(ref == 0, "ref=%d, expected 0\n", ref);
}
static void test_editing_mode(void) static void test_editing_mode(void)
{ {
IUnknown *unk; IUnknown *unk;
...@@ -3135,6 +3213,7 @@ static void test_editing_mode(void) ...@@ -3135,6 +3213,7 @@ static void test_editing_mode(void)
hres = create_document(&unk); hres = create_document(&unk);
if(FAILED(hres)) if(FAILED(hres))
return; return;
doc_unk = unk;
hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj); hres = IUnknown_QueryInterface(unk, &IID_IOleObject, (void**)&oleobj);
ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres); ok(hres == S_OK, "Could not get IOleObject: %08x\n", hres);
...@@ -3223,6 +3302,7 @@ START_TEST(htmldoc) ...@@ -3223,6 +3302,7 @@ START_TEST(htmldoc)
test_HTMLDocument(LD_NO); test_HTMLDocument(LD_NO);
test_HTMLDocument(LD_DOLOAD); test_HTMLDocument(LD_DOLOAD);
test_HTMLDocument_hlink(); test_HTMLDocument_hlink();
test_HTMLDocument_StreamLoad();
test_editing_mode(); test_editing_mode();
DestroyWindow(container_hwnd); DestroyWindow(container_hwnd);
......
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