diff --git a/css-animation.html b/css-animation.html index adae19cb018ed1ca93fd6b4cda80002348482fc3..8f1e29933faa13586dbf97b7874024854fbf2147 100644 --- a/css-animation.html +++ b/css-animation.html @@ -167,9 +167,54 @@ function setupAnimation() { makeParticles(); + + window.setTimeout(function() { + location.hash = 'done'; + }, 10000) + } + + function hashChanged() + { + if (location.hash === '#submit') + submitResults(); + } + + function submitResults() + { + var results = { + 'content-animation' : { + 'metrics' : { + 'FrameRate' : ['Arithmetic'] + }, + 'tests' : { + 'css-animation' : { + 'metrics' : { + 'FrameRate' : { + 'current' : [''] // is replaced by a framerate computed in native code + } + } + } + } + } + }; + var resultsString = JSON.stringify(results); + var xhr = new XMLHttpRequest(); + xhr.open("POST", "/report"); + xhr.setRequestHeader("Content-type", "application/json"); + xhr.setRequestHeader("Content-length", resultsString.length); + xhr.setRequestHeader("Connection", "close"); + xhr.onreadystatechange = function() { + if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) { + closeRequest = new XMLHttpRequest(); + closeRequest.open("GET", "/shutdown"); + closeRequest.send() + } + } + xhr.send(resultsString); } window.addEventListener('load', setupAnimation, false); + window.addEventListener("hashchange", hashChanged, false); diff --git a/raf-animation.html b/raf-animation.html index 09e72f222fcafdfa054a2d5a37b1dcc9eca096ca..dbf18e72de9880c28d9fbf9fa156b4949bb6a6cf 100644 --- a/raf-animation.html +++ b/raf-animation.html @@ -195,9 +195,54 @@ { makeParticles(); animate(); + + window.setTimeout(function() { + location.hash = 'done'; + }, 10000) + } + + function hashChanged() + { + if (location.hash === '#submit') + submitResults(); + } + + function submitResults() + { + var results = { + 'content-animation' : { + 'metrics' : { + 'FrameRate' : ['Arithmetic'] + }, + 'tests' : { + 'raf-animation' : { + 'metrics' : { + 'FrameRate' : { + 'current' : [''] // is replaced by a framerate computed in native code + } + } + } + } + } + }; + var resultsString = JSON.stringify(results); + var xhr = new XMLHttpRequest(); + xhr.open("POST", "/report"); + xhr.setRequestHeader("Content-type", "application/json"); + xhr.setRequestHeader("Content-length", resultsString.length); + xhr.setRequestHeader("Connection", "close"); + xhr.onreadystatechange = function() { + if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) { + closeRequest = new XMLHttpRequest(); + closeRequest.open("GET", "/shutdown"); + closeRequest.send() + } + } + xhr.send(resultsString); } window.addEventListener('load', setupAnimation, false); + window.addEventListener("hashchange", hashChanged, false); diff --git a/svg-animation.html b/svg-animation.html index c286d50cc7e0e6d64e1b6fbd2beb3642fe90e958..fb21d522ca200021d452595cbfed3db252c80929 100644 --- a/svg-animation.html +++ b/svg-animation.html @@ -150,9 +150,54 @@ function setupAnimation() { makeParticles(); + + window.setTimeout(function() { + location.hash = 'done'; + }, 10000) + } + + function hashChanged() + { + if (location.hash === '#submit') + submitResults(); + } + + function submitResults() + { + var results = { + 'content-animation' : { + 'metrics' : { + 'FrameRate' : ['Arithmetic'] + }, + 'tests' : { + 'svg-animation' : { + 'metrics' : { + 'FrameRate' : { + 'current' : [''] // is replaced by a framerate computed in native code + } + } + } + } + } + }; + var resultsString = JSON.stringify(results); + var xhr = new XMLHttpRequest(); + xhr.open("POST", "/report"); + xhr.setRequestHeader("Content-type", "application/json"); + xhr.setRequestHeader("Content-length", resultsString.length); + xhr.setRequestHeader("Connection", "close"); + xhr.onreadystatechange = function() { + if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) { + closeRequest = new XMLHttpRequest(); + closeRequest.open("GET", "/shutdown"); + closeRequest.send() + } + } + xhr.send(resultsString); } window.addEventListener('load', setupAnimation, false); + window.addEventListener("hashchange", hashChanged, false);