various minor cleanups

Remove the log option lines from testAllocate; right now, we don't have
these options for Target, and Target doesn't log much anyway. We can
always revisit this in the future.

While at it, simplify some code.
This commit is contained in:
Daniel Martí 2019-04-01 17:12:17 +01:00
parent ad8809efb7
commit 41e913e571
2 changed files with 3 additions and 15 deletions

View File

@ -33,16 +33,6 @@ func testAllocate(t *testing.T, path string) (_ context.Context, cancel func())
}
}
//if err := WithLogf(t.Logf)(c.c); err != nil {
// t.Fatalf("could not set logf: %v", err)
//}
//if err := WithDebugf(t.Logf)(c.c); err != nil {
// t.Fatalf("could not set debugf: %v", err)
//}
//if err := WithErrorf(t.Errorf)(c.c); err != nil {
// t.Fatalf("could not set errorf: %v", err)
//}
return ctx, cancel
}
@ -67,7 +57,7 @@ func TestMain(m *testing.M) {
// start the browser
browserCtx, _ = NewContext(allocCtx)
if err := Run(browserCtx, Tasks{}); err != nil {
if err := Run(browserCtx); err != nil {
panic(err)
}

View File

@ -81,14 +81,12 @@ func Run(ctx context.Context, actions ...Action) error {
}
func (c *Context) newSession(ctx context.Context) error {
create := target.CreateTarget("about:blank")
targetID, err := create.Do(ctx, c.Browser)
targetID, err := target.CreateTarget("about:blank").Do(ctx, c.Browser)
if err != nil {
return err
}
attach := target.AttachToTarget(targetID)
sessionID, err := attach.Do(ctx, c.Browser)
sessionID, err := target.AttachToTarget(targetID).Do(ctx, c.Browser)
if err != nil {
return err
}