Index: ios/web/public/test/web_test.h |
diff --git a/ios/web/public/test/web_test.h b/ios/web/public/test/web_test.h |
index 27002abd4f36efc9ef409a3fcb913d44c22ed53c..c6993c33e13546d8d536634bd48c990c6c358753 100644 |
--- a/ios/web/public/test/web_test.h |
+++ b/ios/web/public/test/web_test.h |
@@ -49,6 +49,16 @@ class WebTest : public PlatformTest { |
// Triggers test failures if a render process dies during the test. |
std::unique_ptr<WebTestRenderProcessCrashObserver> crash_observer_; |
+ |
+ // The system autorelease pool is deallocated after some of the C++ objects |
+ // have been destroyed in the test (e.g. WebThreadImpl). Therefore any |
+ // autoreleased object will be deallocated after a lot of the expected |
+ // application context is gone, causing DCHECKs on deallocation. Creating our |
+ // own root pool wrapping the test ensures that autoreleased objects are |
+ // released at the end of the test, not later after the C++ test objects are |
+ // destroyed. |
+ // Of type ID to prevent ARC imports from complaining about NSAutoreleasePool. |
+ id root_pool_; |
Eugene But (OOO till 7-30)
2017/06/12 06:12:51
Using |id| makes this header an Objective-C header
stkhapugin
2017/06/12 12:36:23
Please don't create a bare objc pointer in a heade
PL
2017/06/14 00:31:10
Thanks both, this is great guidance.
In the next
|
}; |
} // namespace web |