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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 url.SchemeIs(kTestNativeContentScheme); | 32 url.SchemeIs(kTestNativeContentScheme); |
33 } | 33 } |
34 | 34 |
35 base::RefCountedMemory* TestWebClient::GetDataResourceBytes( | 35 base::RefCountedMemory* TestWebClient::GetDataResourceBytes( |
36 int resource_id) const { | 36 int resource_id) const { |
37 if (!ResourceBundle::HasSharedInstance()) | 37 if (!ResourceBundle::HasSharedInstance()) |
38 return nullptr; | 38 return nullptr; |
39 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id); | 39 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id); |
40 } | 40 } |
41 | 41 |
42 NSString* TestWebClient::GetEarlyPageScript() const { | 42 NSString* TestWebClient::GetEarlyPageScript(BrowserState* browser_state) const { |
43 return early_page_script_ ? early_page_script_.get() : @""; | 43 return early_page_script_ ? early_page_script_.get() : @""; |
44 } | 44 } |
45 | 45 |
46 void TestWebClient::SetEarlyPageScript(NSString* page_script) { | 46 void TestWebClient::SetEarlyPageScript(NSString* page_script) { |
47 early_page_script_.reset([page_script copy]); | 47 early_page_script_.reset([page_script copy]); |
48 } | 48 } |
49 | 49 |
50 void TestWebClient::AllowCertificateError( | 50 void TestWebClient::AllowCertificateError( |
51 WebState* web_state, | 51 WebState* web_state, |
52 int cert_error, | 52 int cert_error, |
53 const net::SSLInfo& ssl_info, | 53 const net::SSLInfo& ssl_info, |
54 const GURL& request_url, | 54 const GURL& request_url, |
55 bool overridable, | 55 bool overridable, |
56 const base::Callback<void(bool)>& callback) { | 56 const base::Callback<void(bool)>& callback) { |
57 last_cert_error_code_ = cert_error; | 57 last_cert_error_code_ = cert_error; |
58 last_cert_error_ssl_info_ = ssl_info; | 58 last_cert_error_ssl_info_ = ssl_info; |
59 last_cert_error_request_url_ = request_url; | 59 last_cert_error_request_url_ = request_url; |
60 last_cert_error_overridable_ = overridable; | 60 last_cert_error_overridable_ = overridable; |
61 | 61 |
62 callback.Run(false); | 62 callback.Run(false); |
63 } | 63 } |
64 | 64 |
65 } // namespace web | 65 } // namespace web |
OLD | NEW |