fix(windows): accept successful tray readiness HRESULTs
This commit is contained in:
1 parent
ae5e979761
commit
0735908ca9
7 files changed
+71
-2
No files matched your search
@@ -2295,7 +2295,9 @@ sessions remain independent. The double-click installer keeps its original
|
|||||||
interactive process alive, waits for the UAC child process's successful exit,
|
interactive process alive, waits for the UAC child process's successful exit,
|
||||||
starts the installed tray with the original user's token, and waits up to ten
|
starts the installed tray with the original user's token, and waits up to ten
|
||||||
seconds for `Shell_NotifyIconGetRect` to confirm the registered icon before
|
seconds for `Shell_NotifyIconGetRect` to confirm the registered icon before
|
||||||
showing success. A failed/cancelled installation must not start a tray; failure
|
showing success. Apply `SUCCEEDED(HRESULT)` (signed 32-bit result >= 0), not an
|
||||||
|
equality check against `S_OK`: Explorer can return `S_FALSE` with valid icon
|
||||||
|
coordinates. A failed/cancelled installation must not start a tray; failure
|
||||||
to start the tray must explicitly report the already-installed service rather
|
to start the tray must explicitly report the already-installed service rather
|
||||||
than claiming complete success. No sign-out or reboot is required.
|
than claiming complete success. No sign-out or reboot is required.
|
||||||
Run its Win32 message pump on one locked OS thread,
|
Run its Win32 message pump on one locked OS thread,
|
||||||
|
|||||||
@@ -233,6 +233,16 @@ visible/responsive when its service is absent or its IPC peer stalls. Windows
|
|||||||
may put a new application icon under its hidden-icons arrow; do not rewrite the
|
may put a new application icon under its hidden-icons arrow; do not rewrite the
|
||||||
user's global notification-area preferences to force pinning.
|
user's global notification-area preferences to force pinning.
|
||||||
|
|
||||||
|
Regression `BH-WINTRAY-06` checks successful HRESULTs (`S_OK` and `S_FALSE`)
|
||||||
|
versus actual failures. On the Windows 10 fixture, the installed, responsive
|
||||||
|
tray returned `S_FALSE` (`1`) with valid icon coordinates; a readiness check
|
||||||
|
that accepts only zero falsely times out. Native `BH-WINTRAY-07` calls the
|
||||||
|
installer's readiness check against the already-installed icon; require a
|
||||||
|
non-skipped pass on an installed interactive fixture. It skips if that
|
||||||
|
desktop has no RVBox tray. The native window-lifecycle check also exercises
|
||||||
|
readiness for its test icon. Preserve the user's icon visibility preferences
|
||||||
|
during verification.
|
||||||
|
|
||||||
Suite output is capped by the checked-in harness policy (10 MiB by default) and
|
Suite output is capped by the checked-in harness policy (10 MiB by default) and
|
||||||
stored as `artifacts/suite.log`. A failed run remains inspectable and can be
|
stored as `artifacts/suite.log`. A failed run remains inspectable and can be
|
||||||
moved back to `ready` with `recover`, then resumed with the same run ID and
|
moved back to `ready` with `recover`, then resumed with the same run ID and
|
||||||
|
|||||||
@@ -239,6 +239,19 @@ func TestNativeTrayIconLayout_HP_WINTRAY_03(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNativeInstalledTrayReadiness_BH_WINTRAY_07(t *testing.T) {
|
||||||
|
class, _ := winapi.UTF16PtrFromString("RVBoxTrayWindowV1")
|
||||||
|
hwnd, _, _ := procFindWindow.Call(uintptr(unsafe.Pointer(class)), 0)
|
||||||
|
if hwnd == 0 {
|
||||||
|
t.Skip("requires an installed tray on this interactive desktop")
|
||||||
|
}
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||||
|
defer cancel()
|
||||||
|
if err := WaitReady(ctx); err != nil {
|
||||||
|
t.Fatalf("existing installed icon was falsely reported unready: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestNativeTrayWindowLifecycle_HP_WINTRAY_04(t *testing.T) {
|
func TestNativeTrayWindowLifecycle_HP_WINTRAY_04(t *testing.T) {
|
||||||
var session uint32
|
var session uint32
|
||||||
if err := winapi.ProcessIdToSessionId(winapi.GetCurrentProcessId(), &session); err != nil {
|
if err := winapi.ProcessIdToSessionId(winapi.GetCurrentProcessId(), &session); err != nil {
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package windowstray
|
||||||
|
|
||||||
|
// iconQuerySucceeded follows SUCCEEDED(HRESULT), including S_FALSE. Explorer
|
||||||
|
// can return S_FALSE with valid icon coordinates; requiring S_OK falsely reports
|
||||||
|
// a tray startup failure. HRESULT is signed 32-bit even in a 64-bit syscall.
|
||||||
|
func iconQuerySucceeded(result uintptr) bool {
|
||||||
|
return int32(result) >= 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package windowstray
|
||||||
|
|
||||||
|
import "testing"
|
||||||
|
|
||||||
|
func TestTrayReadinessAcceptsSuccessfulHRESULT_BH_WINTRAY_06(t *testing.T) {
|
||||||
|
for _, tc := range []struct {
|
||||||
|
name string
|
||||||
|
result uintptr
|
||||||
|
ready bool
|
||||||
|
}{
|
||||||
|
{"S_OK", 0, true},
|
||||||
|
{"S_FALSE with registered icon", 1, true},
|
||||||
|
{"other successful HRESULT", 0x00040000, true},
|
||||||
|
{"E_FAIL", 0x80004005, false},
|
||||||
|
{"E_INVALIDARG", 0x80070057, false},
|
||||||
|
{"E_ACCESSDENIED", 0x80070005, false},
|
||||||
|
} {
|
||||||
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
|
if got := iconQuerySucceeded(tc.result); got != tc.ready {
|
||||||
|
t.Fatalf("HRESULT %#x: ready=%v, want %v", tc.result, got, tc.ready)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -509,7 +509,7 @@ func WaitReady(ctx context.Context) error {
|
|||||||
id := identifier{Size: uint32(unsafe.Sizeof(identifier{})), HWnd: hwnd, UID: trayIconID}
|
id := identifier{Size: uint32(unsafe.Sizeof(identifier{})), HWnd: hwnd, UID: trayIconID}
|
||||||
var rect rectangle
|
var rect rectangle
|
||||||
result, _, _ := procShellIconRect.Call(uintptr(unsafe.Pointer(&id)), uintptr(unsafe.Pointer(&rect)))
|
result, _, _ := procShellIconRect.Call(uintptr(unsafe.Pointer(&id)), uintptr(unsafe.Pointer(&rect)))
|
||||||
if int32(result) == 0 {
|
if iconQuerySucceeded(result) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -365,6 +365,18 @@ layer = "integration"
|
|||||||
status = "implemented"
|
status = "implemented"
|
||||||
tests = ["internal/client/windowstray/native_windows_test.go:TestNativeTrayRejectionBeforeRead_BH_WINTRAY_05"]
|
tests = ["internal/client/windowstray/native_windows_test.go:TestNativeTrayRejectionBeforeRead_BH_WINTRAY_05"]
|
||||||
|
|
||||||
|
[[requirements]]
|
||||||
|
id = "BH-WINTRAY-06"
|
||||||
|
layer = "unit"
|
||||||
|
status = "implemented"
|
||||||
|
tests = ["internal/client/windowstray/readiness_test.go:TestTrayReadinessAcceptsSuccessfulHRESULT_BH_WINTRAY_06"]
|
||||||
|
|
||||||
|
[[requirements]]
|
||||||
|
id = "BH-WINTRAY-07"
|
||||||
|
layer = "integration"
|
||||||
|
status = "implemented"
|
||||||
|
tests = ["internal/client/windowstray/native_windows_test.go:TestNativeInstalledTrayReadiness_BH_WINTRAY_07"]
|
||||||
|
|
||||||
[[requirements]]
|
[[requirements]]
|
||||||
id = "BH-WINTRAY-01"
|
id = "BH-WINTRAY-01"
|
||||||
layer = "unit"
|
layer = "unit"
|
||||||
|
|||||||
Reference in new issue
Block a user