| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/web_state/web_state_impl.h" | 5 #import "ios/web/web_state/web_state_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 238 } |
| 239 | 239 |
| 240 class WebStateTest : public web::WebTest { | 240 class WebStateTest : public web::WebTest { |
| 241 protected: | 241 protected: |
| 242 void SetUp() override { | 242 void SetUp() override { |
| 243 web_state_.reset(new WebStateImpl(&browser_state_)); | 243 web_state_.reset(new WebStateImpl(&browser_state_)); |
| 244 } | 244 } |
| 245 | 245 |
| 246 // Loads specified html page into WebState. | 246 // Loads specified html page into WebState. |
| 247 void LoadHtml(std::string html) { | 247 void LoadHtml(std::string html) { |
| 248 web_state_->GetNavigationManagerImpl().InitializeSession(nil, nil, NO, 0); | 248 web_state_->GetNavigationManagerImpl().InitializeSession(nil, NO); |
| 249 | 249 |
| 250 // Use data: url for loading html page. | 250 // Use data: url for loading html page. |
| 251 std::string encoded_html; | 251 std::string encoded_html; |
| 252 base::Base64Encode(html, &encoded_html); | 252 base::Base64Encode(html, &encoded_html); |
| 253 GURL url("data:text/html;charset=utf8;base64," + encoded_html); | 253 GURL url("data:text/html;charset=utf8;base64," + encoded_html); |
| 254 web::NavigationManager::WebLoadParams params(url); | 254 web::NavigationManager::WebLoadParams params(url); |
| 255 web_state_->GetNavigationManager()->LoadURLWithParams(params); | 255 web_state_->GetNavigationManager()->LoadURLWithParams(params); |
| 256 | 256 |
| 257 // Trigger the load. | 257 // Trigger the load. |
| 258 web_state_->SetWebUsageEnabled(true); | 258 web_state_->SetWebUsageEnabled(true); |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 "</script>"); | 674 "</script>"); |
| 675 | 675 |
| 676 base::test::ios::WaitUntilCondition(^{ | 676 base::test::ios::WaitUntilCondition(^{ |
| 677 return message_received; | 677 return message_received; |
| 678 }); | 678 }); |
| 679 web_state_->RemoveScriptCommandCallback("test"); | 679 web_state_->RemoveScriptCommandCallback("test"); |
| 680 } | 680 } |
| 681 | 681 |
| 682 } // namespace | 682 } // namespace |
| 683 } // namespace web | 683 } // namespace web |
| OLD | NEW |