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 #import "ios/web/public/test/web_test_with_web_state.h" | 5 #import "ios/web/public/test/web_test_with_web_state.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #import "base/test/ios/wait_util.h" | 9 #import "base/test/ios/wait_util.h" |
10 #import "ios/web/navigation/navigation_manager_impl.h" | |
10 #include "ios/web/public/web_state/url_verification_constants.h" | 11 #include "ios/web/public/web_state/url_verification_constants.h" |
11 #include "ios/web/public/web_state/web_state_observer.h" | 12 #include "ios/web/public/web_state/web_state_observer.h" |
12 #import "ios/web/web_state/ui/crw_web_controller.h" | 13 #import "ios/web/web_state/ui/crw_web_controller.h" |
13 #import "ios/web/web_state/web_state_impl.h" | 14 #import "ios/web/web_state/web_state_impl.h" |
14 | 15 |
15 namespace { | 16 namespace { |
16 // Returns CRWWebController for the given |web_state|. | 17 // Returns CRWWebController for the given |web_state|. |
17 CRWWebController* GetWebController(web::WebState* web_state) { | 18 CRWWebController* GetWebController(web::WebState* web_state) { |
18 web::WebStateImpl* web_state_impl = | 19 web::WebStateImpl* web_state_impl = |
19 static_cast<web::WebStateImpl*>(web_state); | 20 static_cast<web::WebStateImpl*>(web_state); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 } | 142 } |
142 | 143 |
143 web::WebState* WebTestWithWebState::web_state() { | 144 web::WebState* WebTestWithWebState::web_state() { |
144 return web_state_.get(); | 145 return web_state_.get(); |
145 } | 146 } |
146 | 147 |
147 const web::WebState* WebTestWithWebState::web_state() const { | 148 const web::WebState* WebTestWithWebState::web_state() const { |
148 return web_state_.get(); | 149 return web_state_.get(); |
149 } | 150 } |
150 | 151 |
152 void WebTestWithWebState::AddPendingItem(const GURL& url, | |
153 ui::PageTransition transition) { | |
154 WebStateImpl* web_state = static_cast<web::WebStateImpl*>(web_state_.get()); | |
155 web_state->GetNavigationManagerImpl().AddPendingItem( | |
Eugene But (OOO till 7-30)
2017/04/04 18:22:31
GetWebController(web_state())->GetNavigationManage
liaoyuke
2017/04/04 21:15:40
Done.
| |
156 url, Referrer(), transition, | |
157 web::NavigationInitiationType::USER_INITIATED, | |
158 web::NavigationManager::UserAgentOverrideOption::INHERIT); | |
159 } | |
160 | |
151 void WebTestWithWebState::WillProcessTask(const base::PendingTask&) { | 161 void WebTestWithWebState::WillProcessTask(const base::PendingTask&) { |
152 // Nothing to do. | 162 // Nothing to do. |
153 } | 163 } |
154 | 164 |
155 void WebTestWithWebState::DidProcessTask(const base::PendingTask&) { | 165 void WebTestWithWebState::DidProcessTask(const base::PendingTask&) { |
156 processed_a_task_ = true; | 166 processed_a_task_ = true; |
157 } | 167 } |
158 | 168 |
159 } // namespace web | 169 } // namespace web |
OLD | NEW |