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

Unified Diff: third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp

Issue 1839473002: Centralize the setting of Accept headers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase again Created 4 years, 8 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/core/loader/LinkLoaderTest.cpp
diff --git a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
index 8921e669c932280232b4750cc1e85bba24fad7ee..81d26fd15657b94c754258c3273cd0f0ab45e97e 100644
--- a/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
+++ b/third_party/WebKit/Source/core/loader/LinkLoaderTest.cpp
@@ -96,42 +96,41 @@ TEST(LinkLoaderTest, Preload)
const WebURLRequest::RequestContext context;
const bool linkLoaderShouldLoadValue;
const bool expectingLoad;
- const char* accept;
} cases[] = {
- {"http://example.test/cat.jpg", "image", "", "", ResourceLoadPriorityVeryLow, WebURLRequest::RequestContextImage, true, true, "image/webp,image/*,*/*;q=0.8"},
- {"http://example.test/cat.js", "script", "", "", ResourceLoadPriorityMedium, WebURLRequest::RequestContextScript, true, true, "*/*"},
- {"http://example.test/cat.css", "style", "", "", ResourceLoadPriorityHigh, WebURLRequest::RequestContextStyle, true, true, "text/css,*/*;q=0.1"},
+ {"http://example.test/cat.jpg", "image", "", "", ResourceLoadPriorityVeryLow, WebURLRequest::RequestContextImage, true, true},
+ {"http://example.test/cat.js", "script", "", "", ResourceLoadPriorityMedium, WebURLRequest::RequestContextScript, true, true},
+ {"http://example.test/cat.css", "style", "", "", ResourceLoadPriorityHigh, WebURLRequest::RequestContextStyle, true, true},
// TODO(yoav): It doesn't seem like the audio context is ever used. That should probably be fixed (or we can consolidate audio and video).
- {"http://example.test/cat.wav", "media", "", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextVideo, true, true, ""},
- {"http://example.test/cat.mp4", "media", "", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextVideo, true, true, ""},
- {"http://example.test/cat.vtt", "track", "", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextTrack, true, true, ""},
- {"http://example.test/cat.woff", "font", "", "", ResourceLoadPriorityMedium, WebURLRequest::RequestContextFont, true, true, ""},
+ {"http://example.test/cat.wav", "media", "", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextVideo, true, true},
+ {"http://example.test/cat.mp4", "media", "", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextVideo, true, true},
+ {"http://example.test/cat.vtt", "track", "", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextTrack, true, true},
+ {"http://example.test/cat.woff", "font", "", "", ResourceLoadPriorityMedium, WebURLRequest::RequestContextFont, true, true},
// TODO(yoav): subresource should be *very* low priority (rather than low).
- {"http://example.test/cat.empty", "", "", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextSubresource, true, true, ""},
- {"http://example.test/cat.blob", "blabla", "", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextSubresource, false, false, ""},
- {"bla://example.test/cat.gif", "image", "", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextImage, false, false, ""},
+ {"http://example.test/cat.empty", "", "", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextSubresource, true, true},
+ {"http://example.test/cat.blob", "blabla", "", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextSubresource, false, false},
+ {"bla://example.test/cat.gif", "image", "", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextImage, false, false},
// MIME type tests
- {"http://example.test/cat.webp", "image", "image/webp", "", ResourceLoadPriorityVeryLow, WebURLRequest::RequestContextImage, true, true, "image/webp,image/*,*/*;q=0.8"},
- {"http://example.test/cat.svg", "image", "image/svg+xml", "", ResourceLoadPriorityVeryLow, WebURLRequest::RequestContextImage, true, true, "image/webp,image/*,*/*;q=0.8"},
- {"http://example.test/cat.jxr", "image", "image/jxr", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextImage, false, false, ""},
- {"http://example.test/cat.js", "script", "text/javascript", "", ResourceLoadPriorityMedium, WebURLRequest::RequestContextScript, true, true, "*/*"},
- {"http://example.test/cat.js", "script", "text/coffeescript", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextScript, false, false, ""},
- {"http://example.test/cat.css", "style", "text/css", "", ResourceLoadPriorityHigh, WebURLRequest::RequestContextStyle, true, true, "text/css,*/*;q=0.1"},
- {"http://example.test/cat.css", "style", "text/sass", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextStyle, false, false, ""},
- {"http://example.test/cat.wav", "media", "audio/wav", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextVideo, true, true, ""},
- {"http://example.test/cat.wav", "media", "audio/mp57", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextVideo, false, false, ""},
- {"http://example.test/cat.webm", "media", "video/webm", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextVideo, true, true, ""},
- {"http://example.test/cat.mp199", "media", "video/mp199", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextVideo, false, false, ""},
- {"http://example.test/cat.vtt", "track", "text/vtt", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextTrack, true, true, ""},
- {"http://example.test/cat.vtt", "track", "text/subtitlething", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextTrack, false, false, ""},
- {"http://example.test/cat.woff", "font", "font/woff2", "", ResourceLoadPriorityMedium, WebURLRequest::RequestContextFont, true, true, ""},
- {"http://example.test/cat.woff", "font", "font/woff84", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextFont, false, false, ""},
- {"http://example.test/cat.empty", "", "foo/bar", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextSubresource, true, true, ""},
- {"http://example.test/cat.blob", "blabla", "foo/bar", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextSubresource, false, false, ""},
+ {"http://example.test/cat.webp", "image", "image/webp", "", ResourceLoadPriorityVeryLow, WebURLRequest::RequestContextImage, true, true},
+ {"http://example.test/cat.svg", "image", "image/svg+xml", "", ResourceLoadPriorityVeryLow, WebURLRequest::RequestContextImage, true, true},
+ {"http://example.test/cat.jxr", "image", "image/jxr", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextImage, false, false},
+ {"http://example.test/cat.js", "script", "text/javascript", "", ResourceLoadPriorityMedium, WebURLRequest::RequestContextScript, true, true},
+ {"http://example.test/cat.js", "script", "text/coffeescript", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextScript, false, false},
+ {"http://example.test/cat.css", "style", "text/css", "", ResourceLoadPriorityHigh, WebURLRequest::RequestContextStyle, true, true},
+ {"http://example.test/cat.css", "style", "text/sass", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextStyle, false, false},
+ {"http://example.test/cat.wav", "media", "audio/wav", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextVideo, true, true},
+ {"http://example.test/cat.wav", "media", "audio/mp57", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextVideo, false, false},
+ {"http://example.test/cat.webm", "media", "video/webm", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextVideo, true, true},
+ {"http://example.test/cat.mp199", "media", "video/mp199", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextVideo, false, false},
+ {"http://example.test/cat.vtt", "track", "text/vtt", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextTrack, true, true},
+ {"http://example.test/cat.vtt", "track", "text/subtitlething", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextTrack, false, false},
+ {"http://example.test/cat.woff", "font", "font/woff2", "", ResourceLoadPriorityMedium, WebURLRequest::RequestContextFont, true, true},
+ {"http://example.test/cat.woff", "font", "font/woff84", "", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextFont, false, false},
+ {"http://example.test/cat.empty", "", "foo/bar", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextSubresource, true, true},
+ {"http://example.test/cat.blob", "blabla", "foo/bar", "", ResourceLoadPriorityLow, WebURLRequest::RequestContextSubresource, false, false},
// Media tests
- {"http://example.test/cat.gif", "image", "image/gif", "(max-width: 600px)", ResourceLoadPriorityVeryLow, WebURLRequest::RequestContextImage, true, true, "image/webp,image/*,*/*;q=0.8"},
- {"http://example.test/cat.gif", "image", "image/gif", "(max-width: 400px)", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextImage, true, false, ""},
- {"http://example.test/cat.gif", "image", "image/gif", "(max-width: 600px)", ResourceLoadPriorityVeryLow, WebURLRequest::RequestContextImage, false, false, "image/webp,image/*,*/*;q=0.8"},
+ {"http://example.test/cat.gif", "image", "image/gif", "(max-width: 600px)", ResourceLoadPriorityVeryLow, WebURLRequest::RequestContextImage, true, true},
+ {"http://example.test/cat.gif", "image", "image/gif", "(max-width: 400px)", ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextImage, true, false},
+ {"http://example.test/cat.gif", "image", "image/gif", "(max-width: 600px)", ResourceLoadPriorityVeryLow, WebURLRequest::RequestContextImage, false, false},
};
// Test the cases with a single header
@@ -168,7 +167,6 @@ TEST(LinkLoaderTest, Preload)
Resource* resource = preloads->begin().get()->get();
ASSERT_EQ(testCase.priority, resource->resourceRequest().priority());
ASSERT_EQ(testCase.context, resource->resourceRequest().requestContext());
- ASSERT_STREQ(testCase.accept, resource->accept().getString().ascii().data());
}
}
dummyPageHolder->document().fetcher()->clearPreloads();

Powered by Google App Engine
This is Rietveld 408576698