From 041d7d229631029845431dcbf1003f8a2373abd5 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 22 Jul 2011 15:00:18 +0200 Subject: [PATCH] mshtml: Make execScript tests more generic. --- dlls/mshtml/tests/script.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c index 092d4a7a66e..93183d009a1 100644 --- a/dlls/mshtml/tests/script.c +++ b/dlls/mshtml/tests/script.c @@ -181,6 +181,9 @@ static BSTR a2bstr(const char *str) BSTR ret; int len; + if(!str) + return NULL; + len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); ret = SysAllocStringLen(NULL, len); MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); @@ -2454,7 +2457,7 @@ static const char simple_script_str[] = "" ""; -static void test_exec_script(IHTMLDocument2 *doc) +static void test_exec_script(IHTMLDocument2 *doc, const char *codea, const char *langa) { IHTMLWindow2 *window; BSTR code, lang; @@ -2464,8 +2467,8 @@ static void test_exec_script(IHTMLDocument2 *doc) hres = IHTMLDocument2_get_parentWindow(doc, &window); ok(hres == S_OK, "get_parentWindow failed: %08x\n", hres); - code = a2bstr("execScript call"); - lang = a2bstr("TestScript"); + code = a2bstr(codea); + lang = a2bstr(langa); SET_EXPECT(ParseScriptText_execScript); hres = IHTMLWindow2_execScript(window, code, lang, &v); @@ -2524,7 +2527,7 @@ static void test_simple_script(void) CHECK_CALLED(ParseScriptText_script); CHECK_CALLED(SetScriptState_CONNECTED); - test_exec_script(doc); + test_exec_script(doc, "execScript call", "TestScript"); if(site) IActiveScriptSite_Release(site);