Closed
Bug 399732
Opened 17 years ago
Closed 15 years ago
Make --test-path=path/to/test_foo.html --close-when-done work
Categories
(Testing :: Mochitest, enhancement)
Testing
Mochitest
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 508664
People
(Reporter: Waldo, Assigned: Waldo)
Details
Attachments
(1 file)
3.44 KB,
patch
|
Details | Diff | Splinter Review |
You can use --test-path to open a single test, but you can't use --close-when-done to close the browser when it completes. If you only want to run a single test, this means you have to provide the containing folder and then click the individual test you want, which is a tad slower.
Comment 1•16 years ago
|
||
Mass move of the rest of the Mochitest bugs from Core:Testing to Testing:Mochitest. Filter on MochitestMassMove to ignore.
Component: Testing → Mochitest
Product: Core → Testing
QA Contact: testing → mochitest
Comment 2•15 years ago
|
||
This is not precisely a great patch, but it did work for me when I wanted to do this. I have no clue whether it breaks regular mochitests, though.
Assignee | ||
Comment 3•15 years ago
|
||
Comment on attachment 359852 [details] [diff] [review] "working" patch >diff --git a/testing/mochitest/tests/SimpleTest/SimpleTest.js b/testing/mochitest/tests/SimpleTest/SimpleTest.js > if (typeof(SimpleTest) == "undefined") { > var SimpleTest = {}; > } > >+ Doesn't quite seem necessary... >+/* >+ From mozilla/toolkit/content >+ These files did not have a license >+*/ >+ >+function quitHook() >+{ >+ var xhr = new XMLHttpRequest(); >+ xhr.open("GET", "http://" + location.host + "/server/shutdown", true); >+ xhr.onreadystatechange = function (event) >+ { >+ if (xhr.readyState == 4) >+ goQuitApplication(); >+ }; >+ xhr.send(null); >+} >+ >+function canQuitApplication() >+{ >+ var os = Components.classes["@mozilla.org/observer-service;1"] >+ .getService(Components.interfaces.nsIObserverService); >+ if (!os) >+ { >+ return true; >+ } >+ >+ try >+ { >+ var cancelQuit = Components.classes["@mozilla.org/supports-PRBool;1"] >+ .createInstance(Components.interfaces.nsISupportsPRBool); >+ os.notifyObservers(cancelQuit, "quit-application-requested", null); >+ >+ // Something aborted the quit process. >+ if (cancelQuit.data) >+ { >+ return false; >+ } >+ } >+ catch (ex) >+ { >+ } >+ return true; >+} >+ >+function goQuitApplication() >+{ >+ const privs = 'UniversalXPConnect'; Don't use const in this file; it'll break running individual tests in non-Mozilla browsers. Along those lines make sure to return silently here if we're not a Mozilla browser; I think there may be logic for this in TestRunner.js, either that or it's in a patch I've reviewed or it exists somewhere else in the test harness. Sure, it's dumb to even run a test in another browser with the query string like this, but I can imagine someone writing a buggy test that "hangs" and copying the URL to another browser to test whether it completes there. >+// Check the query string for arguments >+var params = parseQueryString(location.search.substring(1), true); >+ > // Check to see if the TestRunner is present and has logging > if (parentRunner) { > SimpleTest._logEnabled = parentRunner.logEnabled; > } > > SimpleTest._tests = []; > SimpleTest._stopOnLoad = true; Seems better to save closeWhenDone as a "static" in the same manner as SimpleTest._stopOnLoad. > /** > * Finishes the tests. This is automatically called, except when > * SimpleTest.waitForExplicitFinish() has been invoked. > **/ > SimpleTest.finish = function () { > SimpleTest.showReport(); > SimpleTest.talkToRunner(); >+ if (!parentRunner && params.closeWhenDone) >+ goQuitApplication(); > }; Seems better just to condition closeWhenDone setting to be !parent so you don't need to check for !parentRunner here. This pretty much looks like the half-patch I had written to do this awhile back, but I have no idea where that patch is at the moment.
Comment 4•15 years ago
|
||
Could just dupe this over to bug 508664, jmaher is doing the work to make this stuff happen. I asked him to make --test-path=path/to/test_foo.html load the single test in the harness page with the iframe, so everything should work (instead of fixing each feature of the harness individually).
Updated•15 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•