Bug 1305993 - Break tests up to avoid timeouts r=philor

MozReview-Commit-ID: 8y2gwNjnEnT

--HG--
extra : rebase_source : c24354dd7c60064b38bbbad067806d3c0a52c690
This commit is contained in:
Kate McKinley 2016-10-07 17:19:38 +09:00
parent 4ae59da9d4
commit 5b82359aa3
9 changed files with 178 additions and 24 deletions

View File

@ -1,9 +1,16 @@
[DEFAULT]
support-files =
head.js
file_priming-top.html
file_testserver.sjs
file_1x1.png
file_priming.js
file_stylesheet.css
[browser_hsts-priming_main.js]
[browser_hsts-priming_allow_active.js]
[browser_hsts-priming_block_active.js]
[browser_hsts-priming_hsts_after_mixed.js]
[browser_hsts-priming_allow_display.js]
[browser_hsts-priming_block_display.js]
[browser_hsts-priming_block_active_css.js]
[browser_hsts-priming_block_active_with_redir_same.js]

View File

@ -0,0 +1,24 @@
/*
* Description of the test:
* Check that HSTS priming occurs correctly with mixed content when active
* content is allowed.
*/
'use strict';
//jscs:disable
add_task(function*() {
//jscs:enable
Services.obs.addObserver(Observer, "console-api-log-event", false);
Services.obs.addObserver(Observer, "http-on-examine-response", false);
registerCleanupFunction(do_cleanup);
let which = "allow_active";
SetupPrefTestEnvironment(which);
for (let server of Object.keys(test_servers)) {
yield execute_test(server, test_settings[which].mimetype);
}
SpecialPowers.popPrefEnv();
});

View File

@ -0,0 +1,24 @@
/*
* Description of the test:
* Check that HSTS priming occurs correctly with mixed content when display
* content is allowed.
*/
'use strict';
//jscs:disable
add_task(function*() {
//jscs:enable
Services.obs.addObserver(Observer, "console-api-log-event", false);
Services.obs.addObserver(Observer, "http-on-examine-response", false);
registerCleanupFunction(do_cleanup);
let which = "allow_display";
SetupPrefTestEnvironment(which);
for (let server of Object.keys(test_servers)) {
yield execute_test(server, test_settings[which].mimetype);
}
SpecialPowers.popPrefEnv();
});

View File

@ -0,0 +1,24 @@
/*
* Description of the test:
* Check that HSTS priming occurs correctly with mixed content when active
* content is blocked.
*/
'use strict';
//jscs:disable
add_task(function*() {
//jscs:enable
Services.obs.addObserver(Observer, "console-api-log-event", false);
Services.obs.addObserver(Observer, "http-on-examine-response", false);
registerCleanupFunction(do_cleanup);
let which = "block_active";
SetupPrefTestEnvironment(which);
for (let server of Object.keys(test_servers)) {
yield execute_test(server, test_settings[which].mimetype);
}
SpecialPowers.popPrefEnv();
});

View File

@ -0,0 +1,24 @@
/*
* Description of the test:
* Check that HSTS priming occurs correctly with mixed content when active
* content is blocked for css.
*/
'use strict';
//jscs:disable
add_task(function*() {
//jscs:enable
Services.obs.addObserver(Observer, "console-api-log-event", false);
Services.obs.addObserver(Observer, "http-on-examine-response", false);
registerCleanupFunction(do_cleanup);
let which = "block_active_css";
SetupPrefTestEnvironment(which);
for (let server of Object.keys(test_servers)) {
yield execute_test(server, test_settings[which].mimetype);
}
SpecialPowers.popPrefEnv();
});

View File

@ -0,0 +1,24 @@
/*
* Description of the test:
* Check that HSTS priming occurs correctly with mixed content when active
* content is blocked and redirect to the same host should still upgrade.
*/
'use strict';
//jscs:disable
add_task(function*() {
//jscs:enable
Services.obs.addObserver(Observer, "console-api-log-event", false);
Services.obs.addObserver(Observer, "http-on-examine-response", false);
registerCleanupFunction(do_cleanup);
let which = "block_active_with_redir_same";
SetupPrefTestEnvironment(which);
for (let server of Object.keys(test_servers)) {
yield execute_test(server, test_settings[which].mimetype);
}
SpecialPowers.popPrefEnv();
});

View File

@ -0,0 +1,24 @@
/*
* Description of the test:
* Check that HSTS priming occurs correctly with mixed content when display
* content is blocked.
*/
'use strict';
//jscs:disable
add_task(function*() {
//jscs:enable
Services.obs.addObserver(Observer, "console-api-log-event", false);
Services.obs.addObserver(Observer, "http-on-examine-response", false);
registerCleanupFunction(do_cleanup);
let which = "block_display";
SetupPrefTestEnvironment(which);
for (let server of Object.keys(test_servers)) {
yield execute_test(server, test_settings[which].mimetype);
}
SpecialPowers.popPrefEnv();
});

View File

@ -0,0 +1,24 @@
/*
* Description of the test:
* Check that HSTS priming occurs correctly with mixed content when the
* mixed-content blocks before HSTS.
*/
'use strict';
//jscs:disable
add_task(function*() {
//jscs:enable
Services.obs.addObserver(Observer, "console-api-log-event", false);
Services.obs.addObserver(Observer, "http-on-examine-response", false);
registerCleanupFunction(do_cleanup);
let which = "hsts_after_mixed";
SetupPrefTestEnvironment(which);
for (let server of Object.keys(test_servers)) {
yield execute_test(server, test_settings[which].mimetype);
}
SpecialPowers.popPrefEnv();
});

View File

@ -1,5 +1,5 @@
/*
* Description of the test:
* Description of the tests:
* Check that HSTS priming occurs correctly with mixed content
*
* This test uses three hostnames, each of which treats an HSTS priming
@ -12,7 +12,7 @@
* or block active or display content, as well as when we send an hsts priming
* request, but do not change the order of mixed-content and HSTS.
*
* This test uses http-on-examine-response, so must be run in browser context.
* Test use http-on-examine-response, so must be run in browser context.
*/
'use strict';
@ -38,8 +38,6 @@ var test_servers = {
id: 'prime-hsts'
},
};
// The number of priming responses we expect to see
var priming_count = 2;
var test_settings = {
// mixed active content is allowed, priming will upgrade
@ -275,22 +273,3 @@ function execute_test(test, mimetype) {
yield BrowserTestUtils.removeTab(tab);
}
//jscs:disable
add_task(function*() {
//jscs:enable
Services.obs.addObserver(Observer, "console-api-log-event", false);
Services.obs.addObserver(Observer, "http-on-examine-response", false);
registerCleanupFunction(do_cleanup);
requestLongerTimeout(4);
for (let which of Object.keys(test_settings)) {
SetupPrefTestEnvironment(which);
for (let server of Object.keys(test_servers)) {
yield execute_test(server, test_settings[which].mimetype);
}
SpecialPowers.popPrefEnv();
}
});