Bug 1432690 - Test that SimpleTest.registerCleanupFunction works in browser-chrome tests
MozReview-Commit-ID: LsoLM4y2u6L
--- a/testing/mochitest/tests/browser/browser.ini
+++ b/testing/mochitest/tests/browser/browser.ini
@@ -31,15 +31,16 @@ support-files =
[browser_parameters.js]
[browser_popupNode.js]
[browser_popupNode_check.js]
[browser_privileges.js]
[browser_requestLongerTimeout.js]
skip-if = true # Disabled beacuse it takes too long (bug 1178959)
[browser_sanityException.js]
[browser_sanityException2.js]
+[browser_SimpleTest_registerCleanupFunction.js]
[browser_tasks_skip.js]
[browser_tasks_skipall.js]
[browser_uncaught_rejection_expected.js]
[browser_waitForFocus.js]
skip-if = (os == "win" && e10s && debug)
[browser_zz_fail_openwindow.js]
skip-if = true # this catches outside of the main loop to find an extra window
new file mode 100644
--- /dev/null
+++ b/testing/mochitest/tests/browser/browser_SimpleTest_registerCleanupFunction.js
@@ -0,0 +1,14 @@
+let cleanedUpViaSimpleTest = false;
+
+add_task(async function test_SimpleTest_registerCleanupFunction() {
+ // Test that SimpleTest.registerCleanupFunction works, not just registerCleanupFunction.
+ SimpleTest.registerCleanupFunction(() => {
+ ok(true, "SimpleTest.registerCleanupFunction callback called");
+ cleanedUpViaSimpleTest = true;
+ });
+
+ registerCleanupFunction(() => {
+ ok(true, "Bare registerCleanupFunction callback called");
+ ok(cleanedUpViaSimpleTest, "SimpleTest.registerCleanupFunction should have already run");
+ });
+});