Closed Bug 1156957 Opened 10 years ago Closed 9 years ago

Fix gamepad mochitests to work on e10s

Categories

(Core :: DOM: Device Interfaces, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
e10s + ---
firefox48 --- fixed

People

(Reporter: qdot, Assigned: qdot)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 3 obsolete files)

Gamepad mochitests need a forwarder for the GamepadServiceTest object, so e10s can be fully tested. See https://bugzilla.mozilla.org/show_bug.cgi?id=852944#c33
Blocks: e10s-tests
Kyle, is this something you'd be able to look at in the next month or so? Thanks.
Blocks: 1218958
Flags: needinfo?(kyle)
WIP of e10s compatible gamepad tests. Having some problems with it trying to send sync messages?
Assignee: nobody → kyle
Flags: needinfo?(kyle)
(In reply to Andrew McCreight [:mccr8] from comment #1) > Kyle, is this something you'd be able to look at in the next month or so? > Thanks. Should hopefully have it done this week. Mostly there, just trying to figure out why nsISyncMessageManager::SendSyncMessage is getting called in some cases and also why that's failing.
Problem with sync messages was that proxy script doesn't work in non-e10s cases, so we only use proxy for e10s, directly use GamepadServiceTest otherwise.
Attachment #8682901 - Attachment is obsolete: true
Attachment #8683257 - Flags: review?(ted)
Ted, can you review this soon? Wanted this in for e10s completeness sake.
Flags: needinfo?(ted)
Ted, can you review this or should Kyle find somebody else? It has been almost 3 months.
Comment on attachment 8683257 [details] [diff] [review] Patch 1 (v2) - Make gamepad mochitests work on e10s :lenzak800, would you be ok reviewing this? You've been around the gamepad code enough now while working on PBackground that I trust your judgement. If you're not familiar with e10s mochitest issues, feel free to just cancel the review.
Attachment #8683257 - Flags: review?(cleu)
Comment on attachment 8683257 [details] [diff] [review] Patch 1 (v2) - Make gamepad mochitests work on e10s Review of attachment 8683257 [details] [diff] [review]: ----------------------------------------------------------------- Sorry, I am not familiar with mochitest so it's not appropriate for me to review.
Attachment #8683257 - Flags: review?(cleu)
Comment on attachment 8683257 [details] [diff] [review] Patch 1 (v2) - Make gamepad mochitests work on e10s :mrbkap, could you possibly take a look at this? :mccr8 said you were looking at converting DOM tests to e10s already.
Attachment #8683257 - Flags: review?(mrbkap)
Comment on attachment 8683257 [details] [diff] [review] Patch 1 (v2) - Make gamepad mochitests work on e10s Review of attachment 8683257 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/tests/mochitest/gamepad/gamepad_service_test_chrome_script.js @@ +18,5 @@ > + > +addMessageListener('new-button-event', function(message) { > + GamepadService.newButtonEvent(message.i, > + message.b, > + message.s); Can you spell out the full properties like you do in new-button-value-event below? ::: dom/tests/mochitest/gamepad/mock_gamepad.js @@ +4,5 @@ > +// Determine whether this process is a parent or child process. > +let appInfo = SpecialPowers.Cc["@mozilla.org/xre/app-info;1"]; > +let isParentProcess = > + !appInfo || appInfo.getService(SpecialPowers.Ci.nsIXULRuntime) > + .processType == SpecialPowers.Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT; Can you stick some parens around the comparison here? It's a little hard to read the conditional. @@ +19,5 @@ > + let url = SimpleTest.getTestFileURL("gamepad_service_test_chrome_script.js"); > + let script = SpecialPowers.loadChromeScript(url); > + > + GamepadService = { > + addGamepad: function (name, mapping, buttons, axes) { It'd be nice if we had some less-verbose way of doing this, but this is fine. ::: dom/tests/mochitest/gamepad/test_gamepad.html @@ +13,5 @@ > SimpleTest.waitForExplicitFinish(); > +// Due to gamepad being a polling API instead of event driven, test ordering > +// ends up being a little weird in order to deal with e10s. Calls to > +// GamepadService are async across processes, so we'll need to make sure > +// we account for timing before checking values. Since we do in fact have GamepadButtonEvents in Gecko we could ostensibly rewrite this test to use them. Obviously you don't have to do that now. We even have add_task in Mochitest nowadays, which could simplify the test flow, like: https://dxr.mozilla.org/mozilla-central/source/modules/libjar/test/mochitest/test_bug1173171.html#47 @@ +18,3 @@ > window.addEventListener("gamepadconnected", connecthandler); > // Add a gamepad > var index = GamepadService.addGamepad("test gamepad", // id Per discussion on IRC, I don't see how this can work since the e10s addGamepad method doesn't return a value. That needs to get sorted out.
Attachment #8683257 - Flags: review?(ted)
Sorry, I have been unforgivably bad about reviews the past few months. I am in the process of fixing that.
Flags: needinfo?(ted)
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #10) > @@ +18,3 @@ > > window.addEventListener("gamepadconnected", connecthandler); > > // Add a gamepad > > var index = GamepadService.addGamepad("test gamepad", // id > > Per discussion on IRC, I don't see how this can work since the e10s > addGamepad method doesn't return a value. That needs to get sorted out. Ok, yeah, as it is in the patch, test_navigator_gamepads.html times out due to the internal_index values being wrong. Not sure how this worked in the first place. Will get it sorted and get a new version out soon.
Comment on attachment 8683257 [details] [diff] [review] Patch 1 (v2) - Make gamepad mochitests work on e10s Cancelling all reviews, patch brokt.
Attachment #8683257 - Flags: review?(mrbkap)
Good news is, I got index relaying working between processes by changing addGamepad to return a promise, and running sendAsyncMessage between content/parent in the e10s case. Bad news is that frame sync/hidden frame tests fail in the e10s case now, possibly because that feature is actually broken in e10s (getting wrong event counts in frames). Investigating further, but if that takes longer than a day or so, I may just put what I have in for review so we can at least mark 4 of the 6 test files as working on e10s
Ok. We now relay internal gamepad indexes across processes via sendAsyncMessage and promise resolving. Not very pretty, but it does the job. Had to fix some tests to make sure everything stays in order, but everything passes both non-e10s and e10s tests now (at least on linux, still waiting for the rest of my try to come back). https://treeherder.mozilla.org/#/jobs?repo=try&revision=2e4a230b5dcd&selectedJob=17203850
Attachment #8683257 - Attachment is obsolete: true
Attachment #8723378 - Flags: review?(ted)
Comment on attachment 8723378 [details] [diff] [review] Patch 1 (v3) - Make gamepad mochitests work on e10s Review of attachment 8723378 [details] [diff] [review]: ----------------------------------------------------------------- The patch to test_gamepad_hidden_frame looks slightly wrong. Other than that this looks good. Thanks for fixing this up! ::: dom/plugins/test/mochitest/file_bug1245545.js @@ +16,4 @@ > return null; > } > > +addMessageListener('check-plugin-unload', function(index) { Is this an unrelated change? ::: dom/tests/mochitest/gamepad/mock_gamepad.js @@ +54,5 @@ > + } > + }; > +} > + > +var addGamepadDelayed = function(name, mapping, buttons, axes) { I think just calling this `addGamepad` would be fine too. ::: dom/tests/mochitest/gamepad/test_check_timestamp.html @@ +16,5 @@ > +var promise = addGamepadDelayed("test gamepad 1", // id > + SpecialPowers.Ci.nsIGamepadServiceTest.NO_MAPPING, > + 4, // buttons > + 2);// axes > +promise.then(function(i) { Since you're not using the promise for anything else, just chaining the call into the .then is slightly less verbose. ::: dom/tests/mochitest/gamepad/test_gamepad_hidden_frame.html @@ +32,4 @@ > frames_loaded++; > + if (frames_loaded == 2) { > + var promise = addGamepadDelayed("test gamepad", // id > + SpecialPowers.Ci.nsIGamepadServiceTest.STANDARD_MAPPING, It looks like you neglected to remove the addGamepad from the top of this test?
Attachment #8723378 - Flags: review?(ted)
Fixed review comments
Attachment #8723378 - Attachment is obsolete: true
Attachment #8726434 - Flags: review?(ted)
Attachment #8726434 - Flags: review?(ted) → review+
Took this on another run through try and it seems happy with the timer disabling patch in front of it. https://treeherder.mozilla.org/#/jobs?repo=try&revision=81d0ea5ca3ac
Flags: needinfo?(kyle)
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: