Index: ui/base/test/scoped_fake_nswindow_focus.mm |
diff --git a/ui/base/test/scoped_fake_nswindow_focus.mm b/ui/base/test/scoped_fake_nswindow_focus.mm |
index b78680dba23dec94efc4996da2d114eccf24eafe..8260532386d2a6825d4d05605729c2c6114d50a8 100644 |
--- a/ui/base/test/scoped_fake_nswindow_focus.mm |
+++ b/ui/base/test/scoped_fake_nswindow_focus.mm |
@@ -14,6 +14,7 @@ using base::mac::ScopedObjCClassSwizzler; |
namespace { |
NSWindow* g_fake_focused_window = nil; |
+IMP g_order_out_impl_ = nullptr; |
void SetFocus(NSWindow* window) { |
g_fake_focused_window = window; |
@@ -69,6 +70,13 @@ void ClearFocus() { |
[self makeKeyWindow]; |
} |
+- (void)orderOut:(id)sender { |
tapted
2016/04/20 06:05:57
What tests ended up needing this? It doesn't seem
karandeepb
2016/05/03 02:54:12
I needed this for NativeWidgetMacFullKeyboardAcces
tapted
2016/05/03 08:08:25
OK sounds good. That's lots of reasons :). For a t
karandeepb
2016/05/04 01:56:38
Hehe yeah :) I realized that after writing this!
|
+ NSWindow* selfAsWindow = base::mac::ObjCCastStrict<NSWindow>(self); |
+ if (selfAsWindow == g_fake_focused_window) |
+ g_fake_focused_window = nil; |
+ g_order_out_impl_(self, _cmd, sender); |
+} |
+ |
@end |
namespace ui { |
@@ -90,7 +98,13 @@ ScopedFakeNSWindowFocus::ScopedFakeNSWindowFocus() |
make_key_swizzler_( |
new ScopedObjCClassSwizzler([NSWindow class], |
[FakeNSWindowFocusDonor class], |
- @selector(makeKeyWindow))) {} |
+ @selector(makeKeyWindow))), |
+ order_out_swizzler_( |
+ new ScopedObjCClassSwizzler([NSWindow class], |
+ [FakeNSWindowFocusDonor class], |
+ @selector(orderOut:))) { |
+ g_order_out_impl_ = order_out_swizzler_->GetOriginalImplementation(); |
+} |
ScopedFakeNSWindowFocus::~ScopedFakeNSWindowFocus() { |
ClearFocus(); |