mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-18 14:23:42 +00:00
test(webview): trigger navigation failure consistently through proxies
This commit is contained in:
1 parent
2c7a86b21c
commit
ffbae58e6b
1 file changed
+5
-7
@@ -2,7 +2,6 @@ package integrationtest
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@@ -87,12 +86,11 @@ func RunEventContract(t *testing.T, provider wv.Provider) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
quiet()
|
quiet()
|
||||||
listener, err := net.Listen("tcp", "127.0.0.1:0")
|
// The fixture serves plain HTTP. Attempting TLS against it produces a
|
||||||
if err != nil {
|
// real navigation failure through both HTTP CONNECT and SOCKS proxies.
|
||||||
t.Fatal(err)
|
// An unreachable HTTP origin would instead become a valid 502 document
|
||||||
}
|
// when the host's HTTP proxy handles the connection error.
|
||||||
failedURL := "http://" + listener.Addr().String() + "/failure"
|
failedURL := strings.Replace(url, "http://", "https://", 1) + "/failure"
|
||||||
listener.Close()
|
|
||||||
if err := page.Goto(failedURL, map[string]any{"timeoutMs": 3000}); err == nil {
|
if err := page.Goto(failedURL, map[string]any{"timeoutMs": 3000}); err == nil {
|
||||||
t.Fatal("failed navigation succeeded")
|
t.Fatal("failed navigation succeeded")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user