Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Side by Side Diff: ios/web/test/web_test.mm

Issue 2032903002: [ios] Added WebTestWithWebController::web_state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved WebTestWithWebController::web_state to implementation. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/web/test/web_test.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/test/web_test.h" 5 #import "ios/web/test/web_test.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void WebTestWithWebController::WillProcessTask( 194 void WebTestWithWebController::WillProcessTask(
195 const base::PendingTask& pending_task) { 195 const base::PendingTask& pending_task) {
196 // Nothing to do. 196 // Nothing to do.
197 } 197 }
198 198
199 void WebTestWithWebController::DidProcessTask( 199 void WebTestWithWebController::DidProcessTask(
200 const base::PendingTask& pending_task) { 200 const base::PendingTask& pending_task) {
201 processed_a_task_ = true; 201 processed_a_task_ = true;
202 } 202 }
203 203
204 web::WebState* WebTestWithWebController::web_state() {
205 return web_state_impl_.get();
206 }
207
204 bool WebTestWithWebController::ResetPageIfNavigationStalled( 208 bool WebTestWithWebController::ResetPageIfNavigationStalled(
205 NSString* load_check) { 209 NSString* load_check) {
206 NSString* inner_html = EvaluateJavaScriptAsString( 210 NSString* inner_html = EvaluateJavaScriptAsString(
207 @"(document && document.body && document.body.innerHTML) || 'undefined'"); 211 @"(document && document.body && document.body.innerHTML) || 'undefined'");
208 if ([inner_html rangeOfString:load_check].location == NSNotFound) { 212 if ([inner_html rangeOfString:load_check].location == NSNotFound) {
209 web_state_impl_->SetWebUsageEnabled(false); 213 web_state_impl_->SetWebUsageEnabled(false);
210 web_state_impl_->SetWebUsageEnabled(true); 214 web_state_impl_->SetWebUsageEnabled(true);
211 [webController_ triggerPendingLoad]; 215 [webController_ triggerPendingLoad];
212 return true; 216 return true;
213 } 217 }
214 return false; 218 return false;
215 } 219 }
216 220
217 NSString* WebTestWithWebController::CreateLoadCheck() { 221 NSString* WebTestWithWebController::CreateLoadCheck() {
218 return [NSString stringWithFormat:@"<p style=\"display: none;\">%d</p>", 222 return [NSString stringWithFormat:@"<p style=\"display: none;\">%d</p>",
219 s_html_load_count++]; 223 s_html_load_count++];
220 } 224 }
221 225
222 } // namespace web 226 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/test/web_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698