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

Unified Diff: third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc

Issue 2657793002: Make WebURLLoaderMockFactoryImpl::createURLLoader accept nullptr (Closed)
Patch Set: cl format Created 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc
diff --git a/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc b/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc
index 586cab36d6a252cb24fb8fe778412fe85e053548..400934252d4d1200e9588e6e3acca68d1ac1453c 100644
--- a/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc
+++ b/third_party/WebKit/Source/platform/testing/weburl_loader_mock.cc
@@ -12,6 +12,18 @@
namespace blink {
+namespace {
+
+void assertFallbackLoaderAvailability(const WebURL& url,
+ const WebURLLoader* default_loader) {
+ DCHECK(KURL(url).protocolIsData()) << "shouldn't be falling back: "
+ << url.string().utf8();
+ DCHECK(default_loader) << "default_loader wasn't set: "
+ << url.string().utf8();
+}
+
+} // namespace
+
WebURLLoaderMock::WebURLLoaderMock(WebURLLoaderMockFactoryImpl* factory,
WebURLLoader* default_loader)
: factory_(factory),
@@ -104,9 +116,7 @@ void WebURLLoaderMock::loadSynchronously(const WebURLRequest& request,
&encoded_data_length);
return;
}
- DCHECK(KURL(request.url()).protocolIsData())
- << "loadSynchronously shouldn't be falling back: "
- << request.url().string().utf8();
+ assertFallbackLoaderAvailability(request.url(), default_loader_.get());
using_default_loader_ = true;
default_loader_->loadSynchronously(request, response, error, data,
encoded_data_length, encoded_body_length);
@@ -120,9 +130,7 @@ void WebURLLoaderMock::loadAsynchronously(const WebURLRequest& request,
factory_->LoadAsynchronouly(request, this);
return;
}
- DCHECK(KURL(request.url()).protocolIsData())
- << "loadAsynchronously shouldn't be falling back: "
- << request.url().string().utf8();
+ assertFallbackLoaderAvailability(request.url(), default_loader_.get());
using_default_loader_ = true;
default_loader_->loadAsynchronously(request, client);
}

Powered by Google App Engine
This is Rietveld 408576698