test: make app window freshness check deterministic

This commit is contained in:
YXC0915 committed 2026-12-03 07:34:27 +08:00
1 parent e281e43d07
commit d36d3ed0d6
1 file changed
+4 -1
+4 -1
View File
@@ -89,7 +89,10 @@ func TestActiveWindowReporting(t *testing.T) {
if got, ok := srv.ActiveWindow("mac-one", time.Second); !ok || got != window {
t.Fatalf("active window = %+v, %t", got, ok)
}
if _, ok := srv.ActiveWindow("mac-one", 0); ok {
srv.mu.Lock()
srv.vms["mac-one"].windowReport.receivedAt = time.Now().Add(-2 * time.Second)
srv.mu.Unlock()
if _, ok := srv.ActiveWindow("mac-one", time.Second); ok {
t.Fatal("report older than maxAge was accepted")
}
if _, ok := srv.ActiveWindow("mac-two", time.Second); ok {