summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/paint-timing/with-first-paint/child-painting-first-image.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/paint-timing/with-first-paint/child-painting-first-image.html')
-rw-r--r--testing/web-platform/tests/paint-timing/with-first-paint/child-painting-first-image.html46
1 files changed, 46 insertions, 0 deletions
diff --git a/testing/web-platform/tests/paint-timing/with-first-paint/child-painting-first-image.html b/testing/web-platform/tests/paint-timing/with-first-paint/child-painting-first-image.html
new file mode 100644
index 0000000000..92a926a2b9
--- /dev/null
+++ b/testing/web-platform/tests/paint-timing/with-first-paint/child-painting-first-image.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<body>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<script>
+var entriesExpectToReceive = [
+ {
+ 'entryType': 'paint',
+ 'name': 'first-paint'
+ },
+ {
+ 'entryType': 'paint',
+ 'name': 'first-contentful-paint'
+ }
+];
+
+setup({"hide_test_state": true});
+async_test(function (t) {
+ assert_implements(window.PerformancePaintTiming, "Paint Timing isn't supported.");
+ window.addEventListener('message', t.step_func(e => {
+ // When only child frame paints, expect only first-paint.
+ for (let i = 0; i < entriesExpectToReceive.length; i++) {
+ if (entriesExpectToReceive[i].entryType == e.data.entryType &&
+ entriesExpectToReceive[i].name == e.data.name) {
+ entriesExpectToReceive.splice(i, 1);
+ break;
+ }
+ }
+
+ if (entriesExpectToReceive.length == 0) {
+ const bufferedEntries = performance.getEntriesByType('paint');
+ assert_equals(bufferedEntries.length, 1);
+ assert_equals(bufferedEntries[0].entryType, 'paint');
+ assert_equals(bufferedEntries[0].name, 'first-paint');
+ t.done();
+ }
+ }));
+ const iframe = document.createElement('iframe');
+ iframe.id = 'child-iframe';
+ iframe.src = '../resources/subframe-painting.html';
+ document.body.appendChild(iframe);
+}, 'Parent frame ignores paint-timing events fired from child image rendering.');
+</script>
+</body>
+</html>