OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/html/parser/CSSPreloadScanner.h" | 5 #include "core/html/parser/CSSPreloadScanner.h" |
6 | 6 |
7 #include "core/fetch/FetchContext.h" | 7 #include "core/fetch/FetchContext.h" |
8 #include "core/fetch/Resource.h" | 8 #include "core/fetch/Resource.h" |
9 #include "core/fetch/ResourceFetcher.h" | 9 #include "core/fetch/ResourceFetcher.h" |
10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 class PreloadRecordingCSSPreloaderResourceClient final | 35 class PreloadRecordingCSSPreloaderResourceClient final |
36 : public CSSPreloaderResourceClient { | 36 : public CSSPreloaderResourceClient { |
37 public: | 37 public: |
38 PreloadRecordingCSSPreloaderResourceClient(Resource* resource, | 38 PreloadRecordingCSSPreloaderResourceClient(Resource* resource, |
39 HTMLResourcePreloader* preloader) | 39 HTMLResourcePreloader* preloader) |
40 : CSSPreloaderResourceClient(resource, preloader) {} | 40 : CSSPreloaderResourceClient(resource, preloader) {} |
41 | 41 |
42 void fetchPreloads(PreloadRequestStream& preloads) override { | 42 void fetchPreloads(PreloadRequestStream& preloads) override { |
43 for (const auto& it : preloads) | 43 for (const auto& it : preloads) |
44 m_preloadUrls.append(it->resourceURL()); | 44 m_preloadUrls.push_back(it->resourceURL()); |
45 CSSPreloaderResourceClient::fetchPreloads(preloads); | 45 CSSPreloaderResourceClient::fetchPreloads(preloads); |
46 } | 46 } |
47 | 47 |
48 Vector<String> m_preloadUrls; | 48 Vector<String> m_preloadUrls; |
49 }; | 49 }; |
50 | 50 |
51 class CSSPreloadScannerTest : public ::testing::Test {}; | 51 class CSSPreloadScannerTest : public ::testing::Test {}; |
52 | 52 |
53 } // namespace | 53 } // namespace |
54 | 54 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 const char* data = "@import url('http://127.0.0.1/preload.css');"; | 151 const char* data = "@import url('http://127.0.0.1/preload.css');"; |
152 resource->appendData(data, strlen(data)); | 152 resource->appendData(data, strlen(data)); |
153 | 153 |
154 // Do not expect to gather any preloads, as the document loader is invalid, | 154 // Do not expect to gather any preloads, as the document loader is invalid, |
155 // which means we can't notify WebLoadingBehaviorData of the preloads. | 155 // which means we can't notify WebLoadingBehaviorData of the preloads. |
156 EXPECT_EQ(0u, resourceClient->m_preloadUrls.size()); | 156 EXPECT_EQ(0u, resourceClient->m_preloadUrls.size()); |
157 } | 157 } |
158 | 158 |
159 } // namespace blink | 159 } // namespace blink |
OLD | NEW |