chromeworker_client/client_test.go

41 lines
957 B
Go
Raw Normal View History

2020-11-23 08:15:19 +00:00
package cwclient
import (
"log"
"net/http"
"testing"
)
func TestPort(t *testing.T) {
cli := New("http://localhost:7123")
2020-11-23 10:49:37 +00:00
ltest := cli.Register("test", func(tid, content string, err error) {
if err != nil {
log.Println("error:", err)
} else {
log.Println(tid, content)
}
})
2020-11-23 10:49:37 +00:00
ltest.SetContentConditionFromFile("example.js")
cli.Connect()
2020-11-23 03:50:25 +00:00
log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/rip113?lang=en&deviceType=browser"))
log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/yanngu?lang=en&deviceType=browser"))
log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/rip113?lang=en&deviceType=browser"))
log.Println(ltest.Open("https://playerduo.com/api/playerDuo-service-v2/yanngu?lang=en&deviceType=browser"))
http.ListenAndServe(":42311", nil)
}
func TestChrome(t *testing.T) {
2020-11-23 10:49:37 +00:00
{
defer func() {
log.Println(123)
}()
log.Println(456)
}
2020-11-23 10:49:37 +00:00
log.Println(321)
}