| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/loader/LinkLoader.h" | 5 #include "core/loader/LinkLoader.h" |
| 6 | 6 |
| 7 #include "core/fetch/MemoryCache.h" | 7 #include "core/fetch/MemoryCache.h" |
| 8 #include "core/fetch/ResourceFetcher.h" | 8 #include "core/fetch/ResourceFetcher.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/html/LinkRelAttribute.h" | 10 #include "core/html/LinkRelAttribute.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 const bool linkLoaderShouldLoadValue; | 88 const bool linkLoaderShouldLoadValue; |
| 89 const bool expectingLoad; | 89 const bool expectingLoad; |
| 90 } cases[] = { | 90 } cases[] = { |
| 91 {"http://example.test/cat.jpg", "image", "", "", ResourceLoadPriorityLow, | 91 {"http://example.test/cat.jpg", "image", "", "", ResourceLoadPriorityLow, |
| 92 WebURLRequest::RequestContextImage, true, true}, | 92 WebURLRequest::RequestContextImage, true, true}, |
| 93 {"http://example.test/cat.js", "script", "", "", ResourceLoadPriorityHigh, | 93 {"http://example.test/cat.js", "script", "", "", ResourceLoadPriorityHigh, |
| 94 WebURLRequest::RequestContextScript, true, true}, | 94 WebURLRequest::RequestContextScript, true, true}, |
| 95 {"http://example.test/cat.css", "style", "", "", | 95 {"http://example.test/cat.css", "style", "", "", |
| 96 ResourceLoadPriorityVeryHigh, WebURLRequest::RequestContextStyle, true, | 96 ResourceLoadPriorityVeryHigh, WebURLRequest::RequestContextStyle, true, |
| 97 true}, | 97 true}, |
| 98 // TODO(yoav): It doesn't seem like the audio context is ever used. That s
hould probably be fixed (or we can consolidate audio and video). | 98 // TODO(yoav): It doesn't seem like the audio context is ever used. That |
| 99 // should probably be fixed (or we can consolidate audio and video). |
| 99 {"http://example.test/cat.wav", "media", "", "", ResourceLoadPriorityLow, | 100 {"http://example.test/cat.wav", "media", "", "", ResourceLoadPriorityLow, |
| 100 WebURLRequest::RequestContextVideo, true, true}, | 101 WebURLRequest::RequestContextVideo, true, true}, |
| 101 {"http://example.test/cat.mp4", "media", "", "", ResourceLoadPriorityLow, | 102 {"http://example.test/cat.mp4", "media", "", "", ResourceLoadPriorityLow, |
| 102 WebURLRequest::RequestContextVideo, true, true}, | 103 WebURLRequest::RequestContextVideo, true, true}, |
| 103 {"http://example.test/cat.vtt", "track", "", "", ResourceLoadPriorityLow, | 104 {"http://example.test/cat.vtt", "track", "", "", ResourceLoadPriorityLow, |
| 104 WebURLRequest::RequestContextTrack, true, true}, | 105 WebURLRequest::RequestContextTrack, true, true}, |
| 105 {"http://example.test/cat.woff", "font", "", "", | 106 {"http://example.test/cat.woff", "font", "", "", |
| 106 ResourceLoadPriorityVeryHigh, WebURLRequest::RequestContextFont, true, | 107 ResourceLoadPriorityVeryHigh, WebURLRequest::RequestContextFont, true, |
| 107 true}, | 108 true}, |
| 108 // TODO(yoav): subresource should be *very* low priority (rather than low)
. | 109 // TODO(yoav): subresource should be *very* low priority (rather than |
| 110 // low). |
| 109 {"http://example.test/cat.empty", "", "", "", ResourceLoadPriorityHigh, | 111 {"http://example.test/cat.empty", "", "", "", ResourceLoadPriorityHigh, |
| 110 WebURLRequest::RequestContextSubresource, true, true}, | 112 WebURLRequest::RequestContextSubresource, true, true}, |
| 111 {"http://example.test/cat.blob", "blabla", "", "", | 113 {"http://example.test/cat.blob", "blabla", "", "", |
| 112 ResourceLoadPriorityLow, WebURLRequest::RequestContextSubresource, false, | 114 ResourceLoadPriorityLow, WebURLRequest::RequestContextSubresource, false, |
| 113 false}, | 115 false}, |
| 114 {"bla://example.test/cat.gif", "image", "", "", | 116 {"bla://example.test/cat.gif", "image", "", "", |
| 115 ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextImage, | 117 ResourceLoadPriorityUnresolved, WebURLRequest::RequestContextImage, |
| 116 false, false}, | 118 false, false}, |
| 117 // MIME type tests | 119 // MIME type tests |
| 118 {"http://example.test/cat.webp", "image", "image/webp", "", | 120 {"http://example.test/cat.webp", "image", "image/webp", "", |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 loader->loadLink(LinkRelAttribute("preconnect"), testCase.crossOrigin, | 278 loader->loadLink(LinkRelAttribute("preconnect"), testCase.crossOrigin, |
| 277 String(), String(), String(), hrefURL, | 279 String(), String(), String(), hrefURL, |
| 278 dummyPageHolder->document(), networkHints); | 280 dummyPageHolder->document(), networkHints); |
| 279 EXPECT_EQ(testCase.shouldLoad, networkHints.didPreconnect()); | 281 EXPECT_EQ(testCase.shouldLoad, networkHints.didPreconnect()); |
| 280 EXPECT_EQ(testCase.isHTTPS, networkHints.isHTTPS()); | 282 EXPECT_EQ(testCase.isHTTPS, networkHints.isHTTPS()); |
| 281 EXPECT_EQ(testCase.isCrossOrigin, networkHints.isCrossOrigin()); | 283 EXPECT_EQ(testCase.isCrossOrigin, networkHints.isCrossOrigin()); |
| 282 } | 284 } |
| 283 } | 285 } |
| 284 | 286 |
| 285 } // namespace blink | 287 } // namespace blink |
| OLD | NEW |