mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
7c3a22d289
The chromedp context was not cancelled, so resources may have been leaking. Additionally this waits for the browser to start before the timer starts, and extends the timeout to 20 seconds. Logging from chromedp has also been enabled, which may help identify possible issues?
32 lines
434 B
Go
32 lines
434 B
Go
package wasm
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/chromedp/chromedp"
|
|
)
|
|
|
|
func TestChan(t *testing.T) {
|
|
|
|
wasmTmpDir, server := startServer(t)
|
|
|
|
err := run(t, "tinygo build -o "+wasmTmpDir+"/chan.wasm -target wasm testdata/chan.go")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
ctx := chromectx(t)
|
|
|
|
err = chromedp.Run(ctx,
|
|
chromedp.Navigate(server.URL+"/run?file=chan.wasm"),
|
|
waitLog(`1
|
|
4
|
|
2
|
|
3
|
|
true`),
|
|
)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|