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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
10 #import "ios/testing/wait_util.h" | 10 #import "ios/testing/wait_util.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 void SetUp() override { | 139 void SetUp() override { |
140 WebIntTest::SetUp(); | 140 WebIntTest::SetUp(); |
141 ui_handler_ = base::MakeUnique<TestUIHandler>(); | 141 ui_handler_ = base::MakeUnique<TestUIHandler>(); |
142 web::WebState::CreateParams params(GetBrowserState()); | 142 web::WebState::CreateParams params(GetBrowserState()); |
143 web_state_ = base::MakeUnique<web::WebStateImpl>(params); | 143 web_state_ = base::MakeUnique<web::WebStateImpl>(params); |
144 web_state_->GetNavigationManagerImpl().InitializeSession(); | 144 web_state_->GetNavigationManagerImpl().InitializeSession(); |
145 WebUIIOSControllerFactory::RegisterFactory( | 145 WebUIIOSControllerFactory::RegisterFactory( |
146 new TestWebUIControllerFactory(ui_handler_.get())); | 146 new TestWebUIControllerFactory(ui_handler_.get())); |
147 } | 147 } |
148 | 148 |
| 149 void TearDown() override { |
| 150 web_state_.reset(); |
| 151 WebIntTest::TearDown(); |
| 152 } |
149 // Returns WebState which loads test WebUI page. | 153 // Returns WebState which loads test WebUI page. |
150 WebStateImpl* web_state() { return web_state_.get(); } | 154 WebStateImpl* web_state() { return web_state_.get(); } |
151 // Returns UI handler which communicates with WebUI page. | 155 // Returns UI handler which communicates with WebUI page. |
152 TestUIHandler* test_ui_handler() { return ui_handler_.get(); } | 156 TestUIHandler* test_ui_handler() { return ui_handler_.get(); } |
153 | 157 |
154 private: | 158 private: |
155 std::unique_ptr<WebStateImpl> web_state_; | 159 std::unique_ptr<WebStateImpl> web_state_; |
156 std::unique_ptr<TestUIHandler> ui_handler_; | 160 std::unique_ptr<TestUIHandler> ui_handler_; |
157 }; | 161 }; |
158 | 162 |
(...skipping 28 matching lines...) Expand all Loading... |
187 loop.Run(); | 191 loop.Run(); |
188 return test_ui_handler()->IsFinReceived(); | 192 return test_ui_handler()->IsFinReceived(); |
189 }); | 193 }); |
190 | 194 |
191 ASSERT_TRUE(fin_received); | 195 ASSERT_TRUE(fin_received); |
192 EXPECT_FALSE(web_state()->IsLoading()); | 196 EXPECT_FALSE(web_state()->IsLoading()); |
193 EXPECT_EQ(url, web_state()->GetLastCommittedURL()); | 197 EXPECT_EQ(url, web_state()->GetLastCommittedURL()); |
194 } | 198 } |
195 | 199 |
196 } // namespace web | 200 } // namespace web |
OLD | NEW |