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
- type SetEmulatedMediaArgs
- type SetGeolocationOverrideArgs
- type SetPageScaleFactorArgs
- type SetScriptExecutionDisabledArgs
- type SetTouchEmulationEnabledArgs
- type SetVirtualTimePolicyArgs
- type SetVisibleSizeArgs
- type VirtualTimeBudgetExpiredClient
- type VirtualTimeBudgetExpiredReply
- 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 *float64 `json:"scale,omitempty"` // Scale to apply to resulting view image. Ignored in |fitWindow| mode. // ScreenWidth Overriding screen width value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|. // // Note: This property is experimental. ScreenWidth *int `json:"screenWidth,omitempty"` // ScreenHeight Overriding screen height value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|. // // Note: This property is experimental. ScreenHeight *int `json:"screenHeight,omitempty"` // PositionX Overriding view X position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|. // // Note: This property is experimental. PositionX *int `json:"positionX,omitempty"` // PositionY Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|. // // 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. }
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 argument 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). Only used for |mobile==true|.
Note: This argument 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). Only used for |mobile==true|.
Note: This argument 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. Ignored in |fitWindow| mode.
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). Only used for |mobile==true|.
Note: This argument 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). Only used for |mobile==true|.
Note: This argument is experimental.
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 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. // Configuration Touch/gesture events configuration. Default: current platform. // // Values: "mobile", "desktop". Configuration *string `json:"configuration,omitempty"` }
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) SetConfiguration ¶
func (a *SetTouchEmulationEnabledArgs) SetConfiguration(configuration string) *SetTouchEmulationEnabledArgs
SetConfiguration sets the Configuration optional argument. Touch/gesture events configuration. Default: current platform.
Values: "mobile", "desktop".
type SetVirtualTimePolicyArgs ¶
type SetVirtualTimePolicyArgs struct { Policy VirtualTimePolicy `json:"policy"` // No description. Budget *int `json:"budget,omitempty"` // If set, after this many virtual milliseconds have elapsed virtual time will be paused and a virtualTimeBudgetExpired event is sent. }
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 int) *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.
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 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 virual time budget for the current VirtualTimePolicy has run out.
type VirtualTimeBudgetExpiredReply ¶
type VirtualTimeBudgetExpiredReply struct{}
VirtualTimeBudgetExpiredReply is the reply for VirtualTimeBudgetExpired events.
type VirtualTimePolicy ¶
type VirtualTimePolicy int
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 = iota VirtualTimePolicyAdvance VirtualTimePolicyPause VirtualTimePolicyPauseIfNetworkFetchesPending )
VirtualTimePolicy as enums.
func (VirtualTimePolicy) MarshalJSON ¶
func (e VirtualTimePolicy) MarshalJSON() ([]byte, error)
MarshalJSON encodes enum into a string or null when not set.
func (VirtualTimePolicy) String ¶
func (e VirtualTimePolicy) String() string
func (*VirtualTimePolicy) UnmarshalJSON ¶
func (e *VirtualTimePolicy) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes a string value into a enum.
func (VirtualTimePolicy) Valid ¶
func (e VirtualTimePolicy) Valid() bool
Valid returns true if enum is set.