Updating to latest protocol.json

This commit is contained in:
Kenneth Shaw 2017-08-11 09:28:38 +07:00
parent d4c10b0251
commit 28f0ea8563
13 changed files with 814 additions and 99 deletions

View File

@ -56,6 +56,9 @@ const (
CommandMemoryGetDOMCounters MethodType = "Memory.getDOMCounters"
CommandMemorySetPressureNotificationsSuppressed MethodType = "Memory.setPressureNotificationsSuppressed"
CommandMemorySimulatePressureNotification MethodType = "Memory.simulatePressureNotification"
CommandPerformanceEnable MethodType = "Performance.enable"
CommandPerformanceDisable MethodType = "Performance.disable"
CommandPerformanceGetMetrics MethodType = "Performance.getMetrics"
EventPageDomContentEventFired MethodType = "Page.domContentEventFired"
EventPageLoadEventFired MethodType = "Page.loadEventFired"
EventPageFrameAttached MethodType = "Page.frameAttached"
@ -126,6 +129,7 @@ const (
CommandEmulationSetGeolocationOverride MethodType = "Emulation.setGeolocationOverride"
CommandEmulationClearGeolocationOverride MethodType = "Emulation.clearGeolocationOverride"
CommandEmulationSetTouchEmulationEnabled MethodType = "Emulation.setTouchEmulationEnabled"
CommandEmulationSetEmitTouchEventsForMouse MethodType = "Emulation.setEmitTouchEventsForMouse"
CommandEmulationSetEmulatedMedia MethodType = "Emulation.setEmulatedMedia"
CommandEmulationSetCPUThrottlingRate MethodType = "Emulation.setCPUThrottlingRate"
CommandEmulationCanEmulate MethodType = "Emulation.canEmulate"
@ -498,6 +502,12 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandMemorySetPressureNotificationsSuppressed
case CommandMemorySimulatePressureNotification:
*t = CommandMemorySimulatePressureNotification
case CommandPerformanceEnable:
*t = CommandPerformanceEnable
case CommandPerformanceDisable:
*t = CommandPerformanceDisable
case CommandPerformanceGetMetrics:
*t = CommandPerformanceGetMetrics
case EventPageDomContentEventFired:
*t = EventPageDomContentEventFired
case EventPageLoadEventFired:
@ -638,6 +648,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandEmulationClearGeolocationOverride
case CommandEmulationSetTouchEmulationEnabled:
*t = CommandEmulationSetTouchEmulationEnabled
case CommandEmulationSetEmitTouchEventsForMouse:
*t = CommandEmulationSetEmitTouchEventsForMouse
case CommandEmulationSetEmulatedMedia:
*t = CommandEmulationSetEmulatedMedia
case CommandEmulationSetCPUThrottlingRate:

View File

@ -29,6 +29,7 @@ import (
"github.com/knq/chromedp/cdp/network"
"github.com/knq/chromedp/cdp/overlay"
"github.com/knq/chromedp/cdp/page"
"github.com/knq/chromedp/cdp/performance"
"github.com/knq/chromedp/cdp/profiler"
"github.com/knq/chromedp/cdp/runtime"
"github.com/knq/chromedp/cdp/schema"
@ -71,6 +72,15 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandMemorySimulatePressureNotification:
return emptyVal, nil
case cdp.CommandPerformanceEnable:
return emptyVal, nil
case cdp.CommandPerformanceDisable:
return emptyVal, nil
case cdp.CommandPerformanceGetMetrics:
v = new(performance.GetMetricsReturns)
case cdp.CommandPageEnable:
return emptyVal, nil
@ -278,6 +288,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandEmulationSetTouchEmulationEnabled:
return emptyVal, nil
case cdp.CommandEmulationSetEmitTouchEventsForMouse:
return emptyVal, nil
case cdp.CommandEmulationSetEmulatedMedia:
return emptyVal, nil

View File

@ -680,7 +680,10 @@ func GetBackgroundColors(nodeID cdp.NodeID) *GetBackgroundColorsParams {
// GetBackgroundColorsReturns return values.
type GetBackgroundColorsReturns struct {
BackgroundColors []string `json:"backgroundColors,omitempty"` // The range of background colors behind this element, if it contains any visible text. If no visible text is present, this will be undefined. In the case of a flat background color, this will consist of simply that color. In the case of a gradient, this will consist of each of the color stops. For anything more complicated, this will be an empty array. Images will be ignored (as if the image had failed to load).
BackgroundColors []string `json:"backgroundColors,omitempty"` // The range of background colors behind this element, if it contains any visible text. If no visible text is present, this will be undefined. In the case of a flat background color, this will consist of simply that color. In the case of a gradient, this will consist of each of the color stops. For anything more complicated, this will be an empty array. Images will be ignored (as if the image had failed to load).
ComputedFontSize string `json:"computedFontSize,omitempty"` // The computed font size for this node, as a CSS computed value string (e.g. '12px').
ComputedFontWeight string `json:"computedFontWeight,omitempty"` // The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or '100').
ComputedBodyFontSize string `json:"computedBodyFontSize,omitempty"` // The computed font size for the document body, as a computed CSS value string (e.g. '16px').
}
// Do executes CSS.getBackgroundColors against the provided context and
@ -688,15 +691,18 @@ type GetBackgroundColorsReturns struct {
//
// returns:
// backgroundColors - The range of background colors behind this element, if it contains any visible text. If no visible text is present, this will be undefined. In the case of a flat background color, this will consist of simply that color. In the case of a gradient, this will consist of each of the color stops. For anything more complicated, this will be an empty array. Images will be ignored (as if the image had failed to load).
func (p *GetBackgroundColorsParams) Do(ctxt context.Context, h cdp.Handler) (backgroundColors []string, err error) {
// computedFontSize - The computed font size for this node, as a CSS computed value string (e.g. '12px').
// computedFontWeight - The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or '100').
// computedBodyFontSize - The computed font size for the document body, as a computed CSS value string (e.g. '16px').
func (p *GetBackgroundColorsParams) Do(ctxt context.Context, h cdp.Handler) (backgroundColors []string, computedFontSize string, computedFontWeight string, computedBodyFontSize string, err error) {
// execute
var res GetBackgroundColorsReturns
err = h.Execute(ctxt, cdp.CommandCSSGetBackgroundColors, p, &res)
if err != nil {
return nil, err
return nil, "", "", "", err
}
return res.BackgroundColors, nil
return res.BackgroundColors, res.ComputedFontSize, res.ComputedFontWeight, res.ComputedBodyFontSize, nil
}
// StartRuleUsageTrackingParams enables the selector recording.

View File

@ -5130,6 +5130,12 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpCss48(in *jlexer.Lexer, out *G
}
in.Delim(']')
}
case "computedFontSize":
out.ComputedFontSize = string(in.String())
case "computedFontWeight":
out.ComputedFontWeight = string(in.String())
case "computedBodyFontSize":
out.ComputedBodyFontSize = string(in.String())
default:
in.SkipRecursive()
}
@ -5163,6 +5169,30 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpCss48(out *jwriter.Writer, in
out.RawByte(']')
}
}
if in.ComputedFontSize != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"computedFontSize\":")
out.String(string(in.ComputedFontSize))
}
if in.ComputedFontWeight != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"computedFontWeight\":")
out.String(string(in.ComputedFontWeight))
}
if in.ComputedBodyFontSize != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"computedBodyFontSize\":")
out.String(string(in.ComputedBodyFontSize))
}
out.RawByte('}')
}

View File

@ -28,7 +28,7 @@ type DOMNode struct {
DocumentEncoding string `json:"documentEncoding,omitempty"` // Only set for documents, contains the document's character set encoding.
PublicID string `json:"publicId,omitempty"` // DocumentType node's publicId.
SystemID string `json:"systemId,omitempty"` // DocumentType node's systemId.
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame ID for frame owner elements.
FrameID cdp.FrameID `json:"frameId,omitempty"` // Frame ID for frame owner elements and also for the document node.
ContentDocumentIndex int64 `json:"contentDocumentIndex,omitempty"` // The index of a frame owner element's content document in the domNodes array returned by getSnapshot, if any.
ImportedDocumentIndex int64 `json:"importedDocumentIndex,omitempty"` // Index of the imported document's node of a link element in the domNodes array returned by getSnapshot, if any.
TemplateContentIndex int64 `json:"templateContentIndex,omitempty"` // Index of the content node of a template element in the domNodes array returned by getSnapshot.

View File

@ -116,8 +116,8 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation1(in *jlexer.Lexer, o
switch key {
case "enabled":
out.Enabled = bool(in.Bool())
case "configuration":
(out.Configuration).UnmarshalEasyJSON(in)
case "maxTouchPoints":
out.MaxTouchPoints = int64(in.Int64())
default:
in.SkipRecursive()
}
@ -138,13 +138,13 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation1(out *jwriter.Writer
first = false
out.RawString("\"enabled\":")
out.Bool(bool(in.Enabled))
if in.Configuration != "" {
if in.MaxTouchPoints != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"configuration\":")
(in.Configuration).MarshalEasyJSON(out)
out.RawString("\"maxTouchPoints\":")
out.Int64(int64(in.MaxTouchPoints))
}
out.RawByte('}')
}
@ -462,7 +462,84 @@ func (v *SetEmulatedMediaParams) UnmarshalJSON(data []byte) error {
func (v *SetEmulatedMediaParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation5(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation6(in *jlexer.Lexer, out *SetDeviceMetricsOverrideParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation6(in *jlexer.Lexer, out *SetEmitTouchEventsForMouseParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "enabled":
out.Enabled = bool(in.Bool())
case "configuration":
(out.Configuration).UnmarshalEasyJSON(in)
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation6(out *jwriter.Writer, in SetEmitTouchEventsForMouseParams) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"enabled\":")
out.Bool(bool(in.Enabled))
if in.Configuration != "" {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"configuration\":")
(in.Configuration).MarshalEasyJSON(out)
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetEmitTouchEventsForMouseParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation6(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetEmitTouchEventsForMouseParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation6(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetEmitTouchEventsForMouseParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation6(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetEmitTouchEventsForMouseParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation6(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation7(in *jlexer.Lexer, out *SetDeviceMetricsOverrideParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -521,7 +598,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation6(in *jlexer.Lexer, o
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation6(out *jwriter.Writer, in SetDeviceMetricsOverrideParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation7(out *jwriter.Writer, in SetDeviceMetricsOverrideParams) {
out.RawByte('{')
first := true
_ = first
@ -615,27 +692,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation6(out *jwriter.Writer
// MarshalJSON supports json.Marshaler interface
func (v SetDeviceMetricsOverrideParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation6(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation7(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetDeviceMetricsOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation6(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation7(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetDeviceMetricsOverrideParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation6(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation7(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetDeviceMetricsOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation6(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation7(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation7(in *jlexer.Lexer, out *SetDefaultBackgroundColorOverrideParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(in *jlexer.Lexer, out *SetDefaultBackgroundColorOverrideParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -674,7 +751,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation7(in *jlexer.Lexer, o
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation7(out *jwriter.Writer, in SetDefaultBackgroundColorOverrideParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(out *jwriter.Writer, in SetDefaultBackgroundColorOverrideParams) {
out.RawByte('{')
first := true
_ = first
@ -696,27 +773,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation7(out *jwriter.Writer
// MarshalJSON supports json.Marshaler interface
func (v SetDefaultBackgroundColorOverrideParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation7(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetDefaultBackgroundColorOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation7(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetDefaultBackgroundColorOverrideParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation7(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetDefaultBackgroundColorOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation7(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(in *jlexer.Lexer, out *SetCPUThrottlingRateParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(in *jlexer.Lexer, out *SetCPUThrottlingRateParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -747,7 +824,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(in *jlexer.Lexer, o
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(out *jwriter.Writer, in SetCPUThrottlingRateParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(out *jwriter.Writer, in SetCPUThrottlingRateParams) {
out.RawByte('{')
first := true
_ = first
@ -763,27 +840,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(out *jwriter.Writer
// MarshalJSON supports json.Marshaler interface
func (v SetCPUThrottlingRateParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetCPUThrottlingRateParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetCPUThrottlingRateParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetCPUThrottlingRateParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(in *jlexer.Lexer, out *ScreenOrientation) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(in *jlexer.Lexer, out *ScreenOrientation) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -816,7 +893,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(in *jlexer.Lexer, o
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(out *jwriter.Writer, in ScreenOrientation) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(out *jwriter.Writer, in ScreenOrientation) {
out.RawByte('{')
first := true
_ = first
@ -838,27 +915,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(out *jwriter.Writer
// MarshalJSON supports json.Marshaler interface
func (v ScreenOrientation) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ScreenOrientation) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ScreenOrientation) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ScreenOrientation) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(in *jlexer.Lexer, out *ResetPageScaleFactorParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(in *jlexer.Lexer, out *ResetPageScaleFactorParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -887,7 +964,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(out *jwriter.Writer, in ResetPageScaleFactorParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(out *jwriter.Writer, in ResetPageScaleFactorParams) {
out.RawByte('{')
first := true
_ = first
@ -897,27 +974,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface
func (v ResetPageScaleFactorParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ResetPageScaleFactorParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ResetPageScaleFactorParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ResetPageScaleFactorParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(in *jlexer.Lexer, out *EventVirtualTimeBudgetExpired) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(in *jlexer.Lexer, out *EventVirtualTimeBudgetExpired) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -946,7 +1023,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(out *jwriter.Writer, in EventVirtualTimeBudgetExpired) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(out *jwriter.Writer, in EventVirtualTimeBudgetExpired) {
out.RawByte('{')
first := true
_ = first
@ -956,27 +1033,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface
func (v EventVirtualTimeBudgetExpired) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventVirtualTimeBudgetExpired) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EventVirtualTimeBudgetExpired) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventVirtualTimeBudgetExpired) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(in *jlexer.Lexer, out *ClearGeolocationOverrideParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(in *jlexer.Lexer, out *ClearGeolocationOverrideParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -1005,7 +1082,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(out *jwriter.Writer, in ClearGeolocationOverrideParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(out *jwriter.Writer, in ClearGeolocationOverrideParams) {
out.RawByte('{')
first := true
_ = first
@ -1015,27 +1092,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface
func (v ClearGeolocationOverrideParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ClearGeolocationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ClearGeolocationOverrideParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ClearGeolocationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(in *jlexer.Lexer, out *ClearDeviceMetricsOverrideParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(in *jlexer.Lexer, out *ClearDeviceMetricsOverrideParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -1064,7 +1141,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(out *jwriter.Writer, in ClearDeviceMetricsOverrideParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(out *jwriter.Writer, in ClearDeviceMetricsOverrideParams) {
out.RawByte('{')
first := true
_ = first
@ -1074,27 +1151,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface
func (v ClearDeviceMetricsOverrideParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v ClearDeviceMetricsOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *ClearDeviceMetricsOverrideParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ClearDeviceMetricsOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(in *jlexer.Lexer, out *CanEmulateReturns) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(in *jlexer.Lexer, out *CanEmulateReturns) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -1125,7 +1202,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(out *jwriter.Writer, in CanEmulateReturns) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(out *jwriter.Writer, in CanEmulateReturns) {
out.RawByte('{')
first := true
_ = first
@ -1143,27 +1220,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface
func (v CanEmulateReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v CanEmulateReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *CanEmulateReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CanEmulateReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(in *jlexer.Lexer, out *CanEmulateParams) {
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(in *jlexer.Lexer, out *CanEmulateParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
@ -1192,7 +1269,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(in *jlexer.Lexer,
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(out *jwriter.Writer, in CanEmulateParams) {
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(out *jwriter.Writer, in CanEmulateParams) {
out.RawByte('{')
first := true
_ = first
@ -1202,23 +1279,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface
func (v CanEmulateParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(&w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v CanEmulateParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(w, v)
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *CanEmulateParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(&r, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CanEmulateParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(l, v)
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(l, v)
}

View File

@ -233,14 +233,15 @@ func (p *ClearGeolocationOverrideParams) Do(ctxt context.Context, h cdp.Handler)
return h.Execute(ctxt, cdp.CommandEmulationClearGeolocationOverride, nil, nil)
}
// SetTouchEmulationEnabledParams toggles mouse event-based touch event
// emulation.
// SetTouchEmulationEnabledParams enables touch on platforms which do not
// support them.
type SetTouchEmulationEnabledParams struct {
Enabled bool `json:"enabled"` // Whether the touch event emulation should be enabled.
Configuration EnabledConfiguration `json:"configuration,omitempty"` // Touch/gesture events configuration. Default: current platform.
Enabled bool `json:"enabled"` // Whether the touch event emulation should be enabled.
MaxTouchPoints int64 `json:"maxTouchPoints,omitempty"` // Maximum touch points supported. Defaults to one.
}
// SetTouchEmulationEnabled toggles mouse event-based touch event emulation.
// SetTouchEmulationEnabled enables touch on platforms which do not support
// them.
//
// parameters:
// enabled - Whether the touch event emulation should be enabled.
@ -250,10 +251,9 @@ func SetTouchEmulationEnabled(enabled bool) *SetTouchEmulationEnabledParams {
}
}
// WithConfiguration touch/gesture events configuration. Default: current
// platform.
func (p SetTouchEmulationEnabledParams) WithConfiguration(configuration EnabledConfiguration) *SetTouchEmulationEnabledParams {
p.Configuration = configuration
// WithMaxTouchPoints maximum touch points supported. Defaults to one.
func (p SetTouchEmulationEnabledParams) WithMaxTouchPoints(maxTouchPoints int64) *SetTouchEmulationEnabledParams {
p.MaxTouchPoints = maxTouchPoints
return &p
}
@ -263,6 +263,35 @@ func (p *SetTouchEmulationEnabledParams) Do(ctxt context.Context, h cdp.Handler)
return h.Execute(ctxt, cdp.CommandEmulationSetTouchEmulationEnabled, p, nil)
}
// SetEmitTouchEventsForMouseParams [no description].
type SetEmitTouchEventsForMouseParams struct {
Enabled bool `json:"enabled"` // Whether touch emulation based on mouse input should be enabled.
Configuration SetEmitTouchEventsForMouseConfiguration `json:"configuration,omitempty"` // Touch/gesture events configuration. Default: current platform.
}
// SetEmitTouchEventsForMouse [no description].
//
// parameters:
// enabled - Whether touch emulation based on mouse input should be enabled.
func SetEmitTouchEventsForMouse(enabled bool) *SetEmitTouchEventsForMouseParams {
return &SetEmitTouchEventsForMouseParams{
Enabled: enabled,
}
}
// WithConfiguration touch/gesture events configuration. Default: current
// platform.
func (p SetEmitTouchEventsForMouseParams) WithConfiguration(configuration SetEmitTouchEventsForMouseConfiguration) *SetEmitTouchEventsForMouseParams {
p.Configuration = configuration
return &p
}
// Do executes Emulation.setEmitTouchEventsForMouse against the provided context and
// target handler.
func (p *SetEmitTouchEventsForMouseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandEmulationSetEmitTouchEventsForMouse, p, nil)
}
// SetEmulatedMediaParams emulates the given media for CSS media queries.
type SetEmulatedMediaParams struct {
Media string `json:"media"` // Media type to emulate. Empty string disables the override.

View File

@ -113,45 +113,45 @@ func (t *OrientationType) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// EnabledConfiguration touch/gesture events configuration. Default: current
// platform.
type EnabledConfiguration string
// SetEmitTouchEventsForMouseConfiguration touch/gesture events
// configuration. Default: current platform.
type SetEmitTouchEventsForMouseConfiguration string
// String returns the EnabledConfiguration as string value.
func (t EnabledConfiguration) String() string {
// String returns the SetEmitTouchEventsForMouseConfiguration as string value.
func (t SetEmitTouchEventsForMouseConfiguration) String() string {
return string(t)
}
// EnabledConfiguration values.
// SetEmitTouchEventsForMouseConfiguration values.
const (
EnabledConfigurationMobile EnabledConfiguration = "mobile"
EnabledConfigurationDesktop EnabledConfiguration = "desktop"
SetEmitTouchEventsForMouseConfigurationMobile SetEmitTouchEventsForMouseConfiguration = "mobile"
SetEmitTouchEventsForMouseConfigurationDesktop SetEmitTouchEventsForMouseConfiguration = "desktop"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t EnabledConfiguration) MarshalEasyJSON(out *jwriter.Writer) {
func (t SetEmitTouchEventsForMouseConfiguration) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t EnabledConfiguration) MarshalJSON() ([]byte, error) {
func (t SetEmitTouchEventsForMouseConfiguration) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *EnabledConfiguration) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch EnabledConfiguration(in.String()) {
case EnabledConfigurationMobile:
*t = EnabledConfigurationMobile
case EnabledConfigurationDesktop:
*t = EnabledConfigurationDesktop
func (t *SetEmitTouchEventsForMouseConfiguration) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch SetEmitTouchEventsForMouseConfiguration(in.String()) {
case SetEmitTouchEventsForMouseConfigurationMobile:
*t = SetEmitTouchEventsForMouseConfigurationMobile
case SetEmitTouchEventsForMouseConfigurationDesktop:
*t = SetEmitTouchEventsForMouseConfigurationDesktop
default:
in.AddError(errors.New("unknown EnabledConfiguration value"))
in.AddError(errors.New("unknown SetEmitTouchEventsForMouseConfiguration value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *EnabledConfiguration) UnmarshalJSON(buf []byte) error {
func (t *SetEmitTouchEventsForMouseConfiguration) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}

384
cdp/performance/easyjson.go Normal file
View File

@ -0,0 +1,384 @@
// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
package performance
import (
json "encoding/json"
easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter"
)
// suppress unused package warning
var (
_ *json.RawMessage
_ *jlexer.Lexer
_ *jwriter.Writer
_ easyjson.Marshaler
)
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance(in *jlexer.Lexer, out *Metric) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "name":
out.Name = string(in.String())
case "value":
out.Value = float64(in.Float64())
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance(out *jwriter.Writer, in Metric) {
out.RawByte('{')
first := true
_ = first
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"name\":")
out.String(string(in.Name))
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"value\":")
out.Float64(float64(in.Value))
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v Metric) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v Metric) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *Metric) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *Metric) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance1(in *jlexer.Lexer, out *GetMetricsReturns) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "metrics":
if in.IsNull() {
in.Skip()
out.Metrics = nil
} else {
in.Delim('[')
if out.Metrics == nil {
if !in.IsDelim(']') {
out.Metrics = make([]*Metric, 0, 8)
} else {
out.Metrics = []*Metric{}
}
} else {
out.Metrics = (out.Metrics)[:0]
}
for !in.IsDelim(']') {
var v1 *Metric
if in.IsNull() {
in.Skip()
v1 = nil
} else {
if v1 == nil {
v1 = new(Metric)
}
(*v1).UnmarshalEasyJSON(in)
}
out.Metrics = append(out.Metrics, v1)
in.WantComma()
}
in.Delim(']')
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance1(out *jwriter.Writer, in GetMetricsReturns) {
out.RawByte('{')
first := true
_ = first
if len(in.Metrics) != 0 {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"metrics\":")
if in.Metrics == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
out.RawString("null")
} else {
out.RawByte('[')
for v2, v3 := range in.Metrics {
if v2 > 0 {
out.RawByte(',')
}
if v3 == nil {
out.RawString("null")
} else {
(*v3).MarshalEasyJSON(out)
}
}
out.RawByte(']')
}
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetMetricsReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance1(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetMetricsReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance1(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetMetricsReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance1(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetMetricsReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance1(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance2(in *jlexer.Lexer, out *GetMetricsParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance2(out *jwriter.Writer, in GetMetricsParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v GetMetricsParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance2(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v GetMetricsParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance2(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *GetMetricsParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance2(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *GetMetricsParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance2(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance3(in *jlexer.Lexer, out *EnableParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance3(out *jwriter.Writer, in EnableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v EnableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance3(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v EnableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance3(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *EnableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance3(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EnableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance3(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance4(in *jlexer.Lexer, out *DisableParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance4(out *jwriter.Writer, in DisableParams) {
out.RawByte('{')
first := true
_ = first
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v DisableParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance4(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v DisableParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpPerformance4(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *DisableParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance4(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *DisableParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpPerformance4(l, v)
}

View File

@ -0,0 +1,70 @@
// Package performance provides the Chrome Debugging Protocol
// commands, types, and events for the Performance domain.
//
// Generated by the chromedp-gen command.
package performance
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
)
// EnableParams enable collecting and reporting metrics.
type EnableParams struct{}
// Enable enable collecting and reporting metrics.
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Performance.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandPerformanceEnable, nil, nil)
}
// DisableParams disable collecting and reporting metrics.
type DisableParams struct{}
// Disable disable collecting and reporting metrics.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Performance.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandPerformanceDisable, nil, nil)
}
// GetMetricsParams retrieve current values of run-time metrics.
type GetMetricsParams struct{}
// GetMetrics retrieve current values of run-time metrics.
func GetMetrics() *GetMetricsParams {
return &GetMetricsParams{}
}
// GetMetricsReturns return values.
type GetMetricsReturns struct {
Metrics []*Metric `json:"metrics,omitempty"` // Current values for run-time metrics.
}
// Do executes Performance.getMetrics against the provided context and
// target handler.
//
// returns:
// metrics - Current values for run-time metrics.
func (p *GetMetricsParams) Do(ctxt context.Context, h cdp.Handler) (metrics []*Metric, err error) {
// execute
var res GetMetricsReturns
err = h.Execute(ctxt, cdp.CommandPerformanceGetMetrics, nil, &res)
if err != nil {
return nil, err
}
return res.Metrics, nil
}

9
cdp/performance/types.go Normal file
View File

@ -0,0 +1,9 @@
package performance
// Code generated by chromedp-gen. DO NOT EDIT.
// Metric run-time execution metric.
type Metric struct {
Name string `json:"name"` // Metric name.
Value float64 `json:"value"` // Metric value.
}

View File

@ -39,6 +39,7 @@ const (
DomainNetwork DomainType = "Network"
DomainOverlay DomainType = "Overlay"
DomainPage DomainType = "Page"
DomainPerformance DomainType = "Performance"
DomainProfiler DomainType = "Profiler"
DomainRuntime DomainType = "Runtime"
DomainSchema DomainType = "Schema"
@ -123,6 +124,8 @@ func (dt *DomainType) UnmarshalJSON(buf []byte) error {
*dt = DomainOverlay
case DomainPage:
*dt = DomainPage
case DomainPerformance:
*dt = DomainPerformance
case DomainProfiler:
*dt = DomainProfiler
case DomainRuntime:

View File

@ -92,6 +92,53 @@
}
]
},
{
"domain": "Performance",
"experimental": true,
"types": [
{
"id": "Metric",
"type": "object",
"properties": [
{
"name": "name",
"type": "string",
"description": "Metric name."
},
{
"name": "value",
"type": "number",
"description": "Metric value."
}
],
"description": "Run-time execution metric."
}
],
"commands": [
{
"name": "enable",
"description": "Enable collecting and reporting metrics."
},
{
"name": "disable",
"description": "Disable collecting and reporting metrics."
},
{
"name": "getMetrics",
"returns": [
{
"name": "metrics",
"type": "array",
"items": {
"$ref": "Metric"
},
"description": "Current values for run-time metrics."
}
],
"description": "Retrieve current values of run-time metrics."
}
]
},
{
"domain": "Page",
"description": "Actions and events related to the inspected page belong to the page domain.",
@ -2090,6 +2137,23 @@
"type": "boolean",
"description": "Whether the touch event emulation should be enabled."
},
{
"name": "maxTouchPoints",
"type": "integer",
"optional": true,
"description": "Maximum touch points supported. Defaults to one."
}
],
"description": "Enables touch on platforms which do not support them."
},
{
"name": "setEmitTouchEventsForMouse",
"parameters": [
{
"name": "enabled",
"type": "boolean",
"description": "Whether touch emulation based on mouse input should be enabled."
},
{
"name": "configuration",
"type": "string",
@ -2101,7 +2165,7 @@
"description": "Touch/gesture events configuration. Default: current platform."
}
],
"description": "Toggles mouse event-based touch event emulation."
"experimental": true
},
{
"name": "setEmulatedMedia",
@ -7488,6 +7552,24 @@
},
"description": "The range of background colors behind this element, if it contains any visible text. If no visible text is present, this will be undefined. In the case of a flat background color, this will consist of simply that color. In the case of a gradient, this will consist of each of the color stops. For anything more complicated, this will be an empty array. Images will be ignored (as if the image had failed to load).",
"optional": true
},
{
"name": "computedFontSize",
"type": "string",
"description": "The computed font size for this node, as a CSS computed value string (e.g. '12px').",
"optional": true
},
{
"name": "computedFontWeight",
"type": "string",
"description": "The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or '100').",
"optional": true
},
{
"name": "computedBodyFontSize",
"type": "string",
"description": "The computed font size for the document body, as a computed CSS value string (e.g. '16px').",
"optional": true
}
],
"experimental": true
@ -7700,7 +7782,7 @@
"name": "frameId",
"$ref": "Page.FrameId",
"optional": true,
"description": "Frame ID for frame owner elements."
"description": "Frame ID for frame owner elements and also for the document node."
},
{
"name": "contentDocumentIndex",