Files
piik/native/client/internal/browser/open_test.go
T
AAA 5781d6bbfa feat(client): complete native source and release boundary
Complete the Native Client source/audio boundary, strict v5 loopback contract, Browser media lifecycle handling, and non-blocking release checks. Keep unverified platform/physical gates explicit; do not rewrite the Go Server.
2026-09-04 03:42:54 +08:00

34 lines
1019 B
Go

package browser
import (
"reflect"
"testing"
)
func TestCommandUsesThePlatformURLLauncher(t *testing.T) {
tests := []struct {
platform string
command string
args []string
}{
{"windows", "rundll32.exe", []string{"url.dll,FileProtocolHandler", "https://share.example/room"}},
{"darwin", "open", []string{"https://share.example/room"}},
{"linux", "xdg-open", []string{"https://share.example/room"}},
}
for _, test := range tests {
commandName, args, err := command(test.platform, "https://share.example/room")
if err != nil || commandName != test.command || !reflect.DeepEqual(args, test.args) {
t.Fatalf("command(%s) = %q, %#v, %v", test.platform, commandName, args, err)
}
}
}
func TestCommandRejectsNonWebTargetsAndUnknownPlatforms(t *testing.T) {
if _, _, err := command("windows", "file:///tmp/index.html"); err == nil {
t.Fatal("file URL was accepted")
}
if _, _, err := command("plan9", "https://share.example"); err == nil {
t.Fatal("unknown platform was accepted")
}
}