Closed Bug 1140791 Opened 9 years ago Closed 9 years ago

Run fetch tests on main thread too

Categories

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

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: nsm, Assigned: nsm)

References

Details

Attachments

(1 file)

Right now most tests are only run on workers, they should be run in both threads. This should be pretty easy with some refactoring.
Assignee: nobody → nsm.nikhil
Unified all tests into dom/tests/mochitest/fetch
Moved test runner into fetch_test_framework. The common header tests also use this framework, while the main thread tests now have their own html file.
Attachment #8576277 - Flags: review?(bkelly)
Comment on attachment 8576277 [details] [diff] [review]
Run fetch tests on main thread and workers

Redirecting to Ehsan as we need a DOM peer to sign off anyways and he has been looking at this kind of test framework stuff recently.
Attachment #8576277 - Flags: review?(bkelly) → review?(ehsan)
What features does your framework provide, Nikhil?  I have been developing my own little framework for cache too (it's https://dxr.mozilla.org/mozilla-central/source/dom/cache/test/mochitest/driver.js) that knows how to run a test in a worker, a service worker and a window, and I'm extending it to do exciting things such as interleave the tests run in the three threads in bug 1142772.  Maybe we should consider unifying them?
Flags: needinfo?(nsm.nikhil)
My 'framework' is no framework. It just loads a script in 1) main thread 2) a worker, calls a function on them, and waits for the promise to resolve. Nothing to do with serviceworkers. I guess I could use some part of it, but this is a 20 line test runner and I'd rather not spend the time right now figuring out how to integrate with the cache driver. I particularly do not want interleaving since the fetch tests test for cookies which need ordering.
Flags: needinfo?(nsm.nikhil)
OK fair enough!
Comment on attachment 8576277 [details] [diff] [review]
Run fetch tests on main thread and workers

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

::: dom/tests/mochitest/fetch/fetch_test_framework.js
@@ +5,5 @@
> +      worker.onmessage = function(event) {
> +        if (event.data.type == 'finish') {
> +          resolve();
> +        } else if (event.data.type == 'status') {
> +          ok(event.data.status, event.data.msg);

Nit: please prepend "Worker: " or some such to the message here.

@@ +9,5 @@
> +          ok(event.data.status, event.data.msg);
> +        }
> +      }
> +      worker.onerror = function(event) {
> +      info("Got worker error!");

Nit: indentation.
Attachment #8576277 - Flags: review?(ehsan) → review+
https://hg.mozilla.org/mozilla-central/rev/e50a44b381ff
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
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: