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

Side by Side Diff: content/test/weburl_loader_mock.cc

Issue 1568073002: Reduce string copies in GURL creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/test/weburl_loader_mock.h" 5 #include "content/test/weburl_loader_mock.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "content/child/web_url_loader_impl.h" 9 #include "content/child/web_url_loader_impl.h"
10 #include "content/test/weburl_loader_mock_factory.h" 10 #include "content/test/weburl_loader_mock_factory.h"
11 #include "third_party/WebKit/public/platform/URLConversion.h"
11 #include "third_party/WebKit/public/platform/WebData.h" 12 #include "third_party/WebKit/public/platform/WebData.h"
12 #include "third_party/WebKit/public/platform/WebURLError.h" 13 #include "third_party/WebKit/public/platform/WebURLError.h"
13 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" 14 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
14 #include "third_party/WebKit/public/platform/WebUnitTestSupport.h" 15 #include "third_party/WebKit/public/platform/WebUnitTestSupport.h"
15 16
16 WebURLLoaderMock::WebURLLoaderMock(WebURLLoaderMockFactory* factory, 17 WebURLLoaderMock::WebURLLoaderMock(WebURLLoaderMockFactory* factory,
17 blink::WebURLLoader* default_loader) 18 blink::WebURLLoader* default_loader)
18 : factory_(factory), 19 : factory_(factory),
19 client_(NULL), 20 client_(NULL),
20 default_loader_(default_loader), 21 default_loader_(default_loader),
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 data.size()); 60 data.size());
60 if (!self) 61 if (!self)
61 return; 62 return;
62 63
63 delegate->didFinishLoading(client_, this, 0, data.size()); 64 delegate->didFinishLoading(client_, this, 0, data.size());
64 } 65 }
65 66
66 blink::WebURLRequest WebURLLoaderMock::ServeRedirect( 67 blink::WebURLRequest WebURLLoaderMock::ServeRedirect(
67 const blink::WebURLRequest& request, 68 const blink::WebURLRequest& request,
68 const blink::WebURLResponse& redirectResponse) { 69 const blink::WebURLResponse& redirectResponse) {
69 GURL redirectURL(redirectResponse.httpHeaderField("Location")); 70 GURL redirectURL(
71 blink::WebStringToGURL(redirectResponse.httpHeaderField("Location")));
70 72
71 net::RedirectInfo redirectInfo; 73 net::RedirectInfo redirectInfo;
72 redirectInfo.new_method = request.httpMethod().utf8(); 74 redirectInfo.new_method = request.httpMethod().utf8();
73 redirectInfo.new_url = redirectURL; 75 redirectInfo.new_url = redirectURL;
74 redirectInfo.new_first_party_for_cookies = redirectURL; 76 redirectInfo.new_first_party_for_cookies = redirectURL;
75 77
76 blink::WebURLRequest newRequest; 78 blink::WebURLRequest newRequest;
77 newRequest.initialize(); 79 newRequest.initialize();
78 content::WebURLLoaderImpl::PopulateURLRequestForRedirect( 80 content::WebURLLoaderImpl::PopulateURLRequestForRedirect(
79 request, 81 request,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 default_loader_->setDefersLoading(deferred); 147 default_loader_->setDefersLoading(deferred);
146 return; 148 return;
147 } 149 }
148 NOTIMPLEMENTED(); 150 NOTIMPLEMENTED();
149 } 151 }
150 152
151 void WebURLLoaderMock::setLoadingTaskRunner(blink::WebTaskRunner*) { 153 void WebURLLoaderMock::setLoadingTaskRunner(blink::WebTaskRunner*) {
152 // In principle this is NOTIMPLEMENTED(), but if we put that here it floods 154 // In principle this is NOTIMPLEMENTED(), but if we put that here it floods
153 // the console during webkit unit tests, so we leave the function empty. 155 // the console during webkit unit tests, so we leave the function empty.
154 } 156 }
OLDNEW
« no previous file with comments | « content/renderer/shared_worker/embedded_shared_worker_stub.cc ('k') | mandoline/services/updater/updater_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698