Closed Bug 1135874 Opened 7 years ago Closed 5 years ago
Need some way to persist prefs from within a test between restarts
Splitting this blocker for update tests from the discussion in bug 1129713. It seems like we need finer grained control than other consumers of mozprofile right now. If this ability is ever added there we can re-assess.
ahal had a suggestion in https://bugzilla.mozilla.org/show_bug.cgi?id=1129713#c7 I'll try adding to our prefs library.
Comment on attachment 8568205 [details] [review] Add a function to persist prefs through restarts r- because the test is not testing what I was talking about in the other bug. I put more details on the PR.
Attachment #8568205 - Flags: review?(hskupin) → review-
Harness set preferences are re-enforced after a restart, so this needs a different fix.
This needs a small change to marionette automation to work. Henrik, if we were able to pass a dictionary of preferences to the call to restart to ensure they persist, would that be sufficient?
It should but how do you wanna do that? You would have to mess around with mozprofile to get that working, given that utils.js will already be present in that profile.
(In reply to Henrik Skupin (:whimboo) from comment #6) > It should but how do you wanna do that? You would have to mess around with > mozprofile to get that working, given that utils.js will already be present > in that profile. Marionette's restart machinery has a way to specify prefs that will become the new "required prefs" that are enforced after the restart. This will just be a matter of exposing that parameter to marionette.restart (it's already defined for geckoinstance.restart).
If that all works wonderful! We only have to ensure that for the next test, all the default prefs are in place again.
Comment on attachment 8568205 [details] [review] Add a function to persist prefs through restarts I pushed a more extensive test with the proposed behavior to the branch in the PR (it passes with the proposed marionette patch). To get back to the harness defaults after a test we can call self.marionette.enforce_gecko_prefs with the harness defaults in tearDown.
Attachment #8568205 - Flags: review- → feedback?(hskupin)
Comment on attachment 8568205 [details] [review] Add a function to persist prefs through restarts I gave a couple of comments on the PR. I still don't think this is the right way to handle that. Maybe it needs a more detailed discussion first.
Attachment #8568205 - Flags: feedback?(hskupin) → feedback-
Discussion in the PR lead us to bug 1137388. That needs to be resolved before we proceed here.
I think what we're talking about is a way to persist the override of a pref that gets set in user.js at the beginning of the test run. Marionette lets us do this with enforce_gecko_prefs, which causes a hard restart if the pref needs to be updated, and it looks like self.marionette.instance.profile.set_preferences() will let us write to a user.js file at any point.
Sounds good. Can Marionette automatically reset the value of this preferences to the one as given by the harness at the end of the test?
(In reply to Henrik Skupin (:whimboo) from comment #13) > Sounds good. Can Marionette automatically reset the value of this > preferences to the one as given by the harness at the end of the test? We can implement that by calling enforce_gecko_prefs with the defaults after the test runs.
That sounds perfect.
I think there is no actionable item left on this bug given that enforce_gecko_prefs() gives us what we need.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.