| 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); |
| 193 } | 194 } |
| 194 | 195 |
| 195 void SetUp() override { RunSetUp(kViewportEnabled); } | 196 void SetUp() override { RunSetUp(kViewportEnabled); } |
| 196 | 197 |
| 197 void Test(TestCase test_case) { | 198 void Test(TestCase test_case) { |
| 198 MockHTMLResourcePreloader preloader; | 199 MockHTMLResourcePreloader preloader; |
| 199 KURL base_url(kParsedURLString, test_case.base_url); | 200 KURL base_url(kParsedURLString, test_case.base_url); |
| 200 scanner_->AppendToEnd(String(test_case.input_html)); | 201 scanner_->AppendToEnd(String(test_case.input_html)); |
| 201 PreloadRequestStream requests = scanner_->Scan(base_url, nullptr); | 202 PreloadRequestStream requests = scanner_->Scan(base_url, nullptr); |
| 202 preloader.TakeAndPreload(requests); | 203 preloader.TakeAndPreload(requests); |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 "sheet.css", | 898 "sheet.css", |
| 898 "http://example.test/", | 899 "http://example.test/", |
| 899 Resource::kCSSStyleSheet, | 900 Resource::kCSSStyleSheet, |
| 900 0, | 901 0, |
| 901 kReferrerPolicyAlways, | 902 kReferrerPolicyAlways, |
| 902 "http://whatever.test/"}; | 903 "http://whatever.test/"}; |
| 903 Test(test_case); | 904 Test(test_case); |
| 904 } | 905 } |
| 905 | 906 |
| 906 } // namespace blink | 907 } // namespace blink |
| OLD | NEW |