diff --git a/mobile/src/mobile-web-shell/bridge-host-screencast.test.ts b/mobile/src/mobile-web-shell/bridge-host-screencast.test.ts index 5494afc72de..75b13ae66e5 100644 --- a/mobile/src/mobile-web-shell/bridge-host-screencast.test.ts +++ b/mobile/src/mobile-web-shell/bridge-host-screencast.test.ts @@ -90,7 +90,11 @@ describe('a binary frame crosses as the event the page decodes', () => { expect(event).toMatchObject({ v: 1, type: 'event', id: ID, seq: 1 }) const binary = 'binary' in event ? event.binary : null expect(binary).not.toBeNull() - expect(binary === null ? null : decodeBridgeScreencastFrame(binary)).toEqual(frame(41, IMAGE)) + // The decoded frame carries the wire's own base64 beside the bytes (C6.2's data-URI reuse). + expect(binary === null ? null : decodeBridgeScreencastFrame(binary)).toEqual({ + ...frame(41, IMAGE), + b64: binary?.b64 + }) }) /** One ledger, not two: the page acks by the event seq, so a binary frame that restarted or diff --git a/mobile/src/mobile-web-shell/bridge/bridge-screencast-encoder.test.ts b/mobile/src/mobile-web-shell/bridge/bridge-screencast-encoder.test.ts index 3c37b47b6f2..cfafd4b6fd7 100644 --- a/mobile/src/mobile-web-shell/bridge/bridge-screencast-encoder.test.ts +++ b/mobile/src/mobile-web-shell/bridge/bridge-screencast-encoder.test.ts @@ -44,12 +44,15 @@ describe('the shell encodes a screencast frame the page can decode', () => { frameOf(Uint8Array.of(1, 2, 3), { format: 'png', seq: 77, metadata }) ) expect(event).toEqual({ b64: expect.any(String), format: 'png', frameSeq: 77, metadata }) + // `b64` rides on the decoded frame so the page's data URI can reuse it (C6.2); exact, so a + // re-encode on either side cannot hide behind a wildcard. expect(decodeBridgeScreencastFrame(event)).toEqual({ opcode: BrowserScreencastOpcode.Frame, seq: 77, format: 'png', metadata, - image: Uint8Array.of(1, 2, 3) + image: Uint8Array.of(1, 2, 3), + b64: 'AQID' }) })