package browser import "testing" func TestCdpNewTabBackground_closedPort(t *testing.T) { // Sin Chrome escuchando esperamos error de red al resolver /json/version, // pero NO panic ni nil-deref. Puerto 1 garantizado cerrado. _, err := CdpNewTabBackground("", 1, "https://example.com") if err == nil { t.Fatal("expected error talking to closed port") } } func TestCdpNewTabBackground_emptyStartURLClosedPort(t *testing.T) { // startURL vacio debe normalizarse a about:blank sin romper; con puerto // cerrado seguimos esperando error de red, no panic. _, err := CdpNewTabBackground("localhost", 1, "") if err == nil { t.Fatal("expected error talking to closed port") } }