Documentation ¶
Overview ¶
Package emulation implements the Emulation domain. This domain emulates different environments for the page.
Index ¶
- func NewClient(conn *rpcc.Conn) *domainClient
- type CanEmulateReply
- type ScreenOrientation
- type SetCPUThrottlingRateArgs
- type SetDefaultBackgroundColorOverrideArgs
- type SetDeviceMetricsOverrideArgs
- func (a *SetDeviceMetricsOverrideArgs) SetDontSetVisibleSize(dontSetVisibleSize bool) *SetDeviceMetricsOverrideArgs
- func (a *SetDeviceMetricsOverrideArgs) SetPositionX(positionX int) *SetDeviceMetricsOverrideArgs
- func (a *SetDeviceMetricsOverrideArgs) SetPositionY(positionY int) *SetDeviceMetricsOverrideArgs
- func (a *SetDeviceMetricsOverrideArgs) SetScale(scale float64) *SetDeviceMetricsOverrideArgs
- func (a *SetDeviceMetricsOverrideArgs) SetScreenHeight(screenHeight int) *SetDeviceMetricsOverrideArgs
- func (a *SetDeviceMetricsOverrideArgs) SetScreenOrientation(screenOrientation ScreenOrientation) *SetDeviceMetricsOverrideArgs
- func (a *SetDeviceMetricsOverrideArgs) SetScreenWidth(screenWidth int) *SetDeviceMetricsOverrideArgs
- func (a *SetDeviceMetricsOverrideArgs) SetViewport(viewport page.Viewport) *SetDeviceMetricsOverrideArgs
- type SetEmitTouchEventsForMouseArgs
- type SetEmulatedMediaArgs
- type SetGeolocationOverrideArgs
- type SetNavigatorOverridesArgs
- type SetPageScaleFactorArgs
- type SetScriptExecutionDisabledArgs
- type SetTouchEmulationEnabledArgs
- type SetVirtualTimePolicyArgs
- func (a *SetVirtualTimePolicyArgs) SetBudget(budget float64) *SetVirtualTimePolicyArgs
- func (a *SetVirtualTimePolicyArgs) SetMaxVirtualTimeTaskStarvationCount(maxVirtualTimeTaskStarvationCount int) *SetVirtualTimePolicyArgs
- func (a *SetVirtualTimePolicyArgs) SetWaitForNavigation(waitForNavigation bool) *SetVirtualTimePolicyArgs
- type SetVirtualTimePolicyReply
- type SetVisibleSizeArgs
- type VirtualTimeAdvancedClient
- type VirtualTimeAdvancedReply
- type VirtualTimeBudgetExpiredClient
- type VirtualTimeBudgetExpiredReply
- type VirtualTimePausedClient
- type VirtualTimePausedReply
- type VirtualTimePolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CanEmulateReply ¶
type CanEmulateReply struct {
Result bool `json:"result"` // True if emulation is supported.
}
CanEmulateReply represents the return values for CanEmulate in the Emulation domain.
type ScreenOrientation ¶
type ScreenOrientation struct { // Type Orientation type. // // Values: "portraitPrimary", "portraitSecondary", "landscapePrimary", "landscapeSecondary". Type string `json:"type"` Angle int `json:"angle"` // Orientation angle. }
ScreenOrientation Screen orientation.
type SetCPUThrottlingRateArgs ¶
type SetCPUThrottlingRateArgs struct {
Rate float64 `json:"rate"` // Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
}
SetCPUThrottlingRateArgs represents the arguments for SetCPUThrottlingRate in the Emulation domain.
func NewSetCPUThrottlingRateArgs ¶
func NewSetCPUThrottlingRateArgs(rate float64) *SetCPUThrottlingRateArgs
NewSetCPUThrottlingRateArgs initializes SetCPUThrottlingRateArgs with the required arguments.
type SetDefaultBackgroundColorOverrideArgs ¶
type SetDefaultBackgroundColorOverrideArgs struct {
Color *dom.RGBA `json:"color,omitempty"` // RGBA of the default background color. If not specified, any existing override will be cleared.
}
SetDefaultBackgroundColorOverrideArgs represents the arguments for SetDefaultBackgroundColorOverride in the Emulation domain.
func NewSetDefaultBackgroundColorOverrideArgs ¶
func NewSetDefaultBackgroundColorOverrideArgs() *SetDefaultBackgroundColorOverrideArgs
NewSetDefaultBackgroundColorOverrideArgs initializes SetDefaultBackgroundColorOverrideArgs with the required arguments.
func (*SetDefaultBackgroundColorOverrideArgs) SetColor ¶
func (a *SetDefaultBackgroundColorOverrideArgs) SetColor(color dom.RGBA) *SetDefaultBackgroundColorOverrideArgs
SetColor sets the Color optional argument. RGBA of the default background color. If not specified, any existing override will be cleared.
type SetDeviceMetricsOverrideArgs ¶
type SetDeviceMetricsOverrideArgs struct { Width int `json:"width"` // Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override. Height int `json:"height"` // Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override. DeviceScaleFactor float64 `json:"deviceScaleFactor"` // Overriding device scale factor value. 0 disables the override. Mobile bool `json:"mobile"` // Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text autosizing and more. // Scale Scale to apply to resulting view image. // // Note: This property is experimental. Scale *float64 `json:"scale,omitempty"` // ScreenWidth Overriding screen width value in pixels (minimum 0, // maximum 10000000). // // Note: This property is experimental. ScreenWidth *int `json:"screenWidth,omitempty"` // ScreenHeight Overriding screen height value in pixels (minimum 0, // maximum 10000000). // // Note: This property is experimental. ScreenHeight *int `json:"screenHeight,omitempty"` // PositionX Overriding view X position on screen in pixels (minimum // 0, maximum 10000000). // // Note: This property is experimental. PositionX *int `json:"positionX,omitempty"` // PositionY Overriding view Y position on screen in pixels (minimum // 0, maximum 10000000). // // Note: This property is experimental. PositionY *int `json:"positionY,omitempty"` // DontSetVisibleSize Do not set visible view size, rely upon explicit // setVisibleSize call. // // Note: This property is experimental. DontSetVisibleSize *bool `json:"dontSetVisibleSize,omitempty"` ScreenOrientation *ScreenOrientation `json:"screenOrientation,omitempty"` // Screen orientation override. // Viewport If set, the visible area of the page will be overridden to // this viewport. This viewport change is not observed by the page, // e.g. viewport-relative elements do not change positions. // // Note: This property is experimental. Viewport *page.Viewport `json:"viewport,omitempty"` }
SetDeviceMetricsOverrideArgs represents the arguments for SetDeviceMetricsOverride in the Emulation domain.
func NewSetDeviceMetricsOverrideArgs ¶
func NewSetDeviceMetricsOverrideArgs(width int, height int, deviceScaleFactor float64, mobile bool) *SetDeviceMetricsOverrideArgs
NewSetDeviceMetricsOverrideArgs initializes SetDeviceMetricsOverrideArgs with the required arguments.
func (*SetDeviceMetricsOverrideArgs) SetDontSetVisibleSize ¶ added in v0.9.1
func (a *SetDeviceMetricsOverrideArgs) SetDontSetVisibleSize(dontSetVisibleSize bool) *SetDeviceMetricsOverrideArgs
SetDontSetVisibleSize sets the DontSetVisibleSize optional argument. Do not set visible view size, rely upon explicit setVisibleSize call.
Note: This property is experimental.
func (*SetDeviceMetricsOverrideArgs) SetPositionX ¶
func (a *SetDeviceMetricsOverrideArgs) SetPositionX(positionX int) *SetDeviceMetricsOverrideArgs
SetPositionX sets the PositionX optional argument. Overriding view X position on screen in pixels (minimum 0, maximum 10000000).
Note: This property is experimental.
func (*SetDeviceMetricsOverrideArgs) SetPositionY ¶
func (a *SetDeviceMetricsOverrideArgs) SetPositionY(positionY int) *SetDeviceMetricsOverrideArgs
SetPositionY sets the PositionY optional argument. Overriding view Y position on screen in pixels (minimum 0, maximum 10000000).
Note: This property is experimental.
func (*SetDeviceMetricsOverrideArgs) SetScale ¶
func (a *SetDeviceMetricsOverrideArgs) SetScale(scale float64) *SetDeviceMetricsOverrideArgs
SetScale sets the Scale optional argument. Scale to apply to resulting view image.
Note: This property is experimental.
func (*SetDeviceMetricsOverrideArgs) SetScreenHeight ¶
func (a *SetDeviceMetricsOverrideArgs) SetScreenHeight(screenHeight int) *SetDeviceMetricsOverrideArgs
SetScreenHeight sets the ScreenHeight optional argument. Overriding screen height value in pixels (minimum 0, maximum 10000000).
Note: This property is experimental.
func (*SetDeviceMetricsOverrideArgs) SetScreenOrientation ¶
func (a *SetDeviceMetricsOverrideArgs) SetScreenOrientation(screenOrientation ScreenOrientation) *SetDeviceMetricsOverrideArgs
SetScreenOrientation sets the ScreenOrientation optional argument. Screen orientation override.
func (*SetDeviceMetricsOverrideArgs) SetScreenWidth ¶
func (a *SetDeviceMetricsOverrideArgs) SetScreenWidth(screenWidth int) *SetDeviceMetricsOverrideArgs
SetScreenWidth sets the ScreenWidth optional argument. Overriding screen width value in pixels (minimum 0, maximum 10000000).
Note: This property is experimental.
func (*SetDeviceMetricsOverrideArgs) SetViewport ¶ added in v0.14.1
func (a *SetDeviceMetricsOverrideArgs) SetViewport(viewport page.Viewport) *SetDeviceMetricsOverrideArgs
SetViewport sets the Viewport optional argument. If set, the visible area of the page will be overridden to this viewport. This viewport change is not observed by the page, e.g. viewport-relative elements do not change positions.
Note: This property is experimental.
type SetEmitTouchEventsForMouseArgs ¶ added in v0.11.1
type SetEmitTouchEventsForMouseArgs struct { Enabled bool `json:"enabled"` // Whether touch emulation based on mouse input should be enabled. // Configuration Touch/gesture events configuration. Default: current // platform. // // Values: "mobile", "desktop". Configuration *string `json:"configuration,omitempty"` }
SetEmitTouchEventsForMouseArgs represents the arguments for SetEmitTouchEventsForMouse in the Emulation domain.
func NewSetEmitTouchEventsForMouseArgs ¶ added in v0.11.1
func NewSetEmitTouchEventsForMouseArgs(enabled bool) *SetEmitTouchEventsForMouseArgs
NewSetEmitTouchEventsForMouseArgs initializes SetEmitTouchEventsForMouseArgs with the required arguments.
func (*SetEmitTouchEventsForMouseArgs) SetConfiguration ¶ added in v0.11.1
func (a *SetEmitTouchEventsForMouseArgs) SetConfiguration(configuration string) *SetEmitTouchEventsForMouseArgs
SetConfiguration sets the Configuration optional argument. Touch/gesture events configuration. Default: current platform.
Values: "mobile", "desktop".
type SetEmulatedMediaArgs ¶
type SetEmulatedMediaArgs struct {
Media string `json:"media"` // Media type to emulate. Empty string disables the override.
}
SetEmulatedMediaArgs represents the arguments for SetEmulatedMedia in the Emulation domain.
func NewSetEmulatedMediaArgs ¶
func NewSetEmulatedMediaArgs(media string) *SetEmulatedMediaArgs
NewSetEmulatedMediaArgs initializes SetEmulatedMediaArgs with the required arguments.
type SetGeolocationOverrideArgs ¶
type SetGeolocationOverrideArgs struct { Latitude *float64 `json:"latitude,omitempty"` // Mock latitude Longitude *float64 `json:"longitude,omitempty"` // Mock longitude Accuracy *float64 `json:"accuracy,omitempty"` // Mock accuracy }
SetGeolocationOverrideArgs represents the arguments for SetGeolocationOverride in the Emulation domain.
func NewSetGeolocationOverrideArgs ¶
func NewSetGeolocationOverrideArgs() *SetGeolocationOverrideArgs
NewSetGeolocationOverrideArgs initializes SetGeolocationOverrideArgs with the required arguments.
func (*SetGeolocationOverrideArgs) SetAccuracy ¶
func (a *SetGeolocationOverrideArgs) SetAccuracy(accuracy float64) *SetGeolocationOverrideArgs
SetAccuracy sets the Accuracy optional argument. Mock accuracy
func (*SetGeolocationOverrideArgs) SetLatitude ¶
func (a *SetGeolocationOverrideArgs) SetLatitude(latitude float64) *SetGeolocationOverrideArgs
SetLatitude sets the Latitude optional argument. Mock latitude
func (*SetGeolocationOverrideArgs) SetLongitude ¶
func (a *SetGeolocationOverrideArgs) SetLongitude(longitude float64) *SetGeolocationOverrideArgs
SetLongitude sets the Longitude optional argument. Mock longitude
type SetNavigatorOverridesArgs ¶ added in v0.13.1
type SetNavigatorOverridesArgs struct {
}SetNavigatorOverridesArgs represents the arguments for SetNavigatorOverrides in the Emulation domain.
func NewSetNavigatorOverridesArgs ¶ added in v0.13.1
func NewSetNavigatorOverridesArgs(platform string) *SetNavigatorOverridesArgs
NewSetNavigatorOverridesArgs initializes SetNavigatorOverridesArgs with the required arguments.
type SetPageScaleFactorArgs ¶
type SetPageScaleFactorArgs struct {
PageScaleFactor float64 `json:"pageScaleFactor"` // Page scale factor.
}
SetPageScaleFactorArgs represents the arguments for SetPageScaleFactor in the Emulation domain.
func NewSetPageScaleFactorArgs ¶
func NewSetPageScaleFactorArgs(pageScaleFactor float64) *SetPageScaleFactorArgs
NewSetPageScaleFactorArgs initializes SetPageScaleFactorArgs with the required arguments.
type SetScriptExecutionDisabledArgs ¶
type SetScriptExecutionDisabledArgs struct {
Value bool `json:"value"` // Whether script execution should be disabled in the page.
}
SetScriptExecutionDisabledArgs represents the arguments for SetScriptExecutionDisabled in the Emulation domain.
func NewSetScriptExecutionDisabledArgs ¶
func NewSetScriptExecutionDisabledArgs(value bool) *SetScriptExecutionDisabledArgs
NewSetScriptExecutionDisabledArgs initializes SetScriptExecutionDisabledArgs with the required arguments.
type SetTouchEmulationEnabledArgs ¶
type SetTouchEmulationEnabledArgs struct { Enabled bool `json:"enabled"` // Whether the touch event emulation should be enabled. MaxTouchPoints *int `json:"maxTouchPoints,omitempty"` // Maximum touch points supported. Defaults to one. }
SetTouchEmulationEnabledArgs represents the arguments for SetTouchEmulationEnabled in the Emulation domain.
func NewSetTouchEmulationEnabledArgs ¶
func NewSetTouchEmulationEnabledArgs(enabled bool) *SetTouchEmulationEnabledArgs
NewSetTouchEmulationEnabledArgs initializes SetTouchEmulationEnabledArgs with the required arguments.
func (*SetTouchEmulationEnabledArgs) SetMaxTouchPoints ¶ added in v0.11.1
func (a *SetTouchEmulationEnabledArgs) SetMaxTouchPoints(maxTouchPoints int) *SetTouchEmulationEnabledArgs
SetMaxTouchPoints sets the MaxTouchPoints optional argument. Maximum touch points supported. Defaults to one.
type SetVirtualTimePolicyArgs ¶
type SetVirtualTimePolicyArgs struct { Policy VirtualTimePolicy `json:"policy"` // No description. Budget *float64 `json:"budget,omitempty"` // If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent. MaxVirtualTimeTaskStarvationCount *int `json:"maxVirtualTimeTaskStarvationCount,omitempty"` // If set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock. }
SetVirtualTimePolicyArgs represents the arguments for SetVirtualTimePolicy in the Emulation domain.
func NewSetVirtualTimePolicyArgs ¶
func NewSetVirtualTimePolicyArgs(policy VirtualTimePolicy) *SetVirtualTimePolicyArgs
NewSetVirtualTimePolicyArgs initializes SetVirtualTimePolicyArgs with the required arguments.
func (*SetVirtualTimePolicyArgs) SetBudget ¶
func (a *SetVirtualTimePolicyArgs) SetBudget(budget float64) *SetVirtualTimePolicyArgs
SetBudget sets the Budget optional argument. If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent.
func (*SetVirtualTimePolicyArgs) SetMaxVirtualTimeTaskStarvationCount ¶ added in v0.14.1
func (a *SetVirtualTimePolicyArgs) SetMaxVirtualTimeTaskStarvationCount(maxVirtualTimeTaskStarvationCount int) *SetVirtualTimePolicyArgs
SetMaxVirtualTimeTaskStarvationCount sets the MaxVirtualTimeTaskStarvationCount optional argument. If set this specifies the maximum number of tasks that can be run before virtual is forced forwards to prevent deadlock.
func (*SetVirtualTimePolicyArgs) SetWaitForNavigation ¶ added in v0.15.6
func (a *SetVirtualTimePolicyArgs) SetWaitForNavigation(waitForNavigation bool) *SetVirtualTimePolicyArgs
SetWaitForNavigation sets the WaitForNavigation optional argument. If set the virtual time policy change should be deferred until any frame starts navigating. Note any previous deferred policy change is superseded.
type SetVirtualTimePolicyReply ¶ added in v0.14.2
type SetVirtualTimePolicyReply struct { VirtualTimeBase runtime.Timestamp `json:"virtualTimeBase"` // Absolute timestamp at which virtual time was first enabled (milliseconds since epoch). VirtualTimeTicksBase float64 `json:"virtualTimeTicksBase"` // Absolute timestamp at which virtual time was first enabled (up time in milliseconds). }
SetVirtualTimePolicyReply represents the return values for SetVirtualTimePolicy in the Emulation domain.
type SetVisibleSizeArgs ¶
type SetVisibleSizeArgs struct { Width int `json:"width"` // Frame width (DIP). Height int `json:"height"` // Frame height (DIP). }
SetVisibleSizeArgs represents the arguments for SetVisibleSize in the Emulation domain.
func NewSetVisibleSizeArgs ¶
func NewSetVisibleSizeArgs(width int, height int) *SetVisibleSizeArgs
NewSetVisibleSizeArgs initializes SetVisibleSizeArgs with the required arguments.
type VirtualTimeAdvancedClient ¶ added in v0.14.1
type VirtualTimeAdvancedClient interface { // Recv calls RecvMsg on rpcc.Stream, blocks until the event is // triggered, context canceled or connection closed. Recv() (*VirtualTimeAdvancedReply, error) rpcc.Stream }
VirtualTimeAdvancedClient is a client for VirtualTimeAdvanced events. Notification sent after the virtual time has advanced.
type VirtualTimeAdvancedReply ¶ added in v0.14.1
type VirtualTimeAdvancedReply struct {
VirtualTimeElapsed float64 `json:"virtualTimeElapsed"` // The amount of virtual time that has elapsed in milliseconds since virtual time was first enabled.
}
VirtualTimeAdvancedReply is the reply for VirtualTimeAdvanced events.
type VirtualTimeBudgetExpiredClient ¶
type VirtualTimeBudgetExpiredClient interface { // Recv calls RecvMsg on rpcc.Stream, blocks until the event is // triggered, context canceled or connection closed. Recv() (*VirtualTimeBudgetExpiredReply, error) rpcc.Stream }
VirtualTimeBudgetExpiredClient is a client for VirtualTimeBudgetExpired events. Notification sent after the virtual time budget for the current VirtualTimePolicy has run out.
type VirtualTimeBudgetExpiredReply ¶
type VirtualTimeBudgetExpiredReply struct { }
VirtualTimeBudgetExpiredReply is the reply for VirtualTimeBudgetExpired events.
type VirtualTimePausedClient ¶ added in v0.13.0
type VirtualTimePausedClient interface { // Recv calls RecvMsg on rpcc.Stream, blocks until the event is // triggered, context canceled or connection closed. Recv() (*VirtualTimePausedReply, error) rpcc.Stream }
VirtualTimePausedClient is a client for VirtualTimePaused events. Notification sent after the virtual time has paused.
type VirtualTimePausedReply ¶ added in v0.13.0
type VirtualTimePausedReply struct {
VirtualTimeElapsed float64 `json:"virtualTimeElapsed"` // The amount of virtual time that has elapsed in milliseconds since virtual time was first enabled.
}
VirtualTimePausedReply is the reply for VirtualTimePaused events.
type VirtualTimePolicy ¶
type VirtualTimePolicy string
VirtualTimePolicy advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to allow the next delayed task (if any) to run; pause: The virtual time base may not advance; pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending resource fetches.
Note: This type is experimental.
const ( VirtualTimePolicyNotSet VirtualTimePolicy = "" VirtualTimePolicyAdvance VirtualTimePolicy = "advance" VirtualTimePolicyPause VirtualTimePolicy = "pause" VirtualTimePolicyPauseIfNetworkFetchesPending VirtualTimePolicy = "pauseIfNetworkFetchesPending" )
VirtualTimePolicy as enums.
func (VirtualTimePolicy) String ¶
func (e VirtualTimePolicy) String() string
func (VirtualTimePolicy) Valid ¶
func (e VirtualTimePolicy) Valid() bool