From 4e9d5b577e28f9fbea2e7b34c07f3d98c3b0ccc5 Mon Sep 17 00:00:00 2001 From: Jinwoo Hong <73622457+Jinwoo-H@users.noreply.github.com> Date: Sun, 20 Sep 2026 04:50:50 -0400 Subject: [PATCH] test(mobile): pin the decoded screencast frame with the base64 it now carries (OTA phase C, C6) (#21769) C6.1 (#21758) pinned the frame `decodeBridgeScreencastFrame` hands back with an exact `toEqual`; C6.2 (#21754) made that decoder carry the wire's `b64` on the frame so the page's data URI can reuse it. Each PR was green against the main it branched from, and their squashes together red two of C6.1's cases on main. The pins stay exact and gain the field, with the encoded string spelled out rather than wildcarded. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb --- mobile/src/mobile-web-shell/bridge-host-screencast.test.ts | 6 +++++- .../bridge/bridge-screencast-encoder.test.ts | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) 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' }) })