emulation

package
v0.11.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package emulation implements the Emulation domain. This domain emulates different environments for the page.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(conn *rpcc.Conn) *domainClient

NewClient returns a client for the Emulation domain with the connection set to conn.

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

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

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

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

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 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

SetAccuracy sets the Accuracy optional argument. Mock accuracy

func (*SetGeolocationOverrideArgs) SetLatitude

SetLatitude sets the Latitude optional argument. Mock latitude

func (*SetGeolocationOverrideArgs) SetLongitude

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.
	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 *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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL