Module mock

Module mock 

Source
Expand description

Mock browser factory for testing.

This module provides a mock implementation of BrowserFactory that can be configured to succeed or fail, useful for testing pool behavior without requiring Chrome to be installed.

§Feature Flag

This module is only available when:

  • The test-utils feature is enabled, OR
  • During testing (#[cfg(test)])

§Example

use html2pdf_api::factory::mock::MockBrowserFactory;

// Factory that always fails
let factory = MockBrowserFactory::always_fails("Chrome not installed");

// Factory that fails after N successful creations
let factory = MockBrowserFactory::fail_after_n(3, "Resource exhausted");

Structs§

MockBrowserFactory
Mock browser factory for testing without Chrome.