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

Side by Side Diff: ios/web/public/test/test_web_client.mm

Issue 1996723002: Switch ResourceBundle LoadDataResourceBytes to return RefCountedMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing iOS trybots Created 4 years, 7 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
OLDNEW
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" 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 scheme = {kTestWebUIScheme, url::SCHEME_WITHOUT_PORT};
22 additional_standard_schemes->push_back(scheme); 22 additional_standard_schemes->push_back(scheme);
23 } 23 }
24 24
25 bool TestWebClient::IsAppSpecificURL(const GURL& url) const { 25 bool TestWebClient::IsAppSpecificURL(const GURL& url) const {
26 return url.SchemeIs(kTestWebUIScheme); 26 return url.SchemeIs(kTestWebUIScheme);
27 } 27 }
28 28
29 base::RefCountedStaticMemory* TestWebClient::GetDataResourceBytes( 29 base::RefCountedMemory* TestWebClient::GetDataResourceBytes(
30 int resource_id) const { 30 int resource_id) const {
31 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id); 31 return ResourceBundle::GetSharedInstance().LoadDataResourceBytes(resource_id);
32 } 32 }
33 33
34 NSString* TestWebClient::GetEarlyPageScript() const { 34 NSString* TestWebClient::GetEarlyPageScript() const {
35 return early_page_script_ ? early_page_script_.get() : @""; 35 return early_page_script_ ? early_page_script_.get() : @"";
36 } 36 }
37 37
38 void TestWebClient::SetEarlyPageScript(NSString* page_script) { 38 void TestWebClient::SetEarlyPageScript(NSString* page_script) {
39 early_page_script_.reset([page_script copy]); 39 early_page_script_.reset([page_script copy]);
40 } 40 }
41 41
42 void TestWebClient::AllowCertificateError( 42 void TestWebClient::AllowCertificateError(
43 WebState* web_state, 43 WebState* web_state,
44 int cert_error, 44 int cert_error,
45 const net::SSLInfo& ssl_info, 45 const net::SSLInfo& ssl_info,
46 const GURL& request_url, 46 const GURL& request_url,
47 bool overridable, 47 bool overridable,
48 const base::Callback<void(bool)>& callback) { 48 const base::Callback<void(bool)>& callback) {
49 last_cert_error_code_ = cert_error; 49 last_cert_error_code_ = cert_error;
50 last_cert_error_ssl_info_ = ssl_info; 50 last_cert_error_ssl_info_ = ssl_info;
51 last_cert_error_request_url_ = request_url; 51 last_cert_error_request_url_ = request_url;
52 last_cert_error_overridable_ = overridable; 52 last_cert_error_overridable_ = overridable;
53 53
54 callback.Run(false); 54 callback.Run(false);
55 } 55 }
56 56
57 } // namespace web 57 } // namespace web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698