| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 KURL hrefURL = KURL(KURL(), testCase.href); | 143 KURL hrefURL = KURL(KURL(), testCase.href); |
| 144 URLTestHelpers::registerMockedErrorURLLoad(hrefURL); | 144 URLTestHelpers::registerMockedErrorURLLoad(hrefURL); |
| 145 loader->loadLink(LinkRelAttribute("preload"), | 145 loader->loadLink(LinkRelAttribute("preload"), |
| 146 CrossOriginAttributeNotSet, | 146 CrossOriginAttributeNotSet, |
| 147 testCase.type, | 147 testCase.type, |
| 148 testCase.as, | 148 testCase.as, |
| 149 testCase.media, | 149 testCase.media, |
| 150 hrefURL, | 150 hrefURL, |
| 151 dummyPageHolder->document(), | 151 dummyPageHolder->document(), |
| 152 NetworkHintsMock()); | 152 NetworkHintsMock()); |
| 153 ASSERT(dummyPageHolder->document().fetcher()); | 153 DCHECK(dummyPageHolder->document().fetcher()); |
| 154 HeapListHashSet<Member<Resource>>* preloads = dummyPageHolder->document(
).fetcher()->preloads(); | 154 HeapListHashSet<Member<Resource>>* preloads = dummyPageHolder->document(
).fetcher()->preloads(); |
| 155 if (testCase.expectingLoad) { | 155 if (testCase.expectingLoad) { |
| 156 if (!preloads) | 156 if (!preloads) |
| 157 fprintf(stderr, "Unexpected result %s %s %s\n", testCase.href, t
estCase.as, testCase.type); | 157 fprintf(stderr, "Unexpected result %s %s %s\n", testCase.href, t
estCase.as, testCase.type); |
| 158 ASSERT_NE(nullptr, preloads); | 158 ASSERT_NE(nullptr, preloads); |
| 159 } else { | 159 } else { |
| 160 ASSERT_EQ(nullptr, preloads); | 160 ASSERT_EQ(nullptr, preloads); |
| 161 } | 161 } |
| 162 if (preloads) { | 162 if (preloads) { |
| 163 if (testCase.priority == ResourceLoadPriorityUnresolved) { | 163 if (testCase.priority == ResourceLoadPriorityUnresolved) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 hrefURL, | 241 hrefURL, |
| 242 dummyPageHolder->document(), | 242 dummyPageHolder->document(), |
| 243 networkHints); | 243 networkHints); |
| 244 ASSERT_EQ(testCase.shouldLoad, networkHints.didPreconnect()); | 244 ASSERT_EQ(testCase.shouldLoad, networkHints.didPreconnect()); |
| 245 ASSERT_EQ(testCase.isHTTPS, networkHints.isHTTPS()); | 245 ASSERT_EQ(testCase.isHTTPS, networkHints.isHTTPS()); |
| 246 ASSERT_EQ(testCase.isCrossOrigin, networkHints.isCrossOrigin()); | 246 ASSERT_EQ(testCase.isCrossOrigin, networkHints.isCrossOrigin()); |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace blink | 250 } // namespace blink |
| OLD | NEW |