FakeCdpServer class
In-process fake CDP endpoint for tests: serves /json/version,
/json/list, and a page-level debugger WebSocket that answers the
domains universal_browser_cdp uses.
Canned state is mutable so tests can script the world: axNodes feeds
Accessibility.getFullAXTree, evaluateValue is returned verbatim from
Runtime.evaluate, and autoScreencast makes Page.startScreencast
emit periodic Page.screencastFrame events. Everything the client
sends is recorded in methods, inputEvents, and screencastAcks.
Constructors
Properties
- autoScreencast ↔ bool
-
Whether
Page.startScreencaststarts the frame-emission timer.getter/setter pair -
axNodes
↔ List<
Map< String, Object?> > -
Accessibility.getFullAXTreenode list (CDP shape).getter/setter pair - callFunctionOnValue ↔ String?
-
Value returned by
Runtime.callFunctionOn(defaults to evaluateValue).getter/setter pair -
createdTargets
→ List<
String> -
Target ids created via
Target.createTarget.final - currentUrl ↔ String
-
about:blankinitially; updated byPage.navigate.getter/setter pair - emitLifecycleEvents ↔ bool
-
Whether
Page.navigatealso emitsPage.domContentEventFiredandPage.loadEventFired(default true; tests gate it to script slow-loading pages).getter/setter pair - evaluateException ↔ String?
-
When set,
Runtime.evaluateanswers withexceptionDetailswhose exception description carries this text — the JS-rejection path (CdpPage.evaluateAsyncsurfaces it).getter/setter pair - evaluateHandler ↔ Object? Function(String expression)?
-
When set, answers
Runtime.evaluateinstead of evaluateValue; anullresult falls back to the default. Tests use this to script hit-target failures, viewport payloads, andwindow.__mcpActionsregistries. Returned values reach the driver exactly as returned — real CDPreturnByValuesemantics.getter/setter pair - evaluateValue ↔ String
-
Value returned verbatim by
Runtime.evaluate(default: the canned element rect JSON with a passing hit-target check, so clicks resolve).getter/setter pair -
failNextWithError
↔ Map<
String, Object?> ? -
When set, the next request is answered with this error payload.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- httpBase → Uri
-
HTTP base of the running fake.
no setter
-
inputEvents
→ List<
Map< String, Object?> > -
Recorded
Input.*params, prefixed with the method name.final -
methods
→ List<
String> -
Received method names, in order.
final
-
When set,
Page.navigateanswers with thiserrorTextand emits noPage.frameNavigated— CDP's real navigation-failure shape.getter/setter pair - networkResponseBody ↔ String
-
Value returned by
Network.getResponseBody(plain text).getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
screencastAcks
→ List<
Map< String, Object?> > -
Recorded
Page.screencastFrameAckparams.final - screencastActive ↔ bool
-
Whether the fake is currently screencasting (set by the client).
getter/setter pair
- screencastFrameBase64 ↔ String
-
JPEG payload per emitted screencast frame (4-byte SOI/EOI).
getter/setter pair
- screencastFramesEmitted ↔ int
-
How many
Page.screencastFrameevents were emitted.getter/setter pair - screenshotBase64 ↔ String
-
Payload returned by
Page.captureScreenshot.getter/setter pair -
sessions
→ List<
String> -
Session ids created via
Target.attachToTarget.final - wsPageUri → Uri
-
Page-level debugger WebSocket URL.
no setter
Methods
-
emit(
String method, Map< String, Object?> params) → void - Pushes an event to every connected debugger socket.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
start(
) → Future< Uri> - Starts the HTTP + WebSocket server on an ephemeral loopback port.
-
stop(
) → Future< void> - Stops the server and every open socket.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited