emulation

package
v0.19.3 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2018 License: MIT Imports: 6 Imported by: 15

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

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

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

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

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 SetDocumentCookieDisabledArgs added in v0.18.4

type SetDocumentCookieDisabledArgs struct {
	Disabled bool `json:"disabled"` // Whether document.coookie API should be disabled.
}

SetDocumentCookieDisabledArgs represents the arguments for SetDocumentCookieDisabled in the Emulation domain.

func NewSetDocumentCookieDisabledArgs added in v0.18.4

func NewSetDocumentCookieDisabledArgs(disabled bool) *SetDocumentCookieDisabledArgs

NewSetDocumentCookieDisabledArgs initializes SetDocumentCookieDisabledArgs with the required arguments.

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 SetFocusEmulationEnabledArgs added in v0.19.1

type SetFocusEmulationEnabledArgs struct {
	Enabled bool `json:"enabled"` // Whether to enable to disable focus emulation.
}

SetFocusEmulationEnabledArgs represents the arguments for SetFocusEmulationEnabled in the Emulation domain.

func NewSetFocusEmulationEnabledArgs added in v0.19.1

func NewSetFocusEmulationEnabledArgs(enabled bool) *SetFocusEmulationEnabledArgs

NewSetFocusEmulationEnabledArgs initializes SetFocusEmulationEnabledArgs 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 SetNavigatorOverridesArgs added in v0.13.1

type SetNavigatorOverridesArgs struct {
	Platform string `json:"platform"` // The platform navigator.platform should return.
}

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 SetScrollbarsHiddenArgs added in v0.18.3

type SetScrollbarsHiddenArgs struct {
	Hidden bool `json:"hidden"` // Whether scrollbars should be always hidden.
}

SetScrollbarsHiddenArgs represents the arguments for SetScrollbarsHidden in the Emulation domain.

func NewSetScrollbarsHiddenArgs added in v0.18.3

func NewSetScrollbarsHiddenArgs(hidden bool) *SetScrollbarsHiddenArgs

NewSetScrollbarsHiddenArgs initializes SetScrollbarsHiddenArgs 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 SetUserAgentOverrideArgs added in v0.18.3

type SetUserAgentOverrideArgs struct {
	UserAgent      string  `json:"userAgent"`                // User agent to use.
	AcceptLanguage *string `json:"acceptLanguage,omitempty"` // Browser langugage to emulate.
	Platform       *string `json:"platform,omitempty"`       // The platform navigator.platform should return.
}

SetUserAgentOverrideArgs represents the arguments for SetUserAgentOverride in the Emulation domain.

func NewSetUserAgentOverrideArgs added in v0.18.3

func NewSetUserAgentOverrideArgs(userAgent string) *SetUserAgentOverrideArgs

NewSetUserAgentOverrideArgs initializes SetUserAgentOverrideArgs with the required arguments.

func (*SetUserAgentOverrideArgs) SetAcceptLanguage added in v0.18.3

func (a *SetUserAgentOverrideArgs) SetAcceptLanguage(acceptLanguage string) *SetUserAgentOverrideArgs

SetAcceptLanguage sets the AcceptLanguage optional argument. Browser langugage to emulate.

func (*SetUserAgentOverrideArgs) SetPlatform added in v0.18.3

func (a *SetUserAgentOverrideArgs) SetPlatform(platform string) *SetUserAgentOverrideArgs

SetPlatform sets the Platform optional argument. The platform navigator.platform should return.

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.
	WaitForNavigation                 *bool                  `json:"waitForNavigation,omitempty"`                 // If set the virtual time policy change should be deferred until any frame starts navigating. Note any previous deferred policy change is superseded.
	InitialVirtualTime                network.TimeSinceEpoch `json:"initialVirtualTime,omitempty"`                // If set, base::Time::Now will be overridden to initially return this value.
}

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.

func (*SetVirtualTimePolicyArgs) SetInitialVirtualTime added in v0.18.2

func (a *SetVirtualTimePolicyArgs) SetInitialVirtualTime(initialVirtualTime network.TimeSinceEpoch) *SetVirtualTimePolicyArgs

SetInitialVirtualTime sets the InitialVirtualTime optional argument. If set, base::Time::Now will be overridden to initially return this value.

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

Jump to

Keyboard shortcuts

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