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/html/parser/HTMLPreloadScanner.h" | 5 #include "core/html/parser/HTMLPreloadScanner.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include "core/MediaTypeNames.h" | 8 #include "core/MediaTypeNames.h" |
9 #include "core/css/MediaValuesCached.h" | 9 #include "core/css/MediaValuesCached.h" |
10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 viewport_state == kViewportEnabled); | 182 viewport_state == kViewportEnabled); |
183 dummy_page_holder_->GetDocument().GetSettings()->SetViewportMetaEnabled( | 183 dummy_page_holder_->GetDocument().GetSettings()->SetViewportMetaEnabled( |
184 viewport_state == kViewportEnabled); | 184 viewport_state == kViewportEnabled); |
185 dummy_page_holder_->GetDocument().GetSettings()->SetDoHtmlPreloadScanning( | 185 dummy_page_holder_->GetDocument().GetSettings()->SetDoHtmlPreloadScanning( |
186 preload_state == kPreloadEnabled); | 186 preload_state == kPreloadEnabled); |
187 dummy_page_holder_->GetDocument().SetReferrerPolicy( | 187 dummy_page_holder_->GetDocument().SetReferrerPolicy( |
188 document_referrer_policy); | 188 document_referrer_policy); |
189 scanner_ = HTMLPreloadScanner::Create( | 189 scanner_ = HTMLPreloadScanner::Create( |
190 options, document_url, | 190 options, document_url, |
191 CachedDocumentParameters::Create(&dummy_page_holder_->GetDocument()), | 191 CachedDocumentParameters::Create(&dummy_page_holder_->GetDocument()), |
192 CreateMediaValuesData(), | 192 CreateMediaValuesData()); |
193 TokenPreloadScanner::ScannerType::kMainDocument); | |
194 } | 193 } |
195 | 194 |
196 void SetUp() override { RunSetUp(kViewportEnabled); } | 195 void SetUp() override { RunSetUp(kViewportEnabled); } |
197 | 196 |
198 void Test(TestCase test_case) { | 197 void Test(TestCase test_case) { |
199 MockHTMLResourcePreloader preloader; | 198 MockHTMLResourcePreloader preloader; |
200 KURL base_url(kParsedURLString, test_case.base_url); | 199 KURL base_url(kParsedURLString, test_case.base_url); |
201 scanner_->AppendToEnd(String(test_case.input_html)); | 200 scanner_->AppendToEnd(String(test_case.input_html)); |
202 PreloadRequestStream requests = scanner_->Scan(base_url, nullptr); | 201 PreloadRequestStream requests = scanner_->Scan(base_url, nullptr); |
203 preloader.TakeAndPreload(requests); | 202 preloader.TakeAndPreload(requests); |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 "sheet.css", | 897 "sheet.css", |
899 "http://example.test/", | 898 "http://example.test/", |
900 Resource::kCSSStyleSheet, | 899 Resource::kCSSStyleSheet, |
901 0, | 900 0, |
902 kReferrerPolicyAlways, | 901 kReferrerPolicyAlways, |
903 "http://whatever.test/"}; | 902 "http://whatever.test/"}; |
904 Test(test_case); | 903 Test(test_case); |
905 } | 904 } |
906 | 905 |
907 } // namespace blink | 906 } // namespace blink |
OLD | NEW |