Introduce MockActivationController class to emulate widget activation in tests (original commit)

Commit: f92674ca | 2026-02-24 01:27:29

← Back to List

Introduce MockActivationController class to emulate widget activation in tests (original commit)

Minor
Commit Hash: f92674cad33d0849217a25d5c27a2d8848f8d713
Commit Time: 2026-02-24 01:27:29
Impact Level: Minor
Generated By: webview2-upstream-sentry
Upstream Review: View Upstream Review 🔗

📋 Summary

This commit introduces the MockActivationController class and WidgetActivationDelegate infrastructure for emulating widget activation in tests on Win/Mac/Linux. Changes include: new ui/views/widget/widget_activation_delegate.h/.cc defining a global singleton WidgetActivationDelegate interface; new ui/views/test/mock_activation_controller.h/.cc implementing a test activation controller; NativeWidgetMacNSWindowHost::IsWindowKey() changed from an inline function returning is_window_key_ to first querying WidgetActivationDelegate (if present), falling back to is_window_key_; corresponding query logic added to desktop_window_tree_host_platform.cc and desktop_window_tree_host_win.cc; glic_test_util updated to use MockActivationController. Note: this commit went through multiple revert/reland cycles (ca260c6e revert → 8a2462b4 reland → 3be941b0 revert again), with the final state being reverted.

🎯 Impact Analysis

This change has minimal impact on WebView2Mac. The main modification changes NativeWidgetMacNSWindowHost::IsWindowKey() from an inline function to a non-inline method with WidgetActivationDelegate query logic. In production, WidgetActivationDelegate::Get() returns nullptr, so behavior remains identical — it still returns is_window_key_. The change only affects test infrastructure. Edge downstream has no references to IsWindowKey, WidgetActivationDelegate, or MockActivationController in edge_embedded_browser/ or components/edge_webview2/. Additionally, this commit has been ultimately reverted (3be941b0). No downstream patch is needed.

Impacted Classes:

views::NativeWidgetMacNSWindowHost views::WidgetActivationDelegate views::MockActivationController