summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/navigation-timing/test-timing-attributes-order.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/navigation-timing/test-timing-attributes-order.html
parentInitial commit. (diff)
downloadfirefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz
firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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.html111
1 files changed, 111 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 0000000000..5e885ea7ec
--- /dev/null
+++ b/testing/web-platform/tests/navigation-timing/test-timing-attributes-order.html
@@ -0,0 +1,111 @@
+<!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"/>
+ <link rel="help" href="http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface"/>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="/common/performance-timeline-utils.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');
+
+ // 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 */
+ step_timeout(onload_test, 0);"
+ src="resources/blank_page_unload.html"
+ style="width: 250px; height: 250px;"></iframe>
+ </body>
+</html>