Closed Bug 1552972 Opened 5 years ago Closed 5 years ago

no testability of nsINetworkLinkService

Categories

(Core :: Networking, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1550605

People

(Reporter: mixedpuppy, Unassigned)

References

Details

There doesn't seem to be any way to write an actual test for this.

The weirder part is that the tests that exist use io.offline, but as far as I can tell, flipping that actually has no effect on nsINetworkLinkService. The link status still says it's up.

That's true.
The problem is that nsINetworkLinkService responds directly to the device's connectivity, and especially in automation, we have no control over that. What we could do is to create a mock NetworkLinkService, similar to this and use that for some of the tests.
What do you think?

That may be worthwhile just to test consumers of the notifications. I think the tests trying to rely on io.offline should probably be addressed as well.

BTW, I've added a mock class in D30572 for bug 1550605.

(In reply to Shane Caraveo (:mixedpuppy) from comment #2)

That may be worthwhile just to test consumers of the notifications. I think the tests trying to rely on io.offline should probably be addressed as well.

So, Services.io.offline only reflects if the browser is in offline mode (unless you flip network.offline-mirrors-connectivity). The mode does not reflect changes to nsINetworkLinkService, and nsINetworkLinkService notifications do not reflect changes to io.offline.

However, both of these are reflected in navigator.onLine (the network.manage-offline-status pref is relevant to this)

Thank you for adding a mock. I'm just going to dupe this to bug 1550605 unless you think there's separate work that needs to be done here.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.