Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmood committed Sep 18, 2020
1 parent ca90643 commit 56f1ab8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
13 changes: 12 additions & 1 deletion lib/cdp/client_private_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,20 @@ func TestCancelOnReq(t *testing.T) {
}

func TestCancelBeforeSend(t *testing.T) {
cdp := New("")
cdp.ctx = context.Background()
ctx, cancel := context.WithCancel(context.Background())
cancel()

_, err := cdp.Call(ctx, "", "", nil)
assert.EqualError(t, err, "context canceled")
}

func TestCancelBeforeCallback(t *testing.T) {
cdp := New("")
cdp.ctx = ctx
cdp.ctx = context.Background()

ctx, cancel := context.WithCancel(context.Background())

go func() {
<-cdp.chReq
Expand Down
7 changes: 5 additions & 2 deletions page_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,10 +678,13 @@ func (s *S) TestFonts() {
p.MustPDF("tmp", "fonts.pdf")
}

func (s *S) TestPagePDFErr() {
func (s *S) TestPagePDF() {
p := s.page.MustNavigate(srcFile("fixtures/click.html"))
p.MustPDF("")

s.Panics(func() {
s.stubErr(1, proto.PagePrintToPDF{})
s.page.MustPDF()
p.MustPDF()
})
}

Expand Down

0 comments on commit 56f1ab8

Please sign in to comment.