Closed Bug 887557 Opened 11 years ago Closed 11 years ago

use a dynamic port in dom xpcshell tests so they can be run in parallel

Categories

(Core :: DOM: Core & HTML, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: mihneadb, Assigned: mihneadb)

References

Details

Attachments

(1 file, 3 obsolete files)

      No description provided.
Blocks: 887064
Depends on: 886980
Attached patch use -1 as httpd port (obsolete) — Splinter Review
Assignee: nobody → mihneadb
Attached patch use -1 as httpd port (obsolete) — Splinter Review
changing to server.identity.primaryPort
Attachment #768053 - Attachment is obsolete: true
No longer depends on: 886980
Comment on attachment 768998 [details] [diff] [review]
use -1 as httpd port

Not sure about the *_wrap test, that URL isn't used at all, maybe I should remove it?
Attachment #768998 - Flags: feedback?(ted)
The URL is being used in the _wrap test; we can't set prefs in content processes, and we run test_geolocation_timeout.js in the content process.
I'm not sure I follow. What would be the correct way of fixing that test?
Start the server in the chrome process in the _wrap test, where you can obtain the dynamic port number. There will be duplicated code, but so it goes.
Comment on attachment 768998 [details] [diff] [review]
use -1 as httpd port

Review of attachment 768998 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/tests/unit/test_geolocation_provider.js
@@ +74,4 @@
>  
>      var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
> +    prefs.setCharPref("geo.wifi.uri", "http://localhost:" +
> +                      httpserver.identity.primaryPort + "/geo");

I wonder if we should add a convenience method to httpd.js to get a URL out of it with the port in use, like we did for mozhttpd:
http://mozbase.readthedocs.org/en/latest/mozhttpd.html#mozhttpd.MozHttpd.get_url

::: dom/tests/unit/test_geolocation_timeout_wrap.js
@@ +5,5 @@
>    var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
>    prefs.setBoolPref("geo.wifi.scan", false);
> +  prefs.setCharPref("geo.wifi.uri", "http://localhost:4444/geo");
> +  // ^^^ needs the port in the test_geolocation_timeout.js that's being set
> +  // dynamically; it gets re-set in there so it is fine for now

So jdm is saying that you should start a server here, and put the server-starting logic in test_geolocation_timeout.js inside the processType check so that you only start a server when it's not being run as a child process.
Attachment #768998 - Flags: feedback?(ted)
Attached patch use a dynamic port for httpd.js (obsolete) — Splinter Review
Attachment #772812 - Flags: review?(josh)
Attachment #768998 - Attachment is obsolete: true
Comment on attachment 772812 [details] [diff] [review]
use a dynamic port for httpd.js

Review of attachment 772812 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/tests/unit/test_geolocation_timeout_wrap.js
@@ +7,5 @@
>  function run_test() {
>    var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
>    prefs.setBoolPref("geo.wifi.scan", false);
> +
> +  var httpserver = new HttpServer();

Make this a global.
Attachment #772812 - Flags: review?(josh) → review+
Attachment #772812 - Attachment is obsolete: true
Comment on attachment 773051 [details] [diff] [review]
use a dynamic port for httpd.js

keeping r+
Attachment #773051 - Flags: review+
Isolated (this patch only) try run here: https://tbpl.mozilla.org/?tree=Try&rev=ec7816140100
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/d4b4c27078e1
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: