summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/hr-time/test_cross_frame_start.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/hr-time/test_cross_frame_start.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/hr-time/test_cross_frame_start.html')
-rw-r--r--testing/web-platform/tests/hr-time/test_cross_frame_start.html59
1 files changed, 59 insertions, 0 deletions
diff --git a/testing/web-platform/tests/hr-time/test_cross_frame_start.html b/testing/web-platform/tests/hr-time/test_cross_frame_start.html
new file mode 100644
index 000000000..30e804bd7
--- /dev/null
+++ b/testing/web-platform/tests/hr-time/test_cross_frame_start.html
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" >
+ <title>window.performance.now across frames</title>
+ <link rel="author" title="Google" href="http://www.google.com/">
+ <link rel="help" href="http://www.w3.org/TR/hr-time/#sec-extenstions-performance-interface">
+
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+
+ <script type="text/javascript">
+ setup({explicit_done: true});
+
+ var setup_frame = async_test("Setup the frame");
+
+ function start_test() {
+ setup_frame.step_timeout(function () {
+ var iframe = document.createElement('iframe');
+ iframe.id = 'frameContext';
+ iframe.onload = finish_test;
+ iframe.src = "resources/now_frame.html";
+ document.body.appendChild(iframe);
+ setup_frame.done();
+ }, 1000);
+ }
+
+ function finish_test() {
+ var childWindow = document.getElementById('frameContext').contentWindow;
+
+ // Verify a positive number is returned for both the frame and parent.
+ test(function() { assert_true(window.performance.now() > 0); }, 'parent performance.now() > 0');
+ test(function() { assert_true(childWindow.performance.now() > 0); }, 'child performance.now() > 0');
+
+ // Verify that the test properly created the child at least a second after the parent.
+ test(function () { assert_true(childWindow.performance.timing.navigationStart > (window.performance.timing.navigationStart + 1000)); },
+ 'Child created at least 1 second after parent');
+
+ test(function () {
+ var parentNow = window.performance.now();
+ var childNow = childWindow.performance.now();
+ var childParentSkew = Math.abs(childNow - parentNow);
+ assert_true(childParentSkew > 1000, 'Child and parent\'s now()s have different bases (skewed more than 1 second)');
+
+ var childLoadTime = childWindow.performance.timing.loadEventStart - childWindow.performance.timing.navigationStart;
+ assert_true(1000 > (childNow - childLoadTime), 'Child\'s now() is based on its document\'s navigationStart');
+ }, 'Child and parent time bases are correct');
+
+ done();
+ }
+ </script>
+
+ </head>
+ <body onload="start_test()">
+ <h1>Description</h1>
+ <p>This test validates the values of the window.performance.now() are based on the current document's navigationStart.</p>
+ <div id="log"></div>
+ </body>
+</html>