-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a few tests for whether CSS subresources are critical #5525
Open
gsnedders
wants to merge
1
commit into
web-platform-tests:master
Choose a base branch
from
gsnedders:css-subresources
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
css/css-values/subresource-criticality/tentative/background-image.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>background-image blocks load</title> | ||
<link rel=help href="https://github.com/w3c/csswg-drafts/issues/1088"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id=foo></div> | ||
<style> | ||
#foo { | ||
width: 100px; | ||
height: 100px; | ||
background: url("/images/blue.png?pipe=trickle(d1)"); | ||
} | ||
</style> | ||
<script> | ||
var t1 = performance.timing.responseStart; | ||
|
||
async_test(function(t) { | ||
window.addEventListener("load", t.step_func_done(function() { | ||
var t2 = Date.now(); | ||
var diff = t2 - t1; | ||
assert_greater_than(diff, 1000, "ms after style"); | ||
})); | ||
}, "load waits for background-image"); | ||
</script> |
23 changes: 23 additions & 0 deletions
23
css/css-values/subresource-criticality/tentative/font-face-unused.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>unused @font-face blocks load</title> | ||
<link rel=help href="https://github.com/w3c/csswg-drafts/issues/1088"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style> | ||
@font-face { | ||
font-family: Revalia; | ||
src: url("/fonts/Revalia.woff?pipe=trickle(d1)"); | ||
} | ||
</style> | ||
<script> | ||
var t1 = performance.timing.responseStart; | ||
|
||
async_test(function(t) { | ||
window.addEventListener("load", t.step_func_done(function() { | ||
var t2 = Date.now(); | ||
var diff = t2 - t1; | ||
assert_less_than(diff, 1000, "ms after style"); | ||
})); | ||
}, "load doesn't wait for unused @font-face"); | ||
</script> |
27 changes: 27 additions & 0 deletions
27
css/css-values/subresource-criticality/tentative/font-face-used.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>used @font-face blocks load</title> | ||
<link rel=help href="https://github.com/w3c/csswg-drafts/issues/1088"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style> | ||
@font-face { | ||
font-family: Revalia; | ||
src: url("/fonts/Revalia.woff?pipe=trickle(d1)"); | ||
} | ||
#foo { | ||
font: 25px/1 Revalia; | ||
} | ||
</style> | ||
<div id=foo>XXX</div> | ||
<script> | ||
var t1 = performance.timing.responseStart; | ||
|
||
async_test(function(t) { | ||
window.addEventListener("load", t.step_func_done(function() { | ||
var t2 = Date.now(); | ||
var diff = t2 - t1; | ||
assert_greater_than(diff, 1000, "ms after style"); | ||
})); | ||
}, "load waits for used @font-face"); | ||
</script> |
25 changes: 25 additions & 0 deletions
25
css/css-values/subresource-criticality/tentative/import.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>@import blocks load</title> | ||
<link rel=help href="https://github.com/w3c/csswg-drafts/issues/1088"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script> | ||
</script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this |
||
<style> | ||
@import "support/import.css?pipe=trickle(d1)"; | ||
</style> | ||
<div id=foo>XXX</div> | ||
<script> | ||
var t1 = performance.timing.responseStart; | ||
|
||
async_test(function(t) { | ||
window.addEventListener("load", t.step_func_done(function() { | ||
var t2 = Date.now(); | ||
var diff = t2 - t1; | ||
assert_greater_than(diff, 1000, "ms after style"); | ||
var style = getComputedStyle(document.querySelector("#foo")); | ||
assert_equals(style.getPropertyValue("color"), "rgb(0, 0, 255)", "#foo.color"); | ||
})); | ||
}, "load waits for @import"); | ||
</script> |
23 changes: 23 additions & 0 deletions
23
css/css-values/subresource-criticality/tentative/list-style-image.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>list-style blocks load</title> | ||
<link rel=help href="https://github.com/w3c/csswg-drafts/issues/1088"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<ul id=foo><li>XXX</ul> | ||
<style> | ||
#foo { | ||
list-style: url("/images/blue.png?pipe=trickle(d1)"); | ||
} | ||
</style> | ||
<script> | ||
var t1 = performance.timing.responseStart; | ||
|
||
async_test(function(t) { | ||
window.addEventListener("load", t.step_func_done(function() { | ||
var t2 = Date.now(); | ||
var diff = t2 - t1; | ||
assert_greater_than(diff, 1000, "ms after style"); | ||
})); | ||
}, "load waits for list-style"); | ||
</script> |
3 changes: 3 additions & 0 deletions
3
css/css-values/subresource-criticality/tentative/support/import.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#foo { | ||
color: blue; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 2/4 font-using tests in this PR, the
id=foo
element comes before the<style>
that includes the font, and in the other 2/4 it is the opposite. Can we make this consistent? (Not that it really matters much...)