Commit 00f74afe authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Rewrite navigation tests using new HTTP emulation framework.

parent 2ad4e9f4
/*
* Copyright 2016 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
function nav_parent_test() {
external.trace("Running _parent navigation tests...");
var iframe = document.getElementById("testframe");
var subframe = iframe.contentWindow.document.createElement("iframe");
subframe.onload = function() {
var doc = subframe.contentWindow.document;
doc.body.innerHTML = '<a href="http://winetest.org/blank2.html" id="aid" target="_parent">test</a>';
doc.getElementById("aid").click();
}
iframe.onload = function() {
iframe.onload = null;
var href = iframe.contentWindow.location.href;
ok(/.*blank2.html/.test(href), "Unexpected href " + href);
next_test();
}
iframe.contentWindow.document.body.appendChild(subframe);
subframe.src = "blank.html";
}
function window_navigate_test() {
external.trace("Running window.navigate() tests...");
var iframe = document.getElementById("testframe");
iframe.onload = function() {
iframe.onload = null;
var href = iframe.contentWindow.location.href;
ok(href === "about:blank", "Unexpected href " + href);
next_test();
}
iframe.contentWindow.navigate("about:blank");
}
function window_open_self_test() {
external.trace("Running window.open(_self) tests...");
var iframe = document.getElementById("testframe");
var iframe_window = iframe.contentWindow;
iframe.onload = function() {
iframe.onload = null;
var href = iframe.contentWindow.location.href;
ok(/.*blank.html\?window_open_self/.test(href), "Unexpected href " + href);
ok(iframe.contentWindow === iframe_window, "iframe.contentWindow !== iframe_window");
next_test();
}
iframe_window.open("blank.html?window_open_self", "_self");
}
function detached_src_test() {
var iframe = document.createElement("iframe");
var onload_called = false;
iframe.onload = function() {
onload_called = true;
next_test();
}
iframe.src = "blank.html";
document.body.appendChild(iframe);
ok(onload_called === false, "called onload too early?");
}
function init_test_iframe() {
var iframe = document.createElement("iframe");
iframe.onload = next_test;
iframe.id = "testframe";
iframe.src = "about:blank";
document.body.appendChild(iframe);
}
var tests = [
init_test_iframe,
nav_parent_test,
window_navigate_test,
window_open_self_test,
detached_src_test
];
......@@ -34,8 +34,8 @@ events.html HTML "events.html"
/* @makedep: externscr.js */
externscr.js HTML "externscr.js"
/* @makedep: nav_test.html */
nav_test.html HTML "nav_test.html"
/* @makedep: navigation.js */
navigation.js HTML "navigation.js"
/* @makedep: xhr.js */
xhr.js HTML "xhr.js"
......
......@@ -3315,11 +3315,11 @@ static void run_js_tests(void)
return;
}
run_js_script("nav_test.html");
init_protocol_handler();
run_script_as_http_with_mode("xhr.js", NULL, "11");
run_script_as_http_with_mode("navigation.js", NULL, NULL);
run_script_as_http_with_mode("navigation.js", NULL, "11");
}
static BOOL init_registry(BOOL init)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment