mshtml: Added script execution time tests.

This commit is contained in:
Jacek Caban 2011-01-31 00:32:04 +01:00 committed by Alexandre Julliard
parent aef44d698e
commit bfebbbb13e
3 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,32 @@
<html>
<body>
Script execution test
<div id="b1"></div>
<div id="b2"></div>
<div id="b3"></div>
<script>
function ok(b, msg) {
return external.ok(b, msg);
}
var executed = false;
var len = document.getElementsByTagName('div').length;
ok(len === 3, "init length = " + len);
document.write("<script>"
+ "var len = document.getElementsByTagName('div').length;"
+ "external.todo_wine_ok(len === 3, 'unexpected length ' + len);"
+ "executed = true;"
+ "<" + "/script>");
len = document.getElementsByTagName('script').length;
external.todo_wine_ok(len === 2, "script col length = " + len);
external.todo_wine_ok(executed, "writen script not executed");
external.reportSuccess();
</script>
<div id="a1"></div>
<div id="a2"></div>
<div id="b3"></div>
</body>
</html>

View File

@ -16,5 +16,8 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* @makedep: exectest.html */
exectest.html HTML "exectest.html"
/* @makedep: jstest.html */
jstest.html HTML "jstest.html"

View File

@ -139,6 +139,7 @@ DEFINE_EXPECT(external_success);
#define DISPID_EXTERNAL_OK 0x300000
#define DISPID_EXTERNAL_TRACE 0x300001
#define DISPID_EXTERNAL_REPORTSUCCESS 0x300002
#define DISPID_EXTERNAL_TODO_WINE_OK 0x300003
static const GUID CLSID_TestScript =
{0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x07,0x46}};
@ -493,6 +494,10 @@ static HRESULT WINAPI externalDisp_GetDispID(IDispatchEx *iface, BSTR bstrName,
*pid = DISPID_EXTERNAL_REPORTSUCCESS;
return S_OK;
}
if(!strcmp_wa(bstrName, "todo_wine_ok")) {
*pid = DISPID_EXTERNAL_TODO_WINE_OK;
return S_OK;
}
ok(0, "unexpected name %s\n", wine_dbgstr_w(bstrName));
return DISP_E_UNKNOWNNAME;
@ -546,6 +551,22 @@ static HRESULT WINAPI externalDisp_InvokeEx(IDispatchEx *iface, DISPID id, LCID
return S_OK;
case DISPID_EXTERNAL_TODO_WINE_OK:
ok(wFlags == INVOKE_FUNC || wFlags == (INVOKE_FUNC|INVOKE_PROPERTYGET), "wFlags = %x\n", wFlags);
ok(pdp != NULL, "pdp == NULL\n");
ok(pdp->rgvarg != NULL, "rgvarg == NULL\n");
ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n");
ok(pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs);
ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs);
ok(pei != NULL, "pei == NULL\n");
ok(V_VT(pdp->rgvarg) == VT_BSTR, "V_VT(psp->rgvargs) = %d\n", V_VT(pdp->rgvarg));
ok(V_VT(pdp->rgvarg+1) == VT_BOOL, "V_VT(psp->rgvargs+1) = %d\n", V_VT(pdp->rgvarg));
todo_wine
ok(V_BOOL(pdp->rgvarg+1), "%s\n", wine_dbgstr_w(V_BSTR(pdp->rgvarg)));
return S_OK;
default:
ok(0, "unexpected call\n");
return E_NOTIMPL;
@ -2561,6 +2582,7 @@ static void run_js_script(const char *test_name)
static void run_js_tests(void)
{
run_js_script("jstest.html");
run_js_script("exectest.html");
}
static BOOL init_registry(BOOL init)