| 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/public/test/test_web_client.h" | 5 #import "ios/web/public/test/test_web_client.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ios/web/test/test_url_constants.h" |
| 9 #include "url/gurl.h" |
| 8 | 10 |
| 9 namespace web { | 11 namespace web { |
| 10 | 12 |
| 11 TestWebClient::TestWebClient() | 13 TestWebClient::TestWebClient() |
| 12 : last_cert_error_code_(0), last_cert_error_overridable_(true) {} | 14 : last_cert_error_code_(0), last_cert_error_overridable_(true) {} |
| 13 | 15 |
| 14 TestWebClient::~TestWebClient() {} | 16 TestWebClient::~TestWebClient() {} |
| 15 | 17 |
| 18 void TestWebClient::AddAdditionalSchemes( |
| 19 std::vector<url::SchemeWithType>* additional_standard_schemes) const { |
| 20 url::SchemeWithType scheme = {kTestWebUIScheme, url::SCHEME_WITHOUT_PORT}; |
| 21 additional_standard_schemes->push_back(scheme); |
| 22 } |
| 23 |
| 24 bool TestWebClient::IsAppSpecificURL(const GURL& url) const { |
| 25 return url.SchemeIs(kTestWebUIScheme); |
| 26 } |
| 27 |
| 16 NSString* TestWebClient::GetEarlyPageScript() const { | 28 NSString* TestWebClient::GetEarlyPageScript() const { |
| 17 return early_page_script_ ? early_page_script_.get() : @""; | 29 return early_page_script_ ? early_page_script_.get() : @""; |
| 18 } | 30 } |
| 19 | 31 |
| 20 void TestWebClient::SetEarlyPageScript(NSString* page_script) { | 32 void TestWebClient::SetEarlyPageScript(NSString* page_script) { |
| 21 early_page_script_.reset([page_script copy]); | 33 early_page_script_.reset([page_script copy]); |
| 22 } | 34 } |
| 23 | 35 |
| 24 void TestWebClient::AllowCertificateError( | 36 void TestWebClient::AllowCertificateError( |
| 25 WebState* web_state, | 37 WebState* web_state, |
| 26 int cert_error, | 38 int cert_error, |
| 27 const net::SSLInfo& ssl_info, | 39 const net::SSLInfo& ssl_info, |
| 28 const GURL& request_url, | 40 const GURL& request_url, |
| 29 bool overridable, | 41 bool overridable, |
| 30 const base::Callback<void(bool)>& callback) { | 42 const base::Callback<void(bool)>& callback) { |
| 31 last_cert_error_code_ = cert_error; | 43 last_cert_error_code_ = cert_error; |
| 32 last_cert_error_ssl_info_ = ssl_info; | 44 last_cert_error_ssl_info_ = ssl_info; |
| 33 last_cert_error_request_url_ = request_url; | 45 last_cert_error_request_url_ = request_url; |
| 34 last_cert_error_overridable_ = overridable; | 46 last_cert_error_overridable_ = overridable; |
| 35 | 47 |
| 36 callback.Run(false); | 48 callback.Run(false); |
| 37 } | 49 } |
| 38 | 50 |
| 39 } // namespace web | 51 } // namespace web |
| OLD | NEW |