Reland MockActivationController class to emulate widget activation in tests

Commit: 8a2462b4 | 2026-02-25 02:38:05

← Back to List

Reland MockActivationController class to emulate widget activation in tests

Minor
Commit Hash: 8a2462b493e249480a772d9f897a9fdc72ecddce
Commit Time: 2026-02-25 02:38:05
Impact Level: Minor
Generated By: webview2-upstream-sentry
Upstream Review: View Upstream Review 🔗

📋 Summary

This commit relands the previously reverted MockActivationController class and WidgetActivationDelegate infrastructure for emulating widget activation in tests. 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 WidgetActivationDelegate query logic added to desktop_window_tree_host_platform.cc and desktop_window_tree_host_win.cc; glic_test_util updated to use the new MockActivationController. Note: this commit was subsequently reverted by 3be941b0 due to GlicInstanceCoordinatorBrowserTest failures.

🎯 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 was subsequently reverted by commit 3be941b0. No downstream patch is needed.

Impacted Classes:

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