Commit 5665730a authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Added IWindowForBindingUI tests.

parent 0847563d
...@@ -94,7 +94,7 @@ DEFINE_GUID(SID_SContainerDispatch,0xb722be00,0x4e68,0x101b,0xa2,0xbc,0x00,0xaa, ...@@ -94,7 +94,7 @@ DEFINE_GUID(SID_SContainerDispatch,0xb722be00,0x4e68,0x101b,0xa2,0xbc,0x00,0xaa,
static IOleDocumentView *view = NULL; static IOleDocumentView *view = NULL;
static HWND container_hwnd = NULL, hwnd = NULL, last_hwnd = NULL; static HWND container_hwnd = NULL, doc_hwnd = NULL, last_hwnd = NULL;
DEFINE_EXPECT(LockContainer); DEFINE_EXPECT(LockContainer);
DEFINE_EXPECT(SetActiveObject); DEFINE_EXPECT(SetActiveObject);
...@@ -346,7 +346,7 @@ static void test_timer(DWORD flags) ...@@ -346,7 +346,7 @@ static void test_timer(DWORD flags)
if(flags & EXPECT_SETTITLE) if(flags & EXPECT_SETTITLE)
SET_EXPECT(Exec_SETTITLE); SET_EXPECT(Exec_SETTITLE);
while(!*b && GetMessage(&msg, hwnd, 0, 0)) { while(!*b && GetMessage(&msg, doc_hwnd, 0, 0)) {
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
...@@ -1295,6 +1295,45 @@ static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoni ...@@ -1295,6 +1295,45 @@ static HRESULT WINAPI Moniker_BindToObject(IMoniker *iface, IBindCtx *pcb, IMoni
return E_NOTIMPL; return E_NOTIMPL;
} }
static void test_binding_ui(IUnknown *unk)
{
IWindowForBindingUI *binding_ui;
IServiceProvider *serv_prov;
HWND binding_hwnd;
HRESULT hres;
hres = IUnknown_QueryInterface(unk, &IID_IServiceProvider, (void**)&serv_prov);
ok(hres == S_OK, "Could not get IServiceProvider: %08x\n", hres);
hres = IServiceProvider_QueryService(serv_prov, &IID_IWindowForBindingUI, &IID_IWindowForBindingUI,
(void**)&binding_ui);
ok(hres == S_OK, "Could not get IWindowForBindingUI: %08x\n", hres);
hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IHttpSecurity, &binding_hwnd);
ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
if(doc_hwnd)
ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
else
todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IAuthenticate, &binding_hwnd);
ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
if(doc_hwnd)
ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
else
todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
hres = IWindowForBindingUI_GetWindow(binding_ui, &IID_IWindowForBindingUI, &binding_hwnd);
ok(hres == S_OK, "GetWindow(IID_IHttpSecurity) failed: %08x\n", hres);
if(doc_hwnd)
ok(binding_hwnd == doc_hwnd, "binding_hwnd != doc_hwnd\n");
else
todo_wine ok(binding_hwnd != NULL, "binding_hwnd == NULL\n");
IWindowForBindingUI_Release(binding_ui);
IServiceProvider_Release(serv_prov);
}
static void continue_binding(IBindStatusCallback *callback) static void continue_binding(IBindStatusCallback *callback)
{ {
FORMATETC formatetc = {0xc02d, NULL, 1, -1, TYMED_ISTREAM}; FORMATETC formatetc = {0xc02d, NULL, 1, -1, TYMED_ISTREAM};
...@@ -1303,6 +1342,8 @@ static void continue_binding(IBindStatusCallback *callback) ...@@ -1303,6 +1342,8 @@ static void continue_binding(IBindStatusCallback *callback)
static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0}; static const WCHAR wszTextHtml[] = {'t','e','x','t','/','h','t','m','l',0};
test_binding_ui((IUnknown*)callback);
if(report_mime) { if(report_mime) {
hres = IBindStatusCallback_OnProgress(callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE, hres = IBindStatusCallback_OnProgress(callback, 0, 0, BINDSTATUS_MIMETYPEAVAILABLE,
wszTextHtml); wszTextHtml);
...@@ -2162,6 +2203,7 @@ static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocum ...@@ -2162,6 +2203,7 @@ static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocum
ok(hres == S_OK, "Could not get IOleInPlaceActiveObject: %08x\n", hres); ok(hres == S_OK, "Could not get IOleInPlaceActiveObject: %08x\n", hres);
if(activeobj) { if(activeobj) {
HWND hwnd = (void*)0xdeadbeef;
hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd); hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd);
ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres); ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
ok(hwnd == NULL, "hwnd=%p, expected NULL\n", hwnd); ok(hwnd == NULL, "hwnd=%p, expected NULL\n", hwnd);
...@@ -2201,11 +2243,11 @@ static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocum ...@@ -2201,11 +2243,11 @@ static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocum
CHECK_CALLED(ShowUI); CHECK_CALLED(ShowUI);
if(activeobj) { if(activeobj) {
hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd); hres = IOleInPlaceActiveObject_GetWindow(activeobj, &doc_hwnd);
ok(hres == S_OK, "GetWindow failed: %08x\n", hres); ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
ok(hwnd != NULL, "hwnd == NULL\n"); ok(doc_hwnd != NULL, "hwnd == NULL\n");
if(last_hwnd) if(last_hwnd)
ok(hwnd == last_hwnd, "hwnd != last_hwnd\n"); ok(doc_hwnd == last_hwnd, "hwnd != last_hwnd\n");
} }
hres = IOleDocumentView_UIActivate(view, TRUE); hres = IOleDocumentView_UIActivate(view, TRUE);
...@@ -2214,7 +2256,7 @@ static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocum ...@@ -2214,7 +2256,7 @@ static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocum
if(activeobj) { if(activeobj) {
hres = IOleInPlaceActiveObject_GetWindow(activeobj, &tmp_hwnd); hres = IOleInPlaceActiveObject_GetWindow(activeobj, &tmp_hwnd);
ok(hres == S_OK, "GetWindow failed: %08x\n", hres); ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd); ok(tmp_hwnd == doc_hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, doc_hwnd);
} }
} }
...@@ -2253,11 +2295,11 @@ static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocum ...@@ -2253,11 +2295,11 @@ static HRESULT WINAPI DocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocum
CHECK_CALLED(Exec_SETPROGRESSPOS); CHECK_CALLED(Exec_SETPROGRESSPOS);
if(activeobj) { if(activeobj) {
hres = IOleInPlaceActiveObject_GetWindow(activeobj, &hwnd); hres = IOleInPlaceActiveObject_GetWindow(activeobj, &doc_hwnd);
ok(hres == S_OK, "GetWindow failed: %08x\n", hres); ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
ok(hwnd != NULL, "hwnd == NULL\n"); ok(doc_hwnd != NULL, "doc_hwnd == NULL\n");
if(last_hwnd) if(last_hwnd)
ok(hwnd == last_hwnd, "hwnd != last_hwnd\n"); ok(doc_hwnd == last_hwnd, "doc_hwnd != last_hwnd\n");
} }
} }
...@@ -6154,7 +6196,7 @@ static void test_Activate(IHTMLDocument2 *doc, DWORD flags) ...@@ -6154,7 +6196,7 @@ static void test_Activate(IHTMLDocument2 *doc, DWORD flags)
GUID guid; GUID guid;
HRESULT hres; HRESULT hres;
last_hwnd = hwnd; last_hwnd = doc_hwnd;
if(view) if(view)
IOleDocumentView_Release(view); IOleDocumentView_Release(view);
...@@ -6219,10 +6261,10 @@ static void test_Window(IHTMLDocument2 *doc, BOOL expect_success) ...@@ -6219,10 +6261,10 @@ static void test_Window(IHTMLDocument2 *doc, BOOL expect_success)
if(expect_success) { if(expect_success) {
ok(hres == S_OK, "GetWindow failed: %08x\n", hres); ok(hres == S_OK, "GetWindow failed: %08x\n", hres);
ok(tmp_hwnd == hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, hwnd); ok(tmp_hwnd == doc_hwnd, "tmp_hwnd=%p, expected %p\n", tmp_hwnd, doc_hwnd);
}else { }else {
ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres); ok(hres == E_FAIL, "GetWindow returned %08x, expected E_FAIL\n", hres);
ok(IsWindow(hwnd), "hwnd is destroyed\n"); ok(IsWindow(doc_hwnd), "hwnd is destroyed\n");
} }
IOleInPlaceActiveObject_Release(activeobject); IOleInPlaceActiveObject_Release(activeobject);
...@@ -6574,7 +6616,7 @@ static void test_QueryInterface(IHTMLDocument2 *doc) ...@@ -6574,7 +6616,7 @@ static void test_QueryInterface(IHTMLDocument2 *doc)
static void init_test(enum load_state_t ls) { static void init_test(enum load_state_t ls) {
doc_unk = NULL; doc_unk = NULL;
hwnd = last_hwnd = NULL; doc_hwnd = last_hwnd = NULL;
set_clientsite = FALSE; set_clientsite = FALSE;
load_from_stream = FALSE; load_from_stream = FALSE;
call_UIActivate = CallUIActivate_None; call_UIActivate = CallUIActivate_None;
...@@ -6686,9 +6728,9 @@ static void test_HTMLDocument(BOOL do_load, BOOL mime) ...@@ -6686,9 +6728,9 @@ static void test_HTMLDocument(BOOL do_load, BOOL mime)
IOleDocumentView_Release(view); IOleDocumentView_Release(view);
view = NULL; view = NULL;
ok(IsWindow(hwnd), "hwnd is destroyed\n"); ok(IsWindow(doc_hwnd), "hwnd is destroyed\n");
release_document(doc); release_document(doc);
ok(!IsWindow(hwnd), "hwnd is not destroyed\n"); ok(!IsWindow(doc_hwnd), "hwnd is not destroyed\n");
} }
static void test_HTMLDocument_hlink(DWORD status) static void test_HTMLDocument_hlink(DWORD status)
...@@ -6820,6 +6862,7 @@ static void test_HTMLDocument_http(BOOL with_wbapp) ...@@ -6820,6 +6862,7 @@ static void test_HTMLDocument_http(BOOL with_wbapp)
test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED); test_MSHTML_QueryStatus(doc, OLECMDF_SUPPORTED);
test_GetCurMoniker((IUnknown*)doc, http_mon, NULL); test_GetCurMoniker((IUnknown*)doc, http_mon, NULL);
test_travellog(doc); test_travellog(doc);
test_binding_ui((IUnknown*)doc);
nav_url = nav_serv_url = "http://www.winehq.org/"; /* for valid prev nav_url */ nav_url = nav_serv_url = "http://www.winehq.org/"; /* for valid prev nav_url */
if(support_wbapp) { if(support_wbapp) {
......
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