TestBrowserPlatform.from constructor

  1. @visibleForTesting
TestBrowserPlatform.from(
  1. BrowserPlatform browserPlatform
)

Creates a custom TestBrowserPlatform as a copy of browserPlatform.

If browserPlatform is a TestBrowserPlatform, the new object is an exact copy of the original, including any undefined properties. Otherwise the new object is a TestBrowserPlatform that has the same property values as browserPlatform.

Implementation

@visibleForTesting
factory TestBrowserPlatform.from(BrowserPlatform browserPlatform) {
  if (browserPlatform is TestBrowserPlatform) {
    return browserPlatform.copyWith();
  }
  return TestBrowserPlatform(
    version: browserPlatform.version,
    userAgent: browserPlatform.userAgent,
  );
}