25 lines
595 B
Go
25 lines
595 B
Go
//go:build windows
|
|||
|
|
|
||
|
|
package browser
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
"os"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestWindowsProcessInspectorReadsCurrentProcess(t *testing.T) {
|
||
|
|
inspector := NewWindowsProcessInspector()
|
||
|
|
identity, err := inspector.Inspect(context.Background(), os.Getpid())
|
||
|
|
if err != nil {
|
||
|
|
t.Fatalf("Inspect(current process) error = %v", err)
|
||
|
|
}
|
||
|
|
if identity.PID != os.Getpid() || identity.Executable == "" {
|
||
|
|
t.Fatalf("identity = %+v", identity)
|
||
|
|
}
|
||
|
|
alive, err := inspector.Alive(context.Background(), os.Getpid())
|
||
|
|
if err != nil || !alive {
|
||
|
|
t.Fatalf("Alive(current process) = %v, %v", alive, err)
|
||
|
|
}
|
||
|
|
}
|