Skip to content

Commit 7f44d39

Browse files
author
=
committed
actually download new protocol files, fix flakey test
1 parent 8ac64a5 commit 7f44d39

37 files changed

+2550
-462
lines changed

v2/gcd_test.go

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -481,35 +481,13 @@ func TestConnectToInstance(t *testing.T) {
481481
testDefaultStartup(t)
482482
defer debugger.ExitProcess()
483483

484-
doneCh := make(chan error)
485-
486-
go testTimeoutListener(doneCh, 15, "timed out waiting for remote connection")
487-
488-
go func() {
489-
remoteDebugger := NewChromeDebugger()
490-
remoteDebugger.ConnectToInstance(debugger.host, debugger.port)
491-
492-
_, err := remoteDebugger.NewTab()
493-
if err != nil {
494-
t.Fatalf("error creating new tab")
495-
}
484+
remoteDebugger := NewChromeDebugger()
485+
t.Logf("connecting to %s:%s", debugger.host, debugger.port)
486+
remoteDebugger.ConnectToInstance(debugger.host, debugger.port)
496487

497-
targets, error := remoteDebugger.GetTargets()
498-
if error != nil {
499-
t.Fatalf("cannot get targets: %s \n", error)
500-
}
501-
if len(targets) <= 0 {
502-
t.Fatalf("invalid number of targets, got: %d\n", len(targets))
503-
}
504-
for _, target := range targets {
505-
t.Logf("page: %s\n", target.Target.Url)
506-
}
507-
close(doneCh)
508-
}()
509-
510-
err := <-doneCh
488+
_, err := remoteDebugger.NewTab()
511489
if err != nil {
512-
t.Fatal(err)
490+
t.Fatalf("error creating new tab")
513491
}
514492
}
515493

v2/gcdapi/accessibility.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type AccessibilityAXValueSource struct {
1616
Attribute string `json:"attribute,omitempty"` // The name of the relevant attribute, if any.
1717
AttributeValue *AccessibilityAXValue `json:"attributeValue,omitempty"` // The value of the relevant attribute, if any.
1818
Superseded bool `json:"superseded,omitempty"` // Whether this source is superseded by a higher priority source.
19-
NativeSource string `json:"nativeSource,omitempty"` // The native markup source for this value, e.g. a <label> element. enum values: description, figcaption, label, labelfor, labelwrapped, legend, rubyannotation, tablecaption, title, other
19+
NativeSource string `json:"nativeSource,omitempty"` // The native markup source for this value, e.g. a `<label>` element. enum values: description, figcaption, label, labelfor, labelwrapped, legend, rubyannotation, tablecaption, title, other
2020
NativeSourceValue *AccessibilityAXValue `json:"nativeSourceValue,omitempty"` // The value, such as a node or node list, of the native source.
2121
Invalid bool `json:"invalid,omitempty"` // Whether the value for this property is invalid.
2222
InvalidReason string `json:"invalidReason,omitempty"` // Reason for the value being invalid, if it is.
@@ -31,7 +31,7 @@ type AccessibilityAXRelatedNode struct {
3131

3232
// No Description.
3333
type AccessibilityAXProperty struct {
34-
Name string `json:"name"` // The name of this property. enum values: busy, disabled, editable, focusable, focused, hidden, hiddenRoot, invalid, keyshortcuts, settable, roledescription, live, atomic, relevant, root, autocomplete, hasPopup, level, multiselectable, orientation, multiline, readonly, required, valuemin, valuemax, valuetext, checked, expanded, modal, pressed, selected, activedescendant, controls, describedby, details, errormessage, flowto, labelledby, owns
34+
Name string `json:"name"` // The name of this property. enum values: busy, disabled, editable, focusable, focused, hidden, hiddenRoot, invalid, keyshortcuts, settable, roledescription, live, atomic, relevant, root, autocomplete, hasPopup, level, multiselectable, orientation, multiline, readonly, required, valuemin, valuemax, valuetext, checked, expanded, modal, pressed, selected, activedescendant, controls, describedby, details, errormessage, flowto, labelledby, owns, url
3535
Value *AccessibilityAXValue `json:"value"` // The value of this property.
3636
}
3737

@@ -154,7 +154,7 @@ func (c *Accessibility) GetPartialAXTree(ctx context.Context, nodeId int, backen
154154
type AccessibilityGetFullAXTreeParams struct {
155155
// The maximum depth at which descendants of the root node should be retrieved. If omitted, the full tree is returned.
156156
Depth int `json:"depth,omitempty"`
157-
// The frame for whose document the AX tree should be retrieved. If omited, the root frame is used.
157+
// The frame for whose document the AX tree should be retrieved. If omitted, the root frame is used.
158158
FrameId string `json:"frameId,omitempty"`
159159
}
160160

@@ -190,7 +190,7 @@ func (c *Accessibility) GetFullAXTreeWithParams(ctx context.Context, v *Accessib
190190

191191
// GetFullAXTree - Fetches the entire accessibility tree for the root Document
192192
// depth - The maximum depth at which descendants of the root node should be retrieved. If omitted, the full tree is returned.
193-
// frameId - The frame for whose document the AX tree should be retrieved. If omited, the root frame is used.
193+
// frameId - The frame for whose document the AX tree should be retrieved. If omitted, the root frame is used.
194194
// Returns - nodes -
195195
func (c *Accessibility) GetFullAXTree(ctx context.Context, depth int, frameId string) ([]*AccessibilityAXNode, error) {
196196
var v AccessibilityGetFullAXTreeParams
@@ -356,7 +356,7 @@ type AccessibilityQueryAXTreeParams struct {
356356
Role string `json:"role,omitempty"`
357357
}
358358

359-
// QueryAXTreeWithParams - Query a DOM node's accessibility subtree for accessible name and role. This command computes the name and role for all nodes in the subtree, including those that are ignored for accessibility, and returns those that mactch the specified name and role. If no DOM node is specified, or the DOM node does not exist, the command returns an error. If neither `accessibleName` or `role` is specified, it returns all the accessibility nodes in the subtree.
359+
// QueryAXTreeWithParams - Query a DOM node's accessibility subtree for accessible name and role. This command computes the name and role for all nodes in the subtree, including those that are ignored for accessibility, and returns those that match the specified name and role. If no DOM node is specified, or the DOM node does not exist, the command returns an error. If neither `accessibleName` or `role` is specified, it returns all the accessibility nodes in the subtree.
360360
// Returns - nodes - A list of `Accessibility.AXNode` matching the specified attributes, including nodes that are ignored for accessibility.
361361
func (c *Accessibility) QueryAXTreeWithParams(ctx context.Context, v *AccessibilityQueryAXTreeParams) ([]*AccessibilityAXNode, error) {
362362
resp, err := c.target.SendCustomReturn(ctx, &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Accessibility.queryAXTree", Params: v})
@@ -386,7 +386,7 @@ func (c *Accessibility) QueryAXTreeWithParams(ctx context.Context, v *Accessibil
386386
return chromeData.Result.Nodes, nil
387387
}
388388

389-
// QueryAXTree - Query a DOM node's accessibility subtree for accessible name and role. This command computes the name and role for all nodes in the subtree, including those that are ignored for accessibility, and returns those that mactch the specified name and role. If no DOM node is specified, or the DOM node does not exist, the command returns an error. If neither `accessibleName` or `role` is specified, it returns all the accessibility nodes in the subtree.
389+
// QueryAXTree - Query a DOM node's accessibility subtree for accessible name and role. This command computes the name and role for all nodes in the subtree, including those that are ignored for accessibility, and returns those that match the specified name and role. If no DOM node is specified, or the DOM node does not exist, the command returns an error. If neither `accessibleName` or `role` is specified, it returns all the accessibility nodes in the subtree.
390390
// nodeId - Identifier of the node for the root to query.
391391
// backendNodeId - Identifier of the backend node for the root to query.
392392
// objectId - JavaScript object id of the node wrapper for the root to query.

v2/gcdapi/animation.go

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,26 @@ import (
1111

1212
// Animation instance.
1313
type AnimationAnimation struct {
14-
Id string `json:"id"` // `Animation`'s id.
15-
Name string `json:"name"` // `Animation`'s name.
16-
PausedState bool `json:"pausedState"` // `Animation`'s internal paused state.
17-
PlayState string `json:"playState"` // `Animation`'s play state.
18-
PlaybackRate float64 `json:"playbackRate"` // `Animation`'s playback rate.
19-
StartTime float64 `json:"startTime"` // `Animation`'s start time.
20-
CurrentTime float64 `json:"currentTime"` // `Animation`'s current time.
21-
Type string `json:"type"` // Animation type of `Animation`.
22-
Source *AnimationAnimationEffect `json:"source,omitempty"` // `Animation`'s source animation node.
23-
CssId string `json:"cssId,omitempty"` // A unique ID for `Animation` representing the sources that triggered this CSS animation/transition.
14+
Id string `json:"id"` // `Animation`'s id.
15+
Name string `json:"name"` // `Animation`'s name.
16+
PausedState bool `json:"pausedState"` // `Animation`'s internal paused state.
17+
PlayState string `json:"playState"` // `Animation`'s play state.
18+
PlaybackRate float64 `json:"playbackRate"` // `Animation`'s playback rate.
19+
StartTime float64 `json:"startTime"` // `Animation`'s start time. Milliseconds for time based animations and percentage [0 - 100] for scroll driven animations (i.e. when viewOrScrollTimeline exists).
20+
CurrentTime float64 `json:"currentTime"` // `Animation`'s current time.
21+
Type string `json:"type"` // Animation type of `Animation`.
22+
Source *AnimationAnimationEffect `json:"source,omitempty"` // `Animation`'s source animation node.
23+
CssId string `json:"cssId,omitempty"` // A unique ID for `Animation` representing the sources that triggered this CSS animation/transition.
24+
ViewOrScrollTimeline *AnimationViewOrScrollTimeline `json:"viewOrScrollTimeline,omitempty"` // View or scroll timeline
25+
}
26+
27+
// Timeline instance
28+
type AnimationViewOrScrollTimeline struct {
29+
SourceNodeId int `json:"sourceNodeId,omitempty"` // Scroll container node
30+
StartOffset float64 `json:"startOffset,omitempty"` // Represents the starting scroll position of the timeline as a length offset in pixels from scroll origin.
31+
EndOffset float64 `json:"endOffset,omitempty"` // Represents the ending scroll position of the timeline as a length offset in pixels from scroll origin.
32+
SubjectNodeId int `json:"subjectNodeId,omitempty"` // The element whose principal box's visibility in the scrollport defined the progress of the timeline. Does not exist for animations with ScrollTimeline
33+
Axis string `json:"axis"` // Orientation of the scroll enum values: horizontal, vertical
2434
}
2535

2636
// AnimationEffect instance
@@ -29,7 +39,7 @@ type AnimationAnimationEffect struct {
2939
EndDelay float64 `json:"endDelay"` // `AnimationEffect`'s end delay.
3040
IterationStart float64 `json:"iterationStart"` // `AnimationEffect`'s iteration start.
3141
Iterations float64 `json:"iterations"` // `AnimationEffect`'s iterations.
32-
Duration float64 `json:"duration"` // `AnimationEffect`'s iteration duration.
42+
Duration float64 `json:"duration"` // `AnimationEffect`'s iteration duration. Milliseconds for time based animations and percentage [0 - 100] for scroll driven animations (i.e. when viewOrScrollTimeline exists).
3343
Direction string `json:"direction"` // `AnimationEffect`'s playback direction.
3444
Fill string `json:"fill"` // `AnimationEffect`'s fill mode.
3545
BackendNodeId int `json:"backendNodeId,omitempty"` // `AnimationEffect`'s target node.
@@ -73,6 +83,14 @@ type AnimationAnimationStartedEvent struct {
7383
} `json:"Params,omitempty"`
7484
}
7585

86+
// Event for animation that has been updated.
87+
type AnimationAnimationUpdatedEvent struct {
88+
Method string `json:"method"`
89+
Params struct {
90+
Animation *AnimationAnimation `json:"animation"` // Animation that was updated.
91+
} `json:"Params,omitempty"`
92+
}
93+
7694
type Animation struct {
7795
target gcdmessage.ChromeTargeter
7896
}

0 commit comments

Comments
 (0)