Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(714)

Unified Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc

Issue 2924873007: Don't activate aura::Window on creation from DesktopNativeWidgetAura if NativeWidgetDelegate prohib… (Closed)
Patch Set: Comment Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
index 872cd30c086b32529ee05733cede200bc1dcdebb..0e8bd99e750b070b06f5c24b6c5cf0d1f39c51a1 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc
@@ -12,6 +12,7 @@
#include "build/build_config.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/cursor_client.h"
+#include "ui/aura/client/focus_client.h"
#include "ui/aura/client/window_parenting_client.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/window.h"
@@ -103,6 +104,21 @@ TEST_F(DesktopNativeWidgetAuraTest, NativeViewInitiallyHidden) {
EXPECT_FALSE(widget.GetNativeView()->IsVisible());
}
+// Verifies that the native view isn't activated if Widget requires that.
+TEST_F(DesktopNativeWidgetAuraTest, NativeViewNoActivate) {
+ // Widget of TYPE_POPUP can't be activated.
+ Widget widget;
+ Widget::InitParams init_params = CreateParams(Widget::InitParams::TYPE_POPUP);
+ init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
+ DesktopNativeWidgetAura* widget_aura = new DesktopNativeWidgetAura(&widget);
+ init_params.native_widget = widget_aura;
+ widget.Init(init_params);
+
+ EXPECT_FALSE(widget.CanActivate());
+ EXPECT_EQ(nullptr, aura::client::GetFocusClient(widget_aura->content_window())
+ ->GetFocusedWindow());
+}
+
// Verifies that if the DesktopWindowTreeHost is already shown, the native view
// still reports not visible as we haven't shown the content window.
TEST_F(DesktopNativeWidgetAuraTest, WidgetNotVisibleOnlyWindowTreeHostShown) {
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698