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

Unified Diff: third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp

Issue 2975623002: Fix: Loading cid: resources in WebView. (Closed)
Patch Set: Rebase. Created 3 years, 5 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/loader/fetch/ResourceFetcherTest.cpp
diff --git a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp
index 8adb2ddca13a76dd129f2e5f36b1221a51802ef7..313e4a6ecde2a31f22fae9a2f88aea0a8069bdae 100644
--- a/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp
+++ b/third_party/WebKit/Source/platform/loader/fetch/ResourceFetcherTest.cpp
@@ -735,4 +735,38 @@ TEST_F(ResourceFetcherTest, ContentTypeDataURL) {
EXPECT_EQ("text/testmimetype", resource->GetResponse().HttpContentType());
}
+TEST_F(ResourceFetcherTest, ContentIdURL) {
+ KURL url(kParsedURLString, "cid:0123456789@example.com");
+ ResourceResponse response;
+ response.SetURL(url);
+ response.SetHTTPStatusCode(200);
+ RegisterMockedURLLoadWithCustomResponse(url, response);
+
+ ResourceFetcher* fetcher = ResourceFetcher::Create(Context());
+
+ // Fetching a main resource with the Content-ID scheme must be canceled if
+ // there is no MHTMLArchive.
+ {
+ ResourceRequest resource_request(url);
+ resource_request.SetRequestContext(WebURLRequest::kRequestContextIframe);
+ resource_request.SetFrameType(WebURLRequest::kFrameTypeNested);
+ FetchParameters fetch_params(resource_request);
+ RawResource* resource =
+ RawResource::FetchMainResource(fetch_params, fetcher, SubstituteData());
+ EXPECT_EQ(nullptr, resource);
+ }
+
+ // For all the other resource type, it must not be canceled.
+ // Note: It is important not to cancel them because there are some embedders
+ // of WebView that are using Content-ID URLs for sub-resources, even without
+ // any MHTMLArchive. Please see https://crbug.com/739658.
+ {
+ ResourceRequest resource_request(url);
+ resource_request.SetRequestContext(WebURLRequest::kRequestContextVideo);
+ FetchParameters fetch_params(resource_request);
+ RawResource* resource = RawResource::FetchMedia(fetch_params, fetcher);
+ EXPECT_NE(nullptr, resource);
+ }
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698