OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef IOS_WEB_TEST_WEB_INT_TEST_H_ | 5 #ifndef IOS_WEB_TEST_WEB_INT_TEST_H_ |
6 #define IOS_WEB_TEST_WEB_INT_TEST_H_ | 6 #define IOS_WEB_TEST_WEB_INT_TEST_H_ |
7 | 7 |
8 #import <WebKit/WebKit.h> | 8 #import <WebKit/WebKit.h> |
9 | 9 |
10 #import "base/ios/block_types.h" | 10 #import "base/ios/block_types.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 // or NSNotFound if it is not present. | 64 // or NSNotFound if it is not present. |
65 NSInteger GetIndexOfNavigationItem(const web::NavigationItem* item); | 65 NSInteger GetIndexOfNavigationItem(const web::NavigationItem* item); |
66 | 66 |
67 web::TestWebStateDelegate web_state_delegate_; | 67 web::TestWebStateDelegate web_state_delegate_; |
68 | 68 |
69 private: | 69 private: |
70 // WebState used to load pages. | 70 // WebState used to load pages. |
71 std::unique_ptr<WebState> web_state_; | 71 std::unique_ptr<WebState> web_state_; |
72 // WebStateObserver used to wait for page loads. | 72 // WebStateObserver used to wait for page loads. |
73 std::unique_ptr<IntTestWebStateObserver> observer_; | 73 std::unique_ptr<IntTestWebStateObserver> observer_; |
| 74 |
| 75 // The system autorelease pool is deallocated after some of the C++ objects |
| 76 // have been destroyed in the test (e.g. WebThreadImpl). Therefore any |
| 77 // autoreleased object will be deallocated after a lot of the expected |
| 78 // is gone, causing DCHECKs on deallocation. Creating our own root pool |
| 79 // application context ensures that autoreleased objects are released at the |
| 80 // end of the test, not later after the C++ test objects are destroyed. |
| 81 NSAutoreleasePool* rootPool_; |
74 }; | 82 }; |
75 | 83 |
76 } // namespace web | 84 } // namespace web |
77 | 85 |
78 #endif // IOS_WEB_TEST_WEB_INT_TEST_H_ | 86 #endif // IOS_WEB_TEST_WEB_INT_TEST_H_ |
OLD | NEW |