emulation

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 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 ForceViewportArgs

type ForceViewportArgs struct {
	X     float64 `json:"x"`     // X coordinate of top-left corner of the area (CSS pixels).
	Y     float64 `json:"y"`     // Y coordinate of top-left corner of the area (CSS pixels).
	Scale float64 `json:"scale"` // Scale to apply to the area (relative to a page scale of 1.0).
}

ForceViewportArgs represents the arguments for ForceViewport in the Emulation domain.

func NewForceViewportArgs

func NewForceViewportArgs(x float64, y float64, scale float64) *ForceViewportArgs

NewForceViewportArgs initializes ForceViewportArgs with the required arguments.

type ScreenOrientation

type ScreenOrientation struct {
	Type  string `json:"type"`  // Orientation 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.
	FitWindow         bool               `json:"fitWindow"`                   // Whether a view that exceeds the available browser window area should be scaled down to fit.
	Scale             *float64           `json:"scale,omitempty"`             // Scale to apply to resulting view image. Ignored in |fitWindow| mode.
	OffsetX           *float64           `json:"offsetX,omitempty"`           // Not used.
	OffsetY           *float64           `json:"offsetY,omitempty"`           // Not used.
	ScreenWidth       *int               `json:"screenWidth,omitempty"`       // Overriding screen width value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.
	ScreenHeight      *int               `json:"screenHeight,omitempty"`      // Overriding screen height value in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.
	PositionX         *int               `json:"positionX,omitempty"`         // Overriding view X position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.
	PositionY         *int               `json:"positionY,omitempty"`         // Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). Only used for |mobile==true|.
	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, fitWindow bool) *SetDeviceMetricsOverrideArgs

NewSetDeviceMetricsOverrideArgs initializes SetDeviceMetricsOverrideArgs with the required arguments.

func (*SetDeviceMetricsOverrideArgs) SetOffsetX

SetOffsetX sets the OffsetX optional argument. Not used.

func (*SetDeviceMetricsOverrideArgs) SetOffsetY

SetOffsetY sets the OffsetY optional argument. Not used.

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

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

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

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

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.
	Configuration *string `json:"configuration,omitempty"` // Touch/gesture events configuration. Default: current platform.
}

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.

type SetVirtualTimePolicyArgs

type SetVirtualTimePolicyArgs struct {
	Policy VirtualTimePolicy `json:"policy"`           //
	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.

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