Closed Bug 862353 Opened 11 years ago Closed 11 years ago

Set dom.mozContacts.enabled in mochitests

Categories

(Core :: DOM: Device Interfaces, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: reuben, Assigned: reuben)

References

Details

(Whiteboard: [fixed-in-birch])

Attachments

(4 files, 3 obsolete files)

We should enable those in the automation instead of adding pref setting code to every test that uses those APIs.
Attachment #737993 - Flags: review?(anygregor)
Blocks: 778256
Comment on attachment 737993 [details] [diff] [review]
Enable mozContacts and mozSettings for mochitests

We can't do this right now because the app-startup branch is NavigatorPropertyHelper runs too early. I plan on implementing this in a way that will respect resetting the pref later (and having the pref enabled on the profile).

Ben, you can use addLoadEvent in the test to fix bug 778256 until this is done, if you want.
Attachment #737993 - Flags: review?(anygregor)
Thanks Reuben.  I'll check it out tonight.  I'm curious if this will address the original issue on Android in bug 778256.  We'll see what the try server says.
Summary: Set dom.(mozSettings|mozContacts).enabled for mochitests → Set dom.mozContacts.enabled in mochitests
This is based in bug 863704, which just landed. Settings is more complicated, I'm looking into it.
Attachment #737993 - Attachment is obsolete: true
Attachment #744381 - Flags: review?(anygregor)
Comment on attachment 744381 [details] [diff] [review]
Enable dom.mozContacts.enabled in mochitests

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

::: testing/profiles/prefs_general.js
@@ +110,5 @@
>  user_pref("layout.css.report_errors", true);
> +
> +// Enable mozContacts
> +user_pref("dom.navigator-property.disable.mozContacts", false);
> +user_pref("dom.global-constructor.disable.mozContact", false);

This is missing the main "dom.mozContacts.enabled" pref for some reason, pretend that it's here :)
The settings problem might be simpler than I originally thought.
Let's see if the settings patch continues to misbehave:
https://tbpl.mozilla.org/?tree=Try&rev=1bbe3696c921
This allows us to do a bunch of clean up on the tests and remove the NavigatorPropertyHelper service, which serves the sole purpose of letting desktop mochitests access the API. Ben, does this look OK?
Attachment #744381 - Attachment is obsolete: true
Attachment #744381 - Flags: review?(anygregor)
Attachment #746017 - Flags: feedback?(bent.mozilla)
I think I figured the VM mochitest failures out, let's see: https://tbpl.mozilla.org/?tree=Try&rev=5d7714241d26
Attachment #744481 - Attachment is obsolete: true
Comment on attachment 746017 [details] [diff] [review]
Enable mozContacts in B2G and mochitests

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

Sounds fine to me!
Attachment #746017 - Flags: feedback?(bent.mozilla) → feedback+
Comment on attachment 746017 [details] [diff] [review]
Enable mozContacts in B2G and mochitests

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

::: b2g/app/b2g.js
@@ +384,5 @@
>  
>  // Temporary permission hack for WebContacts
>  pref("dom.mozContacts.enabled", true);
> +pref("dom.navigator-property.disable.mozContacts", false);
> +pref("dom.global-constructor.disable.mozContact", false);

Alright if we have 3 redundant prefs we should unify them. Either all of them have to be true or false.
Attachment #746017 - Flags: review+
Comment on attachment 746020 [details] [diff] [review]
Enable mozSettings in B2G and mochitests

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

Same thing but for Settings. Also fixes some geolocation tests that flip the pref.
Ben, does this fix the Android failures?
Attachment #746020 - Flags: review?(anygregor)
Attachment #746020 - Flags: feedback?(bkelly)
Attachment #744482 - Flags: review?(bent.mozilla)
Attachment #746020 - Flags: review?(anygregor) → review+
Attachment #744482 - Flags: review?(bent.mozilla) → review+
https://hg.mozilla.org/mozilla-central/rev/74b0d6784412
https://hg.mozilla.org/mozilla-central/rev/62b448f166ad
https://hg.mozilla.org/mozilla-central/rev/97b938ea14fe
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
No longer blocks: 778256
As discussed on IRC, this check in geolocation_common.js should not be needed any more.

https://tbpl.mozilla.org/?tree=Try&rev=ffd7c26ea262
Attachment #749374 - Flags: review?(reuben.bmo)
Comment on attachment 749374 [details] [diff] [review]
Remove stale code in geolocation that checks for mozsettings.

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

Nice catch, thanks!

::: dom/tests/mochitest/geolocation/geolocation_common.js
@@ +97,5 @@
>    // optional  ok(location.coords.altitudeAccuracy == 42, "alt acc matches known value");
>  }
>  
>  function toggleGeolocationSetting(value, callback) {
>    var mozSettings = window.navigator.mozSettings;

nit: inline this into the next line
Attachment #749374 - Flags: review?(reuben.bmo) → review+
Depends on: 872588
Attachment #746020 - Flags: feedback?(bkelly)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: