Closed Bug 1596006 Opened 1 year ago Closed 1 year ago

[wpt-sync] Sync PR 20227 - [webnfc] Use one nfc mock object per test file


(Testing :: web-platform-tests, task, P4)



(firefox72 fixed)

Tracking Status
firefox72 --- fixed


(Reporter:, Unassigned)




(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 20227 into mozilla-central (this bug is closed when the sync is complete).

Details from upstream follow.

Leon Han <> wrote:

[webnfc] Use one nfc mock object per test file

Previously, each run of nfc_test() creates a new nfc mock object in the
start and destroyes it in the end.

Considering a test file containing multiple nfc_test() runs, in Blink we
have just one NFCProxy instance per page context to talk to these mocks,
that means our NFCProxy gets a broken NFC Mojo connection each time the
previous nfc_test() runs to the end then has to reconnect to another new
nfc mock for the coming nfc_test().

This is unnecessary and does not align with the product code logic that
always keeps one NFC Mojo connection alive per page context, unless
something unexpected happens in Device Service.

Also, this makes it easier for a nfc_test() to interfere with the next
one, e.g. a nfc_test() ends and closes the NFC Mojo connection, the
disconnection message will arrive at our NFCProxy asynchronously and we
can not have any assumptions on the arrival time, assuming it's still on
the way and the next nfc_test() has already started, at that point our
NFCProxy has no idea that the current Mojo connection was already closed
but continues to talk to it.

This CL makes one nfc mock object be reused throughout one test file to
address the above concerns.


Change-Id: I7e2ae9816936081e1f59688652e34b35a5295af6

WPT-Export-Revision: cc4e17ce4be9eb35ed2d6599d370ed4d28690db7

PR 20227 applied with additional changes from upstream: e44f20914735498a05fc835efe3e2cbde9f86f00, 55b30cad64e25104acb82331d8def75cb4f0c665, 0abb411331f86f472103183c7ec1136ea21a7e1b, c0ec46c3e6f1452abf3cf9916f3e2ceb4c494b12, d4a7c5c8ff1f9a56e692b19469e655fd7f684582, ef43b5d72594d9bc2dfcd1a9371a9791796b173a, 75cef9e5eb3493b1105eb37c27eab174d203f397, 456845e6c6031335bc2e9e0d37323310e6dac2c3, 43ed158713eb73346f281cd4443bc0916c980625, eaf583ff9cfe4ce36b517ae3519e114948ba10c3
Pushed by
[wpt PR 20227] - [webnfc] Use one nfc mock object per test file, a=testonly
[wpt PR 20227] - Update wpt metadata, a=testonly
Test result changes from PR not available.
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
You need to log in before you can comment on or make changes to this bug.