summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/navigation-timing/test_timing_attributes_order.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/navigation-timing/test_timing_attributes_order.html')
-rw-r--r--testing/web-platform/tests/navigation-timing/test_timing_attributes_order.html109
1 files changed, 109 insertions, 0 deletions
diff --git a/testing/web-platform/tests/navigation-timing/test_timing_attributes_order.html b/testing/web-platform/tests/navigation-timing/test_timing_attributes_order.html
new file mode 100644
index 000000000..b607404b8
--- /dev/null
+++ b/testing/web-platform/tests/navigation-timing/test_timing_attributes_order.html
@@ -0,0 +1,109 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>window.performance.timing attribute ordering on a simple navigation</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
+ <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface"/>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="resources/webperftestharness.js"></script>
+ <script>
+ setup({explicit_done: true});
+
+ test_namespace('timing');
+
+ var step = 1;
+ function onload_test()
+ {
+ if (step === 1 && window.performance === undefined)
+ {
+ // avoid script errors
+ done();
+ return;
+ }
+
+ var navigation_frame = document.getElementById("frameContext").contentWindow;
+ performanceNamespace = navigation_frame.performance;
+ switch (step)
+ {
+ case 1:
+ {
+ navigation_frame.location.href = '/navigation-timing/resources/blank_page_green.html';
+ step++;
+ break;
+ }
+ case 2:
+ {
+ test_namespace('navigation', true);
+
+ //
+ // Tests
+ //
+ test_equals(performanceNamespace.navigation.type,
+ performanceNamespace.navigation.TYPE_NAVIGATE,
+ 'window.performance.navigation.type == TYPE_NAVIGATE',{help:"http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface"});
+
+ // navigiation must be non-0
+ test_timing_greater_than('navigationStart', 0);
+
+ // must be no redirection for this test case
+ test_timing_equals('redirectStart', 0);
+ test_timing_equals('redirectEnd', 0);
+
+ // validate attribute ordering
+ test_timing_order('fetchStart', 'navigationStart');
+ test_timing_order('domainLookupStart', 'fetchStart');
+ test_timing_order('domainLookupEnd', 'domainLookupStart');
+ test_timing_order('connectStart', 'domainLookupEnd');
+ test_timing_order('connectEnd', 'connectStart');
+ test_timing_order('requestStart', 'connectEnd');
+ test_timing_order('responseStart', 'requestStart');
+ test_timing_order('responseEnd', 'responseStart');
+ test_timing_order('domLoading', 'fetchStart');
+ test_timing_order('domInteractive', 'responseEnd');
+ test_timing_order('domContentLoadedEventStart', 'domInteractive');
+ test_timing_order('domContentLoadedEventEnd', 'domContentLoadedEventStart');
+ test_timing_order('domComplete', 'domContentLoadedEventEnd');
+ test_timing_order('loadEventStart', 'domContentLoadedEventEnd');
+ test_timing_order('loadEventEnd', 'loadEventStart');
+
+ // setup requires the frame to have a previous page with an onunload event handler.
+ test_timing_order('unloadEventStart', 'navigationStart');
+ test_timing_order('unloadEventEnd', 'unloadEventStart');
+
+ step++;
+ done();
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ </script>
+ </head>
+ <body>
+ <h1>Description</h1>
+ <p>This test validates the ordering of the window.performance.timing attributes.</p>
+
+ <p>This page should be loaded with a yellow background frame below which contains an unload event
+ handler.</p>
+
+ <p>After the page loads, the frame is navigated to a new blank page with a green background. At this point, the navigation timeline is verified</p>
+
+ <p>This test passes if all of the checks to the frame.window.performance.timing attributes are
+ correct throughout the navigation scenario and the frame below ends with a green background.
+ Otherwise, this test fails.</p>
+
+ <h1>Setup</h1>
+
+ <div id="log"></div>
+ <br />
+ <iframe id="frameContext"
+ onload="/* Need to make sure we don't examine loadEventEnd
+ until after the load event has finished firing */
+ setTimeout(onload_test, 0);"
+ src="resources/blank_page_unload.html"
+ style="width: 250px; height: 250px;"></iframe>
+ </body>
+</html>