ieframe: Added IHTMLWindow2 service tests.
[wine.git] / dlls / ieframe / tests / ie.c
blob00e802fd74b5a5f2c9060af17aedf37da7eeaf99
1 /*
2 * Copyright 2011 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define COBJMACROS
21 #include <wine/test.h>
22 #include <stdarg.h>
23 #include <stdio.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "ole2.h"
28 #include "exdisp.h"
29 #include "mshtml.h"
31 static void test_visible(IWebBrowser2 *wb)
33 VARIANT_BOOL b;
34 HRESULT hres;
36 b = 0x100;
37 hres = IWebBrowser2_get_Visible(wb, &b);
38 ok(hres == S_OK, "get_Visible failed: %08x\n", hres);
39 ok(b == VARIANT_FALSE, "Visible = %x\n", hres);
41 hres = IWebBrowser2_put_Visible(wb, VARIANT_TRUE);
42 ok(hres == S_OK, "put_Visible failed: %08x\n", hres);
44 b = 0x100;
45 hres = IWebBrowser2_get_Visible(wb, &b);
46 ok(hres == S_OK, "get_Visible failed: %08x\n", hres);
47 ok(b == VARIANT_TRUE, "Visible = %x\n", hres);
49 hres = IWebBrowser2_put_Visible(wb, VARIANT_FALSE);
50 ok(hres == S_OK, "put_Visible failed: %08x\n", hres);
53 static void test_html_window(IWebBrowser2 *wb)
55 IHTMLWindow2 *html_window;
56 IServiceProvider *sp;
57 HRESULT hres;
59 hres = IWebBrowser2_QueryInterface(wb, &IID_IServiceProvider, (void**)&sp);
60 ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres);
62 hres = IServiceProvider_QueryService(sp, &SID_SHTMLWindow, &IID_IHTMLWindow2, (void**)&html_window);
63 IServiceProvider_Release(sp);
64 ok(hres == S_OK, "Could not get SHTMLWindow service: %08x\n", hres);
66 IHTMLWindow2_Release(html_window);
69 static void test_InternetExplorer(void)
71 IWebBrowser2 *wb;
72 IUnknown *unk;
73 ULONG ref;
74 HRESULT hres;
76 hres = CoCreateInstance(&CLSID_InternetExplorer, NULL, CLSCTX_SERVER,
77 &IID_IUnknown, (void**)&unk);
78 ok(hres == S_OK, "Could not create InternetExplorer instance: %08x\n", hres);
80 if(hres != S_OK)
81 return;
83 hres = IUnknown_QueryInterface(unk, &IID_IWebBrowser2, (void**)&wb);
84 ok(hres == S_OK, "Could not get IWebBrowser2 interface: %08x\n", hres);
86 test_visible(wb);
87 test_html_window(wb);
89 IWebBrowser2_Release(wb);
90 ref = IUnknown_Release(unk);
91 ok(!ref, "object not destroyed, ref=%u\n", ref);
94 START_TEST(ie)
96 CoInitialize(NULL);
98 test_InternetExplorer();
100 CoUninitialize();