Commit a9045946 authored by Nicolas Pena's avatar Nicolas Pena Committed by Commit Bot

Add a fail-fast for longtask layouttests

This CL adds checks to fail tests for browsers that do not support longtasks
instead of forcing them to timeout.

Change-Id: I5be54a1ab0a5d003decb58fc1e79380cbce15976
Reviewed-on: https://chromium-review.googlesource.com/1128174Reviewed-by: default avatarTimothy Dresser <tdresser@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573900}
parent 3ff944ee
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
<div id="log"></div> <div id="log"></div>
<script> <script>
async_test(function (t) { async_test(function (t) {
if (typeof PerformanceLongTaskTiming === 'undefined') {
assert_unreached("Longtasks are not supported.");
t.done();
}
const observer = new PerformanceObserver( const observer = new PerformanceObserver(
t.step_func(function (entryList) { t.step_func(function (entryList) {
const entries = entryList.getEntries(); const entries = entryList.getEntries();
......
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
<div id="log"></div> <div id="log"></div>
<script> <script>
async_test(function (t) { async_test(function (t) {
if (typeof PerformanceLongTaskTiming === 'undefined') {
assert_unreached("Longtasks are not supported.");
t.done();
}
const observer = new PerformanceObserver( const observer = new PerformanceObserver(
t.step_func(function (entryList) { t.step_func(function (entryList) {
const entries = entryList.getEntries(); const entries = entryList.getEntries();
......
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
<script> <script>
const initialTime = performance.now(); const initialTime = performance.now();
async_test(function (t) { async_test(function (t) {
if (typeof PerformanceLongTaskTiming === 'undefined') {
assert_unreached("Longtasks are not supported.");
t.done();
}
const observer = new PerformanceObserver( const observer = new PerformanceObserver(
t.step_func(function (entryList) { t.step_func(function (entryList) {
const entries = entryList.getEntries(); const entries = entryList.getEntries();
......
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
<div id="log"></div> <div id="log"></div>
<script> <script>
async_test(function (t) { async_test(function (t) {
if (typeof PerformanceLongTaskTiming === 'undefined') {
assert_unreached("Longtasks are not supported.");
t.done();
}
const observer = new PerformanceObserver( const observer = new PerformanceObserver(
t.step_func(function (entryList) { t.step_func(function (entryList) {
const entries = entryList.getEntries(); const entries = entryList.getEntries();
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
<script> <script>
const t = async_test(t => { const t = async_test(t => {
if (typeof PerformanceLongTaskTiming === 'undefined') {
assert_unreached("Longtasks are not supported.");
t.done();
}
window.addEventListener('message', t.step_func(e => { window.addEventListener('message', t.step_func(e => {
assert_equals(e.data['entryType'], 'longtask'); assert_equals(e.data['entryType'], 'longtask');
assert_equals(e.data['frame-attribution'], 'same-origin-ancestor'); assert_equals(e.data['frame-attribution'], 'same-origin-ancestor');
......
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
<div id="log"></div> <div id="log"></div>
<script> <script>
async_test(function (t) { async_test(function (t) {
if (typeof PerformanceLongTaskTiming === 'undefined') {
assert_unreached("Longtasks are not supported.");
t.done();
}
const observer = new PerformanceObserver( const observer = new PerformanceObserver(
t.step_func(function (entryList) { t.step_func(function (entryList) {
const entries = entryList.getEntries(); const entries = entryList.getEntries();
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
<script> <script>
async_test(t => { async_test(t => {
if (typeof PerformanceLongTaskTiming === 'undefined') {
assert_unreached("Longtasks are not supported.");
t.done();
}
window.addEventListener('message', t.step_func(e => { window.addEventListener('message', t.step_func(e => {
assert_equals(e.data['entryType'], 'longtask'); assert_equals(e.data['entryType'], 'longtask');
assert_equals(e.data['frame-attribution'], 'cross-origin-unreachable'); assert_equals(e.data['frame-attribution'], 'cross-origin-unreachable');
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
<script> <script>
async_test(t => { async_test(t => {
if (typeof PerformanceLongTaskTiming === 'undefined') {
assert_unreached("Longtasks are not supported.");
t.done();
}
window.addEventListener('message', t.step_func(e => { window.addEventListener('message', t.step_func(e => {
assert_equals(e.data['entryType'], 'longtask'); assert_equals(e.data['entryType'], 'longtask');
assert_equals(e.data['frame-attribution'], 'same-origin'); assert_equals(e.data['frame-attribution'], 'same-origin');
......
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
<body> <body>
<script> <script>
async_test(function (t) { async_test(function (t) {
if (typeof PerformanceLongTaskTiming === 'undefined') {
assert_unreached("Longtasks are not supported.");
t.done();
}
const observer = new PerformanceObserver( const observer = new PerformanceObserver(
t.step_func(function (entryList) { t.step_func(function (entryList) {
const entries = entryList.getEntries(); const entries = entryList.getEntries();
......
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
This window opens a new window which contains a longtask. We test that the This window opens a new window which contains a longtask. We test that the
longtask from the new window is not observed by the observer of this window. */ longtask from the new window is not observed by the observer of this window. */
async_test(t => { async_test(t => {
if (typeof PerformanceLongTaskTiming === 'undefined') {
assert_unreached("Longtasks are not supported.");
t.done();
}
const observer = new PerformanceObserver( const observer = new PerformanceObserver(
t.step_func(function (entryList) { t.step_func(function (entryList) {
const entries = entryList.getEntries(); const entries = entryList.getEntries();
......
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
<div id="log"></div> <div id="log"></div>
<script> <script>
async_test(function (t) { async_test(function (t) {
if (typeof PerformanceLongTaskTiming === 'undefined') {
assert_unreached("Longtasks are not supported.");
t.done();
}
const scriptURL = 'longtask-executescript.html'; const scriptURL = 'longtask-executescript.html';
const observer = new PerformanceObserver( const observer = new PerformanceObserver(
t.step_func(function (entryList) { t.step_func(function (entryList) {
......
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
<div id="log"></div> <div id="log"></div>
<script> <script>
async_test(function (t) { async_test(function (t) {
if (typeof PerformanceLongTaskTiming === 'undefined') {
assert_unreached("Longtasks are not supported.");
t.done();
}
const scriptURL = 'resources/makelongtask.js'; const scriptURL = 'resources/makelongtask.js';
const lineColumn = '(0, 0)'; const lineColumn = '(0, 0)';
const observer = new PerformanceObserver( const observer = new PerformanceObserver(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment