Bug 1432690 - Test that SimpleTest.registerCleanupFunction works in browser-chrome tests draft
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Tue, 23 Jan 2018 18:14:34 -0800
changeset 723896 25614f0b6466a252082b7ff9a643fe66c993518a
parent 723895 ec58b9d6c407272f23ba96c25654542e23eed51e
child 746990 a2208662bdab08cb28182dd9be9fedd1f106ae18
push id96573
push usermozilla@noorenberghe.ca
push dateWed, 24 Jan 2018 02:14:57 +0000
bugs1432690
milestone59.0a1
Bug 1432690 - Test that SimpleTest.registerCleanupFunction works in browser-chrome tests MozReview-Commit-ID: LsoLM4y2u6L
testing/mochitest/tests/browser/browser.ini
testing/mochitest/tests/browser/browser_SimpleTest_registerCleanupFunction.js
--- 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");
+  });
+});