| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/views/test/platform_test_helper.h" |
| 6 |
| 7 #include <Cocoa/Cocoa.h> |
| 8 |
| 9 #import "base/mac/scoped_nsobject.h" |
| 10 #import "base/mac/scoped_objc_class_swizzler.h" |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" |
| 13 #import "ui/views/cocoa/bridged_native_widget.h" |
| 14 #include "ui/views/widget/native_widget_mac.h" |
| 15 #include "ui/views/widget/widget.h" |
| 16 |
| 17 namespace views { |
| 18 |
| 19 void PlatformTestHelper::SimulateNativeDestroy(Widget* widget) { |
| 20 // Retain the window while closing it, otherwise the window may lose its |
| 21 // last owner before -[NSWindow close] completes (this offends AppKit). |
| 22 // Usually this reference will exist on an event delivered to the runloop. |
| 23 base::scoped_nsobject<NSWindow> window([widget->GetNativeWindow() retain]); |
| 24 [window close]; |
| 25 } |
| 26 |
| 27 } // namespace views |
| OLD | NEW |