| 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/fakes/test_web_client.h" | 5 #import "ios/web/public/test/fakes/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" | 8 #include "ios/web/test/test_url_constants.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| 11 | 11 |
| 12 namespace web { | 12 namespace web { |
| 13 | 13 |
| 14 TestWebClient::TestWebClient() | 14 TestWebClient::TestWebClient() |
| 15 : last_cert_error_code_(0), last_cert_error_overridable_(true) {} | 15 : last_cert_error_code_(0), last_cert_error_overridable_(true) {} |
| 16 | 16 |
| 17 TestWebClient::~TestWebClient() {} | 17 TestWebClient::~TestWebClient() {} |
| 18 | 18 |
| 19 void TestWebClient::AddAdditionalSchemes( | 19 void TestWebClient::AddAdditionalSchemes( |
| 20 std::vector<url::SchemeWithType>* additional_standard_schemes) const { | 20 std::vector<url::SchemeWithType>* additional_standard_schemes) const { |
| 21 url::SchemeWithType scheme = {kTestWebUIScheme, url::SCHEME_WITHOUT_PORT}; | 21 url::SchemeWithType web_ui_scheme = {kTestWebUIScheme, |
| 22 additional_standard_schemes->push_back(scheme); | 22 url::SCHEME_WITHOUT_PORT}; |
| 23 additional_standard_schemes->push_back(web_ui_scheme); |
| 24 |
| 25 url::SchemeWithType native_scheme = {kTestNativeContentScheme, |
| 26 url::SCHEME_WITHOUT_PORT}; |
| 27 additional_standard_schemes->push_back(native_scheme); |
| 23 } | 28 } |
| 24 | 29 |
| 25 bool TestWebClient::IsAppSpecificURL(const GURL& url) const { | 30 bool TestWebClient::IsAppSpecificURL(const GURL& url) const { |
| 26 return url.SchemeIs(kTestWebUIScheme); | 31 return url.SchemeIs(kTestWebUIScheme) || |
| 32 url.SchemeIs(kTestNativeContentScheme); |
| 27 } | 33 } |
| 28 | 34 |
| 29 base::RefCountedMemory* TestWebClient::GetDataResourceBytes( | 35 base::RefCountedMemory* TestWebClient::GetDataResourceBytes( |
| 30 int resource_id) const { | 36 int resource_id) const { |
| 31 if (!ResourceBundle::HasSharedInstance()) | 37 if (!ResourceBundle::HasSharedInstance()) |
| 32 return nullptr; | 38 return nullptr; |
| 33 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id); | 39 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id); |
| 34 } | 40 } |
| 35 | 41 |
| 36 NSString* TestWebClient::GetEarlyPageScript() const { | 42 NSString* TestWebClient::GetEarlyPageScript() const { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 50 const base::Callback<void(bool)>& callback) { | 56 const base::Callback<void(bool)>& callback) { |
| 51 last_cert_error_code_ = cert_error; | 57 last_cert_error_code_ = cert_error; |
| 52 last_cert_error_ssl_info_ = ssl_info; | 58 last_cert_error_ssl_info_ = ssl_info; |
| 53 last_cert_error_request_url_ = request_url; | 59 last_cert_error_request_url_ = request_url; |
| 54 last_cert_error_overridable_ = overridable; | 60 last_cert_error_overridable_ = overridable; |
| 55 | 61 |
| 56 callback.Run(false); | 62 callback.Run(false); |
| 57 } | 63 } |
| 58 | 64 |
| 59 } // namespace web | 65 } // namespace web |
| OLD | NEW |