Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Side by Side Diff: third_party/WebKit/Source/core/html/parser/HTMLPreloadScannerTest.cpp

Issue 1679703002: Revert of Create MediaValuesCached and TokenPreloadScanner on the parser thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@TRV_MediaValuesCached
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "core/MediaTypeNames.h" 7 #include "core/MediaTypeNames.h"
8 #include "core/css/MediaValuesCached.h" 8 #include "core/css/MediaValuesCached.h"
9 #include "core/fetch/ClientHintsPreferences.h" 9 #include "core/fetch/ClientHintsPreferences.h"
10 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 enum PreloadState { 97 enum PreloadState {
98 PreloadEnabled, 98 PreloadEnabled,
99 PreloadDisabled, 99 PreloadDisabled,
100 }; 100 };
101 101
102 HTMLPreloadScannerTest() 102 HTMLPreloadScannerTest()
103 : m_dummyPageHolder(DummyPageHolder::create()) 103 : m_dummyPageHolder(DummyPageHolder::create())
104 { 104 {
105 } 105 }
106 106
107 MediaValuesCached::MediaValuesCachedData createMediaValuesData() 107 PassRefPtrWillBeRawPtr<MediaValuesCached> createMediaValues()
108 { 108 {
109 MediaValuesCached::MediaValuesCachedData data; 109 MediaValuesCached::MediaValuesCachedData data;
110 data.viewportWidth = 500; 110 data.viewportWidth = 500;
111 data.viewportHeight = 600; 111 data.viewportHeight = 600;
112 data.deviceWidth = 700; 112 data.deviceWidth = 700;
113 data.deviceHeight = 800; 113 data.deviceHeight = 800;
114 data.devicePixelRatio = 2.0; 114 data.devicePixelRatio = 2.0;
115 data.colorBitsPerComponent = 24; 115 data.colorBitsPerComponent = 24;
116 data.monochromeBitsPerComponent = 0; 116 data.monochromeBitsPerComponent = 0;
117 data.primaryPointerType = PointerTypeFine; 117 data.primaryPointerType = PointerTypeFine;
118 data.defaultFontSize = 16; 118 data.defaultFontSize = 16;
119 data.threeDEnabled = true; 119 data.threeDEnabled = true;
120 data.mediaType = MediaTypeNames::screen; 120 data.mediaType = MediaTypeNames::screen;
121 data.strictMode = true; 121 data.strictMode = true;
122 data.displayMode = WebDisplayModeBrowser; 122 data.displayMode = WebDisplayModeBrowser;
123 return data; 123 return MediaValuesCached::create(data);
124 } 124 }
125 125
126 void runSetUp(ViewportState viewportState, PreloadState preloadState = Prelo adEnabled) 126 void runSetUp(ViewportState viewportState, PreloadState preloadState = Prelo adEnabled)
127 { 127 {
128 HTMLParserOptions options(&m_dummyPageHolder->document()); 128 HTMLParserOptions options(&m_dummyPageHolder->document());
129 KURL documentURL(ParsedURLString, "http://whatever.test/"); 129 KURL documentURL(ParsedURLString, "http://whatever.test/");
130 m_dummyPageHolder->document().settings()->setViewportEnabled(viewportSta te == ViewportEnabled); 130 m_dummyPageHolder->document().settings()->setViewportEnabled(viewportSta te == ViewportEnabled);
131 m_dummyPageHolder->document().settings()->setViewportMetaEnabled(viewpor tState == ViewportEnabled); 131 m_dummyPageHolder->document().settings()->setViewportMetaEnabled(viewpor tState == ViewportEnabled);
132 m_dummyPageHolder->document().settings()->setDoHtmlPreloadScanning(prelo adState == PreloadEnabled); 132 m_dummyPageHolder->document().settings()->setDoHtmlPreloadScanning(prelo adState == PreloadEnabled);
133 m_scanner = HTMLPreloadScanner::create(options, documentURL, CachedDocum entParameters::create(&m_dummyPageHolder->document()), createMediaValuesData()); 133 m_scanner = HTMLPreloadScanner::create(options, documentURL, CachedDocum entParameters::create(&m_dummyPageHolder->document(), createMediaValues()));
134 } 134 }
135 135
136 void SetUp() override 136 void SetUp() override
137 { 137 {
138 runSetUp(ViewportEnabled); 138 runSetUp(ViewportEnabled);
139 } 139 }
140 140
141 void test(TestCase testCase) 141 void test(TestCase testCase)
142 { 142 {
143 MockHTMLResourcePreloader preloader; 143 MockHTMLResourcePreloader preloader;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 {"http://example.test", "<link rel=preload href=bla as=audio>", "bla", " http://example.test/", Resource::Media, 0}, 373 {"http://example.test", "<link rel=preload href=bla as=audio>", "bla", " http://example.test/", Resource::Media, 0},
374 {"http://example.test", "<link rel=preload href=bla as=video>", "bla", " http://example.test/", Resource::Media, 0}, 374 {"http://example.test", "<link rel=preload href=bla as=video>", "bla", " http://example.test/", Resource::Media, 0},
375 {"http://example.test", "<link rel=preload href=bla as=track>", "bla", " http://example.test/", Resource::TextTrack, 0}, 375 {"http://example.test", "<link rel=preload href=bla as=track>", "bla", " http://example.test/", Resource::TextTrack, 0},
376 }; 376 };
377 377
378 for (const auto& testCase : testCases) 378 for (const auto& testCase : testCases)
379 test(testCase); 379 test(testCase);
380 } 380 }
381 381
382 } // namespace blink 382 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/parser/HTMLPreloadScanner.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698