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
This commit is contained in:
Jinwoo Hong
2026-09-20 04:50:50 -04:00
committed by GitHub
parent 6f0fb3fe39
commit 4e9d5b577e
2 changed files with 9 additions and 2 deletions
@@ -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
@@ -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'
})
})