Index: ios/web/test/web_int_test.h |
diff --git a/ios/web/test/web_int_test.h b/ios/web/test/web_int_test.h |
index 4bd312ebcc911e12bbe73dd1937f51adc6502bcb..0eae4bfc88ff23b11ffd6641747e2e9acb474ad9 100644 |
--- a/ios/web/test/web_int_test.h |
+++ b/ios/web/test/web_int_test.h |
@@ -71,6 +71,14 @@ class WebIntTest : public WebTest { |
std::unique_ptr<WebState> web_state_; |
// WebStateObserver used to wait for page loads. |
std::unique_ptr<IntTestWebStateObserver> 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 |
+ // is gone, causing DCHECKs on deallocation. Creating our own root pool |
+ // application context ensures that autoreleased objects are released at the |
+ // end of the test, not later after the C++ test objects are destroyed. |
+ NSAutoreleasePool* rootPool_; |
Eugene But (OOO till 7-30)
2017/06/02 23:18:37
root_pool_ per C++ Style Guide. But also, should w
PL
2017/06/05 23:26:18
Done! This is a great suggestion, thanks!
|
}; |
} // namespace web |