Skip to content

Commit

Permalink
refactor: increment, unlambda, unslice (#1298)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear committed Apr 15, 2023
1 parent 0b936bf commit 50d488c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
6 changes: 2 additions & 4 deletions allocate.go
Expand Up @@ -527,10 +527,8 @@ func WSURLReadTimeout(t time.Duration) ExecAllocatorOption {
// Use chromedp.NoModifyURL to prevent it from modifying the url.
func NewRemoteAllocator(parent context.Context, url string, opts ...RemoteAllocatorOption) (context.Context, context.CancelFunc) {
a := &RemoteAllocator{
wsURL: url,
modifyURLFunc: func(ctx context.Context, wsURL string) (string, error) {
return modifyURL(ctx, wsURL)
},
wsURL: url,
modifyURLFunc: modifyURL,
}
for _, o := range opts {
o(a)
Expand Down
2 changes: 1 addition & 1 deletion allocate_test.go
Expand Up @@ -456,7 +456,7 @@ func TestStartsWithNonBlankTab(t *testing.T) {
t.Parallel()

allocCtx, cancel := NewExecAllocator(context.Background(),
append(allocOpts[:],
append(allocOpts,
ModifyCmdFunc(func(cmd *exec.Cmd) {
// it assumes that the last argument is "about:blank" and
// replace it with other URL.
Expand Down
3 changes: 1 addition & 2 deletions chromedp_test.go
Expand Up @@ -138,8 +138,7 @@ func testAllocateSeparate(tb testing.TB) (context.Context, context.CancelFunc) {
tb.Fatal(err)
}
ListenBrowser(ctx, func(ev interface{}) {
switch ev := ev.(type) {
case *runtime.EventExceptionThrown:
if ev, ok := ev.(*runtime.EventExceptionThrown); ok {
tb.Errorf("%+v\n", ev.ExceptionDetails)
}
})
Expand Down
2 changes: 1 addition & 1 deletion query_test.go
Expand Up @@ -227,7 +227,7 @@ func TestRetryInterval(t *testing.T) {
// only after the number of result nodes >= s.exp .
count := WaitFunc(
func(ctx context.Context, f *cdp.Frame, eci cdpruntime.ExecutionContextID, ni ...cdp.NodeID) ([]*cdp.Node, error) {
retryCount += 1
retryCount++
return nil, ErrInvalidTarget
},
)
Expand Down

0 comments on commit 50d488c

Please sign in to comment.