Bug 1453396 - Tests splitted into two to fix intermittent test timed out. r=ckerschb

--HG--
rename : dom/base/test/test_bug704320.html => dom/base/test/test_bug704320-1.html
rename : dom/base/test/test_bug704320.html => dom/base/test/test_bug704320-2.html
This commit is contained in:
Vinothkumar Nagasayanan 2018-05-25 16:20:32 +03:00
Родитель 644583163d
Коммит 26243dc0d3
3 изменённых файлов: 98 добавлений и 13 удалений

Просмотреть файл

@ -521,7 +521,8 @@ skip-if = toolkit == 'android' #bug 687032
[test_bug698381.html]
[test_bug698384.html]
[test_bug704063.html]
[test_bug704320.html]
[test_bug704320-1.html]
[test_bug704320-2.html]
[test_bug704320_policyset.html]
[test_bug704320_policyset2.html]
[test_bug704320_preload.html]

Просмотреть файл

@ -0,0 +1,90 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=704320
This Test is split into two for Bug 1453396
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 704320-Part1</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="referrerHelper.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
//generates URLs to test
var generateURLArray = (function(from, to){
const baseURL = '://example.com/tests/dom/base/test/bug704320.sjs?action=create-1st-level-iframe&scheme-from=';
const schemeTo = '&scheme-to=';
return [
from + baseURL + from + schemeTo + to + '&policy=no-referrer-when-downgrade',
from + baseURL + from + schemeTo + to + '&policy=no-referrer',
from + baseURL + from + schemeTo + to + '&policy=unsafe-url',
from + baseURL + from + schemeTo + to + '&policy=origin',
from + baseURL + from + schemeTo + to + '&policy=origin-when-cross-origin',
from + baseURL + from + schemeTo + to + '&policy=same-origin',
from + baseURL + from + schemeTo + to + '&policy=strict-origin',
from + baseURL + from + schemeTo + to + '&policy=strict-origin-when-cross-origin',
];
});
let testIframeUrls = [generateURLArray('http', 'http'),
generateURLArray('https', 'https')];
SimpleTest.waitForExplicitFinish();
let advance = function(testName) {
testsGenerator[testName].next();
};
let testNames = ['testframeone', 'testframetwo'];
let isTestFinished = 0;
function checkTestsCompleted() {
isTestFinished++;
if (isTestFinished == 2) {
SimpleTest.finish();
}
}
let testsGenerator = {};
SimpleTest.requestLongerTimeout(4);
/**
* This is the main test routine -- serialized by use of a generator.
* It performs all tests in sequence using four iframes.
*/
function startTests(testName, testIframeUrls) {
testsGenerator[testName] = (function*() {
var testframe = document.getElementById(testName);
testframe.onload = function() {
advance(testName);
}
// load the test frame from testIframeUrls[url]
// it will call back into this function via postMessage when it finishes
// loading and continue beyond the yield.
for(url in testIframeUrls) {
yield testframe.src = testIframeUrls[url];
// run test and check result for loaded test URL
yield checkExpectedGlobalResults(testName);
}
checkTestsCompleted();
})();
}
for (i = 0; i < testIframeUrls.length; i++) {
startTests(testNames[i], testIframeUrls[i]);
}
</script>
</head>
<body onload="testsGenerator[testNames[0]].next();
testsGenerator[testNames[1]].next();">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=704320">Mozilla Bug 704320 - HTTP/HTTPS to HTTPS/HTTP</a>
<p id="display"></p>
<pre id="content">
</pre>
<iframe id="testframeone"></iframe>
<iframe id="testframetwo"></iframe>
</body>

Просмотреть файл

@ -2,10 +2,11 @@
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=704320
This Test is split into two for Bug 1453396
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 704320</title>
<title>Test for Bug 704320-Part2</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="referrerHelper.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
@ -29,9 +30,7 @@ var generateURLArray = (function(from, to){
];
});
let testIframeUrls = [generateURLArray('http', 'http'),
generateURLArray('https', 'https'),
generateURLArray('http', 'https'),
let testIframeUrls = [generateURLArray('http', 'https'),
generateURLArray('https', 'http')];
SimpleTest.waitForExplicitFinish();
@ -39,13 +38,12 @@ let advance = function(testName) {
testsGenerator[testName].next();
};
let testNames = ['testframeone', 'testframetwo', 'testframethree',
'testframefour'];
let testNames = ['testframeone', 'testframetwo'];
let isTestFinished = 0;
function checkTestsCompleted() {
isTestFinished++;
if (isTestFinished == 4) {
if (isTestFinished == 2) {
SimpleTest.finish();
}
}
@ -82,15 +80,11 @@ for (i = 0; i < testIframeUrls.length; i++) {
</head>
<body onload="testsGenerator[testNames[0]].next();
testsGenerator[testNames[1]].next();
testsGenerator[testNames[2]].next();
testsGenerator[testNames[3]].next();">
testsGenerator[testNames[1]].next();">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=704320">Mozilla Bug 704320 - HTTP/HTTPS to HTTPS/HTTP</a>
<p id="display"></p>
<pre id="content">
</pre>
<iframe id="testframeone"></iframe>
<iframe id="testframetwo"></iframe>
<iframe id="testframethree"></iframe>
<iframe id="testframefour"></iframe>
</body>