Skip to content

Commit 6f632c2

Browse files
committed
all: resolve compatibility issue
1 parent 637e60c commit 6f632c2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

code2img.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/chromedp/cdproto/dom"
1717
"github.com/chromedp/cdproto/emulation"
1818
"github.com/chromedp/cdproto/page"
19+
"github.com/chromedp/cdproto/runtime"
1920
"github.com/chromedp/chromedp"
2021
)
2122

@@ -109,13 +110,13 @@ func screenshot(sel interface{}, picbuf *[]byte, opts ...chromedp.QueryOption) c
109110
panic("picbuf cannot be nil")
110111
}
111112

112-
return chromedp.QueryAfter(sel, func(ctx context.Context, nodes ...*cdp.Node) error {
113+
return chromedp.QueryAfter(sel, func(ctx context.Context, eci runtime.ExecutionContextID, nodes ...*cdp.Node) error {
113114
if len(nodes) < 1 {
114115
return fmt.Errorf("selector %q did not return any nodes", sel)
115116
}
116117

117118
// get layout metrics
118-
_, _, contentSize, err := page.GetLayoutMetrics().Do(ctx)
119+
_, _, contentSize, _, _, _, err := page.GetLayoutMetrics().Do(ctx)
119120
if err != nil {
120121
return err
121122
}

code2img_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
)
2020

2121
func TestRender(t *testing.T) {
22-
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
22+
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
2323
defer cancel()
2424

2525
got, err := code2img.Render(ctx, code2img.LangGo, `import "golang.design/x/code2img"`)

0 commit comments

Comments
 (0)