TestBrowserPlatform class final
A custom BrowserPlatform for testing.
The individual properties can be left unset by the constructors. Accessing such properties will throw, but a test which doesn't use those properties doesn't have to provide values for them.
- Implemented types
- Annotations
-
- @visibleForTesting
Constructors
- TestBrowserPlatform({String? version, String? userAgent})
-
Creates a custom
TestBrowserPlatformwith the given properties. - TestBrowserPlatform.from(BrowserPlatform browserPlatform)
-
Creates a custom
TestBrowserPlatformas a copy ofbrowserPlatform.factory - TestBrowserPlatform.fromJson(String jsonText)
-
Creates a new TestBrowserPlatform with properties from a JSON string.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- userAgent → String
-
The browser's user-agent string, as reported by
Navigator.userAgent.no setteroverride - version → String
-
The browser's version, as reported by
Navigator.appVersionby default.no setteroverride
Methods
-
copyWith(
{String? version, String? userAgent}) → TestBrowserPlatform - Creates a new TestBrowserPlatform from this one.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run<
R> (R testCode()) → R -
Runs
testCodewith this object asPlatform.current.browserPlatform. -
toJson(
) → String -
A JSON-encoded representation of this browser platform test-configuration.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited