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

Side by Side Diff: webkit/support/weburl_loader_mock.cc

Issue 17229012: don't let weburl_loader_mock fallback for non-data urls (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use GURL Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/support/weburl_loader_mock.h" 5 #include "webkit/support/weburl_loader_mock.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/WebKit/public/platform/WebData.h" 8 #include "third_party/WebKit/public/platform/WebData.h"
9 #include "third_party/WebKit/public/platform/WebURLError.h" 9 #include "third_party/WebKit/public/platform/WebURLError.h"
10 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" 10 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 void WebURLLoaderMock::loadSynchronously(const WebKit::WebURLRequest& request, 53 void WebURLLoaderMock::loadSynchronously(const WebKit::WebURLRequest& request,
54 WebKit::WebURLResponse& response, 54 WebKit::WebURLResponse& response,
55 WebKit::WebURLError& error, 55 WebKit::WebURLError& error,
56 WebKit::WebData& data) { 56 WebKit::WebData& data) {
57 if (factory_->IsMockedURL(request.url())) { 57 if (factory_->IsMockedURL(request.url())) {
58 factory_->LoadSynchronously(request, &response, &error, &data); 58 factory_->LoadSynchronously(request, &response, &error, &data);
59 return; 59 return;
60 } 60 }
61 DCHECK(static_cast<const GURL&>(request.url()).SchemeIs("data"))
jamesr 2013/06/20 04:36:21 oh C++. you so silly
62 << "loadSynchronously shouldn't be falling back: "
63 << request.url().spec().data();
61 using_default_loader_ = true; 64 using_default_loader_ = true;
62 default_loader_->loadSynchronously(request, response, error, data); 65 default_loader_->loadSynchronously(request, response, error, data);
63 } 66 }
64 67
65 void WebURLLoaderMock::loadAsynchronously(const WebKit::WebURLRequest& request, 68 void WebURLLoaderMock::loadAsynchronously(const WebKit::WebURLRequest& request,
66 WebKit::WebURLLoaderClient* client) { 69 WebKit::WebURLLoaderClient* client) {
67 if (factory_->IsMockedURL(request.url())) { 70 if (factory_->IsMockedURL(request.url())) {
68 client_ = client; 71 client_ = client;
69 factory_->LoadAsynchronouly(request, this); 72 factory_->LoadAsynchronouly(request, this);
70 return; 73 return;
71 } 74 }
75 DCHECK(static_cast<const GURL&>(request.url()).SchemeIs("data"))
76 << "loadAsynchronously shouldn't be falling back: "
77 << request.url().spec().data();
72 using_default_loader_ = true; 78 using_default_loader_ = true;
73 default_loader_->loadAsynchronously(request, client); 79 default_loader_->loadAsynchronously(request, client);
74 } 80 }
75 81
76 void WebURLLoaderMock::cancel() { 82 void WebURLLoaderMock::cancel() {
77 if (using_default_loader_) { 83 if (using_default_loader_) {
78 default_loader_->cancel(); 84 default_loader_->cancel();
79 return; 85 return;
80 } 86 }
81 client_ = NULL; 87 client_ = NULL;
82 factory_->CancelLoad(this); 88 factory_->CancelLoad(this);
83 } 89 }
84 90
85 void WebURLLoaderMock::setDefersLoading(bool deferred) { 91 void WebURLLoaderMock::setDefersLoading(bool deferred) {
86 is_deferred_ = deferred; 92 is_deferred_ = deferred;
87 if (using_default_loader_) { 93 if (using_default_loader_) {
88 default_loader_->setDefersLoading(deferred); 94 default_loader_->setDefersLoading(deferred);
89 return; 95 return;
90 } 96 }
91 NOTIMPLEMENTED(); 97 NOTIMPLEMENTED();
92 } 98 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698