test(webview): trigger navigation failure consistently through proxies

This commit is contained in:
Levi committed 2026-09-17 23:58:30 +08:00
1 parent 2c7a86b21c
commit ffbae58e6b
1 file changed
+5 -7
+5 -7
View File
@@ -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")
} }