stubDefaults method

void stubDefaults()

Set up default stubs for common commands.

Call this to have sensible defaults for:

  • host.getCapabilities
  • host.getProtocolVersion
  • host.getSnapshot
  • window.create
  • window.exists

Implementation

void stubDefaults() {
  // Protocol
  stubResponse('host', 'getProtocolVersion', {
    'version': 1,
    'minDartVersion': 1,
    'maxDartVersion': 1,
  });

  // Capabilities
  stubResponse('host', 'getCapabilities', {
    'blur': true,
    'transform': true,
    'globalHotkeys': true,
    'glassEffect': true,
    'multiMonitor': true,
    'contentSizing': true,
    'platform': 'test',
    'osVersion': 'test',
  });

  // Empty snapshot (no existing windows)
  stubResponse('host', 'getSnapshot', <Map<String, dynamic>>[]);

  // Window creation returns the window ID
  _windowCreateHandler = (command) => command.windowId ?? command.params['id'];
}