| Index: ui/views/test/platform_test_helper.cc
|
| diff --git a/ui/views/test/platform_test_helper.cc b/ui/views/test/platform_test_helper.cc
|
| index b6626189fa390b2141ef70e1ff3704344714770f..64ff7ffa11017fa40ef9aae903cf24591fe15cb9 100644
|
| --- a/ui/views/test/platform_test_helper.cc
|
| +++ b/ui/views/test/platform_test_helper.cc
|
| @@ -7,6 +7,18 @@
|
| #include "base/callback.h"
|
| #include "base/logging.h"
|
| #include "base/memory/ptr_util.h"
|
| +#include "ui/views/widget/widget.h"
|
| +
|
| +#if defined(USE_AURA)
|
| +#include "ui/aura/window.h"
|
| +#endif
|
| +
|
| +#if defined(OS_MACOSX)
|
| +#include <Cocoa/Cocoa.h>
|
| +
|
| +#import "base/mac/scoped_nsobject.h"
|
| +#include "ui/views/widget/native_widget_mac.h"
|
| +#endif
|
|
|
| namespace views {
|
| namespace {
|
| @@ -17,6 +29,20 @@ class DefaultPlatformTestHelper : public PlatformTestHelper {
|
|
|
| ~DefaultPlatformTestHelper() override {}
|
|
|
| + // PlatformTestHelper:
|
| + void SimulateNativeDestroy(Widget* widget) override {
|
| +#if defined(USE_AURA)
|
| + delete widget->GetNativeView();
|
| +#elif defined(OS_MACOSX)
|
| + // Retain the window while closing it, otherwise the window may lose its
|
| + // last
|
| + // owner before -[NSWindow close] completes (this offends AppKit). Usually
|
| + // this reference will exist on an event delivered to the runloop.
|
| + base::scoped_nsobject<NSWindow> window([widget->GetNativeWindow() retain]);
|
| + [window close];
|
| +#endif
|
| + }
|
| +
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(DefaultPlatformTestHelper);
|
| };
|
|
|