2020-11-23 08:15:19 +00:00
|
|
|
package cwclient
|
2020-11-20 10:47:16 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestPort(t *testing.T) {
|
|
|
|
cli := New("http://localhost:7123")
|
2020-11-23 10:49:37 +00:00
|
|
|
|
2020-11-24 07:17:56 +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-20 10:47:16 +00:00
|
|
|
|
|
|
|
})
|
2020-11-23 10:49:37 +00:00
|
|
|
ltest.SetContentConditionFromFile("example.js")
|
2020-11-20 10:47:16 +00:00
|
|
|
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"))
|
2020-11-24 07:17:56 +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"))
|
2020-11-20 10:47:16 +00:00
|
|
|
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-20 10:47:16 +00:00
|
|
|
}
|
|
|
|
|
2020-11-23 10:49:37 +00:00
|
|
|
log.Println(321)
|
2020-11-20 10:47:16 +00:00
|
|
|
|
|
|
|
}
|