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

Unified Diff: third_party/WebKit/Source/platform/testing/WebURLLoaderMock.cpp

Issue 2657793002: Make WebURLLoaderMockFactoryImpl::createURLLoader accept nullptr (Closed)
Patch Set: base change 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/WebURLLoaderMock.cpp
diff --git a/third_party/WebKit/Source/platform/testing/WebURLLoaderMock.cpp b/third_party/WebKit/Source/platform/testing/WebURLLoaderMock.cpp
index 2133316f7405a2874af1b0aaf33521e312bf1fab..f6c9d632e92fd36587a8c3df1cabaca5eb430ef3 100644
--- a/third_party/WebKit/Source/platform/testing/WebURLLoaderMock.cpp
+++ b/third_party/WebKit/Source/platform/testing/WebURLLoaderMock.cpp
@@ -12,6 +12,17 @@
namespace blink {
+namespace {
+
+void IsFallbackLoaderAvailable(const WebURL& url,
kinuko 2017/01/25 12:42:13 I'd name this 'assertFallbackLoaderAvailability()'
Takashi Toyoshima 2017/01/26 11:54:24 Done.
+ const WebURLLoader* defaultLoader) {
+ DCHECK(KURL(url).protocolIsData()) << "shouldn't be falling back: "
+ << url.string().utf8();
+ DCHECK(defaultLoader) << "defaultLoader wasn't set: " << url.string().utf8();
+}
+
+} // namespace
+
WebURLLoaderMock::WebURLLoaderMock(WebURLLoaderMockFactoryImpl* factory,
WebURLLoader* defaultLoader)
: m_factory(factory),
@@ -104,9 +115,7 @@ void WebURLLoaderMock::loadSynchronously(const WebURLRequest& request,
&encodedDataLength);
return;
}
- DCHECK(KURL(request.url()).protocolIsData())
- << "loadSynchronously shouldn't be falling back: "
- << request.url().string().utf8();
+ IsFallbackLoaderAvailable(request.url(), m_defaultLoader.get());
m_usingDefaultLoader = true;
m_defaultLoader->loadSynchronously(request, response, error, data,
encodedDataLength, encodedBodyLength);
@@ -120,9 +129,7 @@ void WebURLLoaderMock::loadAsynchronously(const WebURLRequest& request,
m_factory->LoadAsynchronouly(request, this);
return;
}
- DCHECK(KURL(request.url()).protocolIsData())
- << "loadAsynchronously shouldn't be falling back: "
- << request.url().string().utf8();
+ IsFallbackLoaderAvailable(request.url(), m_defaultLoader.get());
m_usingDefaultLoader = true;
m_defaultLoader->loadAsynchronously(request, client);
}

Powered by Google App Engine
This is Rietveld 408576698