| 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 #import "base/test/ios/wait_util.h" | 9 #import "base/test/ios/wait_util.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 private: | 126 private: |
| 127 // UI handler class which communicates with test WebUI page. | 127 // UI handler class which communicates with test WebUI page. |
| 128 TestUIHandler* ui_handler_; | 128 TestUIHandler* ui_handler_; |
| 129 }; | 129 }; |
| 130 } // namespace | 130 } // namespace |
| 131 | 131 |
| 132 // A test fixture for verifying mojo comminication for WebUI. | 132 // A test fixture for verifying mojo comminication for WebUI. |
| 133 class WebUIMojoTest : public WebIntTest { | 133 class WebUIMojoTest : public WebIntTest { |
| 134 protected: | 134 protected: |
| 135 WebUIMojoTest() | 135 WebUIMojoTest() : ui_handler_(new TestUIHandler()) { |
| 136 : web_state_(new WebStateImpl(GetBrowserState())), | 136 web::WebState::CreateParams params(GetBrowserState()); |
| 137 ui_handler_(new TestUIHandler()) { | 137 web_state_ = base::MakeUnique<web::WebStateImpl>(params); |
| 138 web_state_->GetNavigationManagerImpl().InitializeSession(NO); | 138 web_state_->GetNavigationManagerImpl().InitializeSession(); |
| 139 WebUIIOSControllerFactory::RegisterFactory( | 139 WebUIIOSControllerFactory::RegisterFactory( |
| 140 new TestWebUIControllerFactory(ui_handler_.get())); | 140 new TestWebUIControllerFactory(ui_handler_.get())); |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Returns WebState which loads test WebUI page. | 143 // Returns WebState which loads test WebUI page. |
| 144 WebStateImpl* web_state() { return web_state_.get(); } | 144 WebStateImpl* web_state() { return web_state_.get(); } |
| 145 // Returns UI handler which communicates with WebUI page. | 145 // Returns UI handler which communicates with WebUI page. |
| 146 TestUIHandler* test_ui_handler() { return ui_handler_.get(); } | 146 TestUIHandler* test_ui_handler() { return ui_handler_.get(); } |
| 147 | 147 |
| 148 private: | 148 private: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 170 // of this hack. | 170 // of this hack. |
| 171 base::RunLoop loop; | 171 base::RunLoop loop; |
| 172 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 172 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 173 loop.QuitClosure()); | 173 loop.QuitClosure()); |
| 174 loop.Run(); | 174 loop.Run(); |
| 175 return test_ui_handler()->IsFinReceived(); | 175 return test_ui_handler()->IsFinReceived(); |
| 176 }); | 176 }); |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace web | 179 } // namespace web |
| OLD | NEW |