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

Unified Diff: ui/views/focus/focus_manager_unittest.cc

Issue 10951033: Plumb ClearNativeFocus to DesktopRootWindowHostWin. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: get rid of FocusNativeView Created 8 years, 3 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 | « no previous file | ui/views/widget/desktop_native_widget_aura.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/focus/focus_manager_unittest.cc
===================================================================
--- ui/views/focus/focus_manager_unittest.cc (revision 157553)
+++ ui/views/focus/focus_manager_unittest.cc (working copy)
@@ -16,13 +16,26 @@
#include "ui/views/focus/widget_focus_manager.h"
#include "ui/views/widget/widget.h"
-#if !defined(USE_AURA)
+#if defined(USE_AURA)
+#include "ui/aura/focus_manager.h"
+#include "ui/aura/window.h"
+#else
#include "ui/views/controls/tabbed_pane/native_tabbed_pane_wrapper.h"
#include "ui/views/controls/tabbed_pane/tabbed_pane.h"
#endif
namespace views {
+void FocusNativeView(gfx::NativeView view) {
+#if defined(USE_AURA)
+ view->GetFocusManager()->SetFocusedWindow(view, NULL);
+#elif defined(OS_WIN)
+ SetFocus(view);
+#else
+#error
+#endif
+}
+
enum FocusTestEventType {
ON_FOCUS = 0,
ON_BLUR
@@ -139,14 +152,14 @@
widget_listener.ClearFocusChanges();
gfx::NativeView native_view1 = widget1->GetNativeView();
- GetWidget()->FocusNativeView(native_view1);
+ FocusNativeView(native_view1);
ASSERT_EQ(2, static_cast<int>(widget_listener.focus_changes().size()));
EXPECT_EQ(native_view1, widget_listener.focus_changes()[0].second);
EXPECT_EQ(native_view1, widget_listener.focus_changes()[1].second);
widget_listener.ClearFocusChanges();
gfx::NativeView native_view2 = widget2->GetNativeView();
- GetWidget()->FocusNativeView(native_view2);
+ FocusNativeView(native_view2);
ASSERT_EQ(2, static_cast<int>(widget_listener.focus_changes().size()));
EXPECT_EQ(NativeViewPair(native_view1, native_view2),
widget_listener.focus_changes()[0]);
@@ -185,13 +198,13 @@
tabbed_pane->AddTab(ASCIIToUTF16("Awesome textfield"), textfield2);
// Simulate the native view getting the native focus (such as by user click).
- GetWidget()->FocusNativeView(textfield->TestGetNativeControlView());
+ FocusNativeView(textfield->TestGetNativeControlView());
EXPECT_EQ(textfield, GetFocusManager()->GetFocusedView());
- GetWidget()->FocusNativeView(tabbed_pane->TestGetNativeControlView());
+ FocusNativeView(tabbed_pane->TestGetNativeControlView());
EXPECT_EQ(tabbed_pane, GetFocusManager()->GetFocusedView());
- GetWidget()->FocusNativeView(textfield2->TestGetNativeControlView());
+ FocusNativeView(textfield2->TestGetNativeControlView());
EXPECT_EQ(textfield2, GetFocusManager()->GetFocusedView());
}
#endif
« no previous file with comments | « no previous file | ui/views/widget/desktop_native_widget_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698