OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "ios/web/public/test/web_test.h" | 5 #include "ios/web/public/test/web_test.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "ios/web/public/active_state_manager.h" | 8 #include "ios/web/public/active_state_manager.h" |
9 #include "ios/web/public/web_state/global_web_state_observer.h" | 9 #include "ios/web/public/web_state/global_web_state_observer.h" |
10 #import "ios/web/public/test/fakes/test_web_client.h" | 10 #import "ios/web/public/test/fakes/test_web_client.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 }; | 22 }; |
23 | 23 |
24 WebTest::WebTest() | 24 WebTest::WebTest() |
25 : web_client_(base::WrapUnique(new TestWebClient)), | 25 : web_client_(base::WrapUnique(new TestWebClient)), |
26 crash_observer_(base::MakeUnique<WebTestRenderProcessCrashObserver>()) {} | 26 crash_observer_(base::MakeUnique<WebTestRenderProcessCrashObserver>()) {} |
27 | 27 |
28 WebTest::~WebTest() {} | 28 WebTest::~WebTest() {} |
29 | 29 |
30 void WebTest::SetUp() { | 30 void WebTest::SetUp() { |
| 31 root_pool_ = [[NSAutoreleasePool alloc] init]; |
31 PlatformTest::SetUp(); | 32 PlatformTest::SetUp(); |
32 BrowserState::GetActiveStateManager(&browser_state_)->SetActive(true); | 33 BrowserState::GetActiveStateManager(&browser_state_)->SetActive(true); |
33 } | 34 } |
34 | 35 |
35 void WebTest::TearDown() { | 36 void WebTest::TearDown() { |
36 BrowserState::GetActiveStateManager(&browser_state_)->SetActive(false); | 37 BrowserState::GetActiveStateManager(&browser_state_)->SetActive(false); |
37 PlatformTest::TearDown(); | 38 PlatformTest::TearDown(); |
| 39 [root_pool_ release]; |
| 40 root_pool_ = nil; |
38 } | 41 } |
39 | 42 |
40 TestWebClient* WebTest::GetWebClient() { | 43 TestWebClient* WebTest::GetWebClient() { |
41 return static_cast<TestWebClient*>(web_client_.Get()); | 44 return static_cast<TestWebClient*>(web_client_.Get()); |
42 } | 45 } |
43 | 46 |
44 BrowserState* WebTest::GetBrowserState() { | 47 BrowserState* WebTest::GetBrowserState() { |
45 return &browser_state_; | 48 return &browser_state_; |
46 } | 49 } |
47 | 50 |
48 void WebTest::SetIgnoreRenderProcessCrashesDuringTesting(bool allow) { | 51 void WebTest::SetIgnoreRenderProcessCrashesDuringTesting(bool allow) { |
49 if (allow) { | 52 if (allow) { |
50 crash_observer_ = nullptr; | 53 crash_observer_ = nullptr; |
51 } else { | 54 } else { |
52 crash_observer_ = base::MakeUnique<WebTestRenderProcessCrashObserver>(); | 55 crash_observer_ = base::MakeUnique<WebTestRenderProcessCrashObserver>(); |
53 } | 56 } |
54 } | 57 } |
55 | 58 |
56 } // namespace web | 59 } // namespace web |
OLD | NEW |