Test flakiness fix for form submission cancelable

Since test return will be aync, introduced function to test query string return value.

This test fixes isuse introduced by fix for bug196640

R=keishi1, tkent
BUG=353066
TEST=Automated

Review URL: https://codereview.chromium.org/200613004

git-svn-id: svn://svn.chromium.org/blink/trunk@169436 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 8e8e925a
......@@ -3,8 +3,7 @@ Test that form submit within onsubmit event handlers are not delayed and sends t
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS event.target.contentWindow.location.search is "?query=AAA"
PASS event.target.contentWindow.location.search is "?query1=BBB"
PASS Both query events received, with correct values: AAA and BBB
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -17,6 +17,16 @@
<script>
description('Test that form submit within onsubmit event handlers are not delayed and sends the form data when invoked');
var count = 2;
function asyncTest(query) {
if (query === '?query=AAA' || query === '?query1=BBB') {
if (--count == 0) {
testPassed('Both query events received, with correct values: AAA and BBB');
finishJSTest();
}
}
}
document.forms[0].onsubmit = function (event) {
document.forms[0].submit();
document.forms[0].children.query.value = 'BBB';
......@@ -30,20 +40,18 @@ document.forms[1].onsubmit = function (event) {
}
document.getElementById('target').onload = function(event) {
shouldBeEqualToString('event.target.contentWindow.location.search', '?query=AAA');
if (--count == 0)
finishJSTest();
// This should return back query AAA
asyncTest(event.target.contentWindow.location.search);
}
document.getElementById('target1').onload = function(event) {
shouldBeEqualToString('event.target.contentWindow.location.search', '?query1=BBB');
if (--count == 0)
finishJSTest();
// This should return back query BBB
asyncTest(event.target.contentWindow.location.search);
}
window.onload = function() {
document.getElementById('submitButton1').click();
document.getElementById('submitButton').click();
document.getElementById('submitButton1').click();
}
if (window.testRunner)
......
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