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

Unified Diff: third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp

Issue 1805653002: Add regression test for crbug.com/594072 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
index 873156876f6fe1b75977607bd3a62a25a81e6b11..f57de5388d8bff36e9cc7282186eda7877ace5d6 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp
@@ -34,6 +34,7 @@
#include "core/fetch/FetchInitiatorTypeNames.h"
#include "core/fetch/FetchRequest.h"
#include "core/fetch/MemoryCache.h"
+#include "core/fetch/RawResource.h"
#include "core/fetch/ResourceLoader.h"
#include "platform/exported/WrappedResourceResponse.h"
#include "platform/heap/Handle.h"
@@ -237,4 +238,31 @@ TEST_F(ResourceFetcherTest, DontReuseMediaDataUrl)
memoryCache()->remove(resource2.get());
}
+class ServeRequestsOnCompleteClient : public RawResourceClient {
+public:
+ void notifyFinished(Resource*) override
+ {
+ Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
+ }
+
hiroshige 2016/03/15 21:52:34 In addition to the RELEASE_ASSERT, how about addin
Nate Chapin 2016/03/16 17:04:03 Done.
+ String debugName() const override { return "ServeRequestsOnCompleteClient"; }
+};
+
+TEST_F(ResourceFetcherTest, ResponseOnCancel)
hiroshige 2016/03/15 21:52:34 How about adding comments that have - link to Issu
Nate Chapin 2016/03/16 17:04:03 Done.
+{
+ KURL url(ParsedURLString, "http://127.0.0.1:8000/foo.html");
+ ResourceResponse response;
+ response.setURL(url);
+ response.setHTTPStatusCode(200);
+ URLTestHelpers::registerMockedURLLoadWithCustomResponse(url, "white-1x1.png", WebString::fromUTF8(""), WrappedResourceResponse(response));
+
+ ResourceFetcher* fetcher = ResourceFetcher::create(ResourceFetcherTestMockFetchContext::create());
+ FetchRequest fetchRequest = FetchRequest(url, FetchInitiatorInfo());
+ RefPtrWillBeRawPtr<Resource> resource = fetcher->requestResource(fetchRequest, TestResourceFactory(Resource::Raw));
+ ServeRequestsOnCompleteClient client;
+ resource->addClient(&client);
+ resource->loader()->cancel();
+ Platform::current()->unitTestSupport()->unregisterMockedURL(url);
+}
+
} // namespace blink
« 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