Index: ui/gfx/test/ui_cocoa_test_helper.mm |
diff --git a/ui/gfx/test/ui_cocoa_test_helper.mm b/ui/gfx/test/ui_cocoa_test_helper.mm |
index 7f50bb377c8a3eea4c935e8c49df2dea0b87f942..63e32c3cf09092d7e2b5e1331a6c381df64fbe18 100644 |
--- a/ui/gfx/test/ui_cocoa_test_helper.mm |
+++ b/ui/gfx/test/ui_cocoa_test_helper.mm |
@@ -7,6 +7,7 @@ |
#include "base/debug/debugger.h" |
#include "base/logging.h" |
#include "base/stl_util.h" |
+#include "base/test/mock_chrome_application_mac.h" |
#include "base/test/test_timeouts.h" |
namespace { |
@@ -16,6 +17,11 @@ namespace { |
// to flag intentional leaks without having to suppress all calls to |
// potentially leaky functions. |
void NOINLINE ForceSystemLeaks() { |
+ // If a test suite hasn't already initialized NSApp, register the mock one |
+ // now. |
+ if (!NSApp) |
+ mock_cr_app::RegisterMockCrApp(); |
+ |
// First NSCursor push always leaks. |
[[NSCursor openHandCursor] push]; |
[NSCursor pop]; |