forked from LadybirdBrowser/ladybird
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LibWeb: Implement "get time origin timestamp" AO
- Loading branch information
Showing
15 changed files
with
201 additions
and
18 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
27 changes: 27 additions & 0 deletions
27
Tests/LibWeb/Text/expected/wpt-import/user-timing/mark.any.txt
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 @@ | ||
Harness status: OK | ||
|
||
Found 22 tests | ||
|
||
22 Pass | ||
Pass Entry 0 is properly created | ||
Pass Entry 1 is properly created | ||
Pass Entry 0 has the proper name | ||
Pass Entry 0 startTime is approximately correct (up to 20ms difference allowed) | ||
Pass Entry 0 has the proper entryType | ||
Pass Entry 0 duration == 0 | ||
Pass getEntriesByName("mark", "mark")[0] returns an object containing a "mark" mark | ||
Pass The mark returned by getEntriesByName("mark", "mark")[0] matches the mark returned by getEntriesByName("mark")[0] | ||
Pass getEntries()[0] returns an object containing a "mark" mark | ||
Pass The mark returned by getEntries()[0] matches the mark returned by getEntriesByName("mark")[0] | ||
Pass getEntriesByType("mark")[0] returns an object containing a "mark" mark | ||
Pass The mark returned by getEntriesByType("mark")[0] matches the mark returned by getEntriesByName("mark")[0] | ||
Pass Entry 1 has the proper name | ||
Pass Entry 1 startTime is approximately correct (up to 20ms difference allowed) | ||
Pass Entry 1 has the proper entryType | ||
Pass Entry 1 duration == 0 | ||
Pass getEntriesByName("mark", "mark")[1] returns an object containing a "mark" mark | ||
Pass The mark returned by getEntriesByName("mark", "mark")[1] matches the mark returned by getEntriesByName("mark")[1] | ||
Pass getEntries()[1] returns an object containing a "mark" mark | ||
Pass The mark returned by getEntries()[1] matches the mark returned by getEntriesByName("mark")[1] | ||
Pass getEntriesByType("mark")[1] returns an object containing a "mark" mark | ||
Pass The mark returned by getEntriesByType("mark")[1] matches the mark returned by getEntriesByName("mark")[1] |
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
15 changes: 15 additions & 0 deletions
15
Tests/LibWeb/Text/input/wpt-import/user-timing/mark.any.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,15 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
|
||
<script> | ||
self.GLOBAL = { | ||
isWindow: function() { return true; }, | ||
isWorker: function() { return false; }, | ||
isShadowRealm: function() { return false; }, | ||
}; | ||
</script> | ||
<script src="../resources/testharness.js"></script> | ||
<script src="../resources/testharnessreport.js"></script> | ||
|
||
<div id=log></div> | ||
<script src="../user-timing/mark.any.js"></script> |
118 changes: 118 additions & 0 deletions
118
Tests/LibWeb/Text/input/wpt-import/user-timing/mark.any.js
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,118 @@ | ||
// test data | ||
var testThreshold = 20; | ||
|
||
var expectedTimes = new Array(); | ||
|
||
function match_entries(entries, index) | ||
{ | ||
var entry = entries[index]; | ||
var match = self.performance.getEntriesByName("mark")[index]; | ||
assert_equals(entry.name, match.name, "entry.name"); | ||
assert_equals(entry.startTime, match.startTime, "entry.startTime"); | ||
assert_equals(entry.entryType, match.entryType, "entry.entryType"); | ||
assert_equals(entry.duration, match.duration, "entry.duration"); | ||
} | ||
|
||
function filter_entries_by_type(entryList, entryType) | ||
{ | ||
var testEntries = new Array(); | ||
|
||
// filter entryList | ||
for (var i in entryList) | ||
{ | ||
if (entryList[i].entryType == entryType) | ||
{ | ||
testEntries.push(entryList[i]); | ||
} | ||
} | ||
|
||
return testEntries; | ||
} | ||
|
||
test(function () { | ||
// create first mark | ||
self.performance.mark("mark"); | ||
|
||
expectedTimes[0] = self.performance.now(); | ||
|
||
const entries = self.performance.getEntriesByName("mark"); | ||
assert_equals(entries.length, 1); | ||
}, "Entry 0 is properly created"); | ||
|
||
test(function () { | ||
// create second, duplicate mark | ||
self.performance.mark("mark"); | ||
|
||
expectedTimes[1] = self.performance.now(); | ||
|
||
const entries = self.performance.getEntriesByName("mark"); | ||
assert_equals(entries.length, 2); | ||
|
||
}, "Entry 1 is properly created"); | ||
|
||
function test_mark(index) { | ||
test(function () { | ||
const entries = self.performance.getEntriesByName("mark"); | ||
assert_equals(entries[index].name, "mark", "Entry has the proper name"); | ||
}, "Entry " + index + " has the proper name"); | ||
|
||
test(function () { | ||
const entries = self.performance.getEntriesByName("mark"); | ||
assert_approx_equals(entries[index].startTime, expectedTimes[index], testThreshold); | ||
}, "Entry " + index + " startTime is approximately correct (up to " + testThreshold + | ||
"ms difference allowed)"); | ||
|
||
test(function () { | ||
const entries = self.performance.getEntriesByName("mark"); | ||
assert_equals(entries[index].entryType, "mark"); | ||
}, "Entry " + index + " has the proper entryType"); | ||
|
||
test(function () { | ||
const entries = self.performance.getEntriesByName("mark"); | ||
assert_equals(entries[index].duration, 0); | ||
}, "Entry " + index + " duration == 0"); | ||
|
||
test(function () { | ||
const entries = self.performance.getEntriesByName("mark", "mark"); | ||
assert_equals(entries[index].name, "mark"); | ||
}, "getEntriesByName(\"mark\", \"mark\")[" + index + "] returns an " + | ||
"object containing a \"mark\" mark"); | ||
|
||
test(function () { | ||
const entries = self.performance.getEntriesByName("mark", "mark"); | ||
match_entries(entries, index); | ||
}, "The mark returned by getEntriesByName(\"mark\", \"mark\")[" + index | ||
+ "] matches the mark returned by " + | ||
"getEntriesByName(\"mark\")[" + index + "]"); | ||
|
||
test(function () { | ||
const entries = filter_entries_by_type(self.performance.getEntries(), "mark"); | ||
assert_equals(entries[index].name, "mark"); | ||
}, "getEntries()[" + index + "] returns an " + | ||
"object containing a \"mark\" mark"); | ||
|
||
test(function () { | ||
const entries = filter_entries_by_type(self.performance.getEntries(), "mark"); | ||
match_entries(entries, index); | ||
}, "The mark returned by getEntries()[" + index | ||
+ "] matches the mark returned by " + | ||
"getEntriesByName(\"mark\")[" + index + "]"); | ||
|
||
test(function () { | ||
const entries = self.performance.getEntriesByType("mark"); | ||
assert_equals(entries[index].name, "mark"); | ||
}, "getEntriesByType(\"mark\")[" + index + "] returns an " + | ||
"object containing a \"mark\" mark"); | ||
|
||
test(function () { | ||
const entries = self.performance.getEntriesByType("mark"); | ||
match_entries(entries, index); | ||
}, "The mark returned by getEntriesByType(\"mark\")[" + index | ||
+ "] matches the mark returned by " + | ||
"getEntriesByName(\"mark\")[" + index + "]"); | ||
|
||
} | ||
|
||
for (var i = 0; i < expectedTimes.length; i++) { | ||
test_mark(i); | ||
} |