Closed Bug 1075757 Opened 10 years ago Closed 10 years ago

[Dialer] call_log_test depends on the mozContacts API

Categories

(Firefox OS Graveyard :: Gaia::Dialer, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
2.1 S6 (10oct)

People

(Reporter: julienw, Assigned: rik)

References

Details

Attachments

(1 file)

see https://github.com/mozilla-b2g/gaia/blob/191d805f4911628d37a8a90a1e23a6013995138f/apps/communications/dialer/test/unit/call_log_test.js#L895

When running with the patch in bug 1043562, we get this issue:

  1) [communications-dialer/test/unit/call_log_test.js] dialer/call_log oncontactchange contact removed "before each" hook:
     TypeError: navigator.mozContacts is undefined
      at (anonymous) (app://communications.gaiamobile.org/dialer/test/unit/call_log_test.js:895:9)


We need to replace the dependency with a mock and sinon.
Anthony, maybe you can have a look soon? This is blocking Ehsan from landing the change in bug 1043562 (unless he finds how to give the contacts pref in bug 1075100 in B2G Desktop...).
Flags: needinfo?(anthony)
To reproduce the issue locally, you can run the unit tests in a build from this try push: https://tbpl.mozilla.org/?tree=Try&rev=185bc3597224 (click on the "B", then on "go to build directory" in the bottom left, then take the .tar.bz2 archive).
This was pretty easy to fix. Just need to re-attach the oncontactchange method to the mock.
Assignee: nobody → anthony
Status: NEW → ASSIGNED
Attachment #8500536 - Flags: review?(drs+bugzilla)
Flags: needinfo?(anthony)
Comment on attachment 8500536 [details] [review]
https://github.com/mozilla-b2g/gaia/pull/24842

I find it ugly to have to copy `oncontactchange` over to the mock like this. What do you think of hooking the 'contactchange' event with an event listener, instead of using the `oncontactchange` member?
Comment on attachment 8500536 [details] [review]
https://github.com/mozilla-b2g/gaia/pull/24842

Clearing review until discussion is done.
Attachment #8500536 - Flags: review?(drs+bugzilla)
Target Milestone: --- → 2.1 S6 (10oct)
Comment on attachment 8500536 [details] [review]
https://github.com/mozilla-b2g/gaia/pull/24842

My bad Julien, I didn't test with the correct build. The new patch works in that case.
Attachment #8500536 - Flags: review?(drs+bugzilla)
Comment on attachment 8500536 [details] [review]
https://github.com/mozilla-b2g/gaia/pull/24842

I tested this with the updated mocha as well and it works. I left one nit on the PR which is just a request while you're here.
Attachment #8500536 - Flags: review?(drs+bugzilla) → review+
I removed all traces of MockNotification and kept Notification instead.

https://github.com/mozilla-b2g/gaia/commit/3b468fc409ad38dbbd795541d2a348b547eb999a
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: