mshtml: Make execScript tests more generic.

This commit is contained in:
Jacek Caban 2011-07-22 15:00:18 +02:00 committed by Alexandre Julliard
parent e722268d53
commit 041d7d2296
1 changed files with 7 additions and 4 deletions

View File

@ -181,6 +181,9 @@ static BSTR a2bstr(const char *str)
BSTR ret; BSTR ret;
int len; int len;
if(!str)
return NULL;
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
ret = SysAllocStringLen(NULL, len); ret = SysAllocStringLen(NULL, len);
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
@ -2454,7 +2457,7 @@ static const char simple_script_str[] =
"<script language=\"TestScript\">simple script</script>" "<script language=\"TestScript\">simple script</script>"
"</body></html>"; "</body></html>";
static void test_exec_script(IHTMLDocument2 *doc) static void test_exec_script(IHTMLDocument2 *doc, const char *codea, const char *langa)
{ {
IHTMLWindow2 *window; IHTMLWindow2 *window;
BSTR code, lang; BSTR code, lang;
@ -2464,8 +2467,8 @@ static void test_exec_script(IHTMLDocument2 *doc)
hres = IHTMLDocument2_get_parentWindow(doc, &window); hres = IHTMLDocument2_get_parentWindow(doc, &window);
ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres); ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres);
code = a2bstr("execScript call"); code = a2bstr(codea);
lang = a2bstr("TestScript"); lang = a2bstr(langa);
SET_EXPECT(ParseScriptText_execScript); SET_EXPECT(ParseScriptText_execScript);
hres = IHTMLWindow2_execScript(window, code, lang, &v); hres = IHTMLWindow2_execScript(window, code, lang, &v);
@ -2524,7 +2527,7 @@ static void test_simple_script(void)
CHECK_CALLED(ParseScriptText_script); CHECK_CALLED(ParseScriptText_script);
CHECK_CALLED(SetScriptState_CONNECTED); CHECK_CALLED(SetScriptState_CONNECTED);
test_exec_script(doc); test_exec_script(doc, "execScript call", "TestScript");
if(site) if(site)
IActiveScriptSite_Release(site); IActiveScriptSite_Release(site);