mshtml/tests: Use winetest.js helpers in asyncscriptload.js.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-03-25 19:28:04 +01:00 committed by Alexandre Julliard
parent d1d1e3f56f
commit da30fa0357
1 changed files with 7 additions and 12 deletions

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
var tests = [];
var head = document.getElementsByTagName("head")[0];
/* Dynamically created script element is downloaded as soon as src property is set,
@ -24,7 +25,7 @@ var detached_elem_executed = false;
var detached_elem = document.createElement("script");
detached_elem.src = "jsstream.php?detached_script";
function test_detached_script_elem() {
async_test("detached_script_elem", function() {
var oncomplete_called = false;
detached_elem.onreadystatechange = guard(function() {
if(detached_elem.readyState == "complete") {
@ -44,7 +45,7 @@ function test_detached_script_elem() {
});
external.writeStream("detached_script", 'detached_elem_executed = true;');
}
});
/* Dynamically created script elements are evaluated as soon as they are loaded, no matter
* how they are ordered in the tree. */
@ -58,7 +59,7 @@ var attached_elem2 = document.createElement("script");
attached_elem2.src = "jsstream.php?attached_script2";
head.appendChild(attached_elem2);
function test_attached_script_elem() {
async_test("attached_script_elem", function() {
attached_elem1.onreadystatechange = guard(function() {
ok(attached_elem1.readyState == "loaded", "attached_elem1.readyState = " + attached_elem2.readyState);
ok(attached_elem1_executed, "attached element 1 not executed before readyState complete");
@ -73,9 +74,9 @@ function test_attached_script_elem() {
});
external.writeStream("attached_script2", 'attached_elem2_executed = true;');
}
});
function test_dynamic_element() {
async_test("append_script", function() {
var elem = document.createElement("script");
var ready_states = "";
@ -88,10 +89,4 @@ function test_dynamic_element() {
document.body.appendChild(elem);
elem.src = "jsstream.php?simple";
external.writeStream("simple", " ");
}
var tests = [
test_detached_script_elem,
test_attached_script_elem,
test_dynamic_element
];
});