--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>window.performance.timing for dynamically created documents</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="./support/webperftestharness.js"></script>
+ <link rel="stylesheet" href="../../resources/testharness.css" />
+ <script id="metadata_cache">/*
+ {
+ "window.performance is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "connectEnd is the same after document open.": {},
+ "connectStart is the same after document open.": {},
+ "domComplete is the same after document open.": {},
+ "domContentLoadedEventEnd is the same after document open.": {},
+ "domContentLoadedEventStart is the same after document open.": {},
+ "domInteractive is the same after document open.": {},
+ "domLoading is the same after document open.": {},
+ "domainLookupEnd is the same after document open.": {},
+ "domainLookupStart is the same after document open.": {},
+ "fetchStart is the same after document open.": {},
+ "loadEventEnd is the same after document open.": {},
+ "loadEventStart is the same after document open.": {},
+ "navigationStart is the same after document open.": {},
+ "redirectEnd is the same after document open.": {},
+ "redirectStart is the same after document open.": {},
+ "requestStart is the same after document open.": {},
+ "responseEnd is the same after document open.": {},
+ "responseStart is the same after document open.": {},
+ "unloadEventEnd is the same after document open.": {},
+ "unloadEventStart is the same after document open.": {}
+ }
+ */</script>
+ <script>
+ setup({explicit_done: true});
+
+ // explicitly test the namespace before we start testing
+ test_namespace();
+
+ var originalTiming = {};
+ var didOpen = false;
+
+ function onload_test() {
+ if (!didOpen) {
+ setTimeout(testTimingWithDocumentOpen, 0);
+ didOpen = true;
+ }
+ }
+
+ function testTimingWithDocumentOpen() {
+ var subcontentWindow = document.getElementById("frameContext").contentWindow;
+
+ if (subcontentWindow.performance === undefined)
+ {
+ // avoid script errors
+ done();
+ return;
+ }
+
+ var timing = subcontentWindow.performance.timing;
+ for (i in timingAttributes) {
+ originalTiming[timingAttributes[i]] = timing[timingAttributes[i]];
+ }
+
+ var subdocument = subcontentWindow.document;
+ subdocument.open();
+ subdocument.write('<!DOCTYPE HTML>');
+ subdocument.write('<html>');
+ subdocument.write('<head>');
+ subdocument.write('<meta charset="utf-8" />');
+ subdocument.write('<title><Green Test Page</title>');
+ subdocument.write('</head>');
+ subdocument.write('<body style="background-color:#00FF00;">');
+ subdocument.write('</body>');
+ subdocument.write('</html>');
+ subdocument.close();
+
+ setTimeout(function() {
+ var timing = subcontentWindow.performance.timing;
+ for (var i in timingAttributes) {
+ test_equals(timing[timingAttributes[i]],
+ originalTiming[timingAttributes[i]],
+ timingAttributes[i] + " is the same after document open.");
+ }
+ done();
+ }, 0);
+ }
+ </script>
+ </head>
+ <body>
+ <h1>Description</h1>
+ <p>This test validates window.performance.timing remains constant when a
+ document is replaced using document.open.</p>
+
+ <p>This page should be loaded with a yellow frame below. It then replaces the
+ document in that frame with a green document.</p>
+
+ <p>The test passes if all of the checks to performance.timing are correct and
+ the frame below ends with a green background.</p>
+
+ <div id="log"></div>
+ <br />
+ <iframe id="frameContext" onload="onload_test();" src="./support/blank_page_yellow.htm" style="width: 250px; height: 250px;"></iframe>
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" >
+ <title>window.performance.timing in document navigation</title>
+ <link rel="author" title="Google" href="http://www.google.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="./support/webperftestharness.js"></script>
+ <script id="metadata_cache">/*
+ {
+ "window.performance is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "window.performance.timing is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "connectEnd is the same after in document navigation.": {},
+ "connectStart is the same after in document navigation.": {},
+ "domComplete is the same after in document navigation.": {},
+ "domContentLoadedEventEnd is the same after in document navigation.": {},
+ "domContentLoadedEventStart is the same after in document navigation.": {},
+ "domInteractive is the same after in document navigation.": {},
+ "domLoading is the same after in document navigation.": {},
+ "domainLookupEnd is the same after in document navigation.": {},
+ "domainLookupStart is the same after in document navigation.": {},
+ "fetchStart is the same after in document navigation.": {},
+ "loadEventEnd is the same after in document navigation.": {},
+ "loadEventStart is the same after in document navigation.": {},
+ "navigationStart is the same after in document navigation.": {},
+ "redirectEnd is the same after in document navigation.": {},
+ "redirectStart is the same after in document navigation.": {},
+ "requestStart is the same after in document navigation.": {},
+ "responseEnd is the same after in document navigation.": {},
+ "responseStart is the same after in document navigation.": {},
+ "unloadEventEnd is the same after in document navigation.": {},
+ "unloadEventStart is the same after in document navigation.": {}
+ }
+ */</script>
+ </head>
+ <body>
+ <h1>Description</h1>
+ <p>This test validates that all of the window.performance.timing attributes remain unchanged after an in document navigation (URL fragment change).</p>
+
+ <div id="log"></div>
+ <script>
+ setup({explicit_done: true});
+
+ // explicitly test the namespace before we start testing
+ test_namespace('timing');
+
+ var timing;
+
+ function check_timing_not_changed()
+ {
+ for (var i = 0; i < timingAttributes.length; ++i)
+ {
+ var property = timingAttributes[i];
+ test_equals(timing[property], initial_timing[property],
+ property + " is the same after in document navigation.");
+ }
+ done();
+ }
+
+ var initial_timing = {};
+ function save_timing_after_load()
+ {
+ for (var i = 0; i < timingAttributes.length; ++i)
+ {
+ var property = timingAttributes[i];
+ initial_timing[property] = timing[property];
+ }
+ window.location.href = "#1";
+ setTimeout("check_timing_not_changed()", 0);
+ }
+
+ function load_handler()
+ {
+ if (performanceNamespace === undefined)
+ {
+ // avoid script errors
+ done();
+ return;
+ }
+
+ timing = performanceNamespace.timing;
+
+ window.removeEventListener("load", load_handler);
+ setTimeout("save_timing_after_load()", 0);
+ }
+
+ window.addEventListener("load", load_handler, false);
+ </script>
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>window.performance.navigation.redirectCount on a non-redirected 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="./support/webperftestharness.js"></script>
+ <script id="metadata_cache">/*
+ {
+ "window.performance is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "window.performance.navigation is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "timing.redirectStart on an non-redirected navigation": {},
+ "timing.redirectEnd on an non-redirected navigation": {},
+ "navigation.redirectCount on an non-redirected navigation": { "help": "http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface" }
+ }
+ */</script>
+ </head>
+ <body>
+ <h1>Description</h1>
+ <p>This test validates that the value of the window.performance.navigation.redirectCount attribute, as well as the window.performance.timing.redirectStart and redirectEnd attributes on a non-redirected navigation.</p>
+
+ <div id="log"></div>
+
+ <script>
+ test_namespace('navigation');
+
+ if (performanceNamespace !== undefined)
+ {
+ test_equals(performanceNamespace.timing.redirectStart, 0, 'timing.redirectStart on an non-redirected navigation');
+ test_equals(performanceNamespace.timing.redirectEnd, 0, 'timing.redirectEnd on an non-redirected navigation');
+ test_equals(performanceNamespace.navigation.redirectCount, 0, 'navigation.redirectCount on an non-redirected navigation',{help:"http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface"});
+ }
+ </script>
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>window.performance.navigation enums</title>
+ <link rel="author" title="Microsoft" href="http://www.microsoft.com/" />
+ <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="./support/webperftestharness.js"></script>
+ <script id="metadata_cache">/*
+ {
+ "window.performance is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "window.performance.navigation is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "window.performance.navigation.TYPE_NAVIGATE is defined.": {},
+ "window.performance.navigation.TYPE_NAVIGATE = 0": {},
+ "window.performance.navigation.TYPE_RELOAD is defined.": {},
+ "window.performance.navigation.TYPE_RELOAD = 1": {},
+ "window.performance.navigation.TYPE_BACK_FORWARD is defined.": {},
+ "window.performance.navigation.TYPE_BACK_FORWARD = 2": {},
+ "window.performance.navigation.TYPE_RESERVED is defined.": {},
+ "window.performance.navigation.TYPE_RESERVED = 255": {}
+ }
+ */</script>
+ </head>
+ <body>
+ <h1>Description</h1>
+ <p>This test validates that the TYPE_* enumerations of window.performance.navigation exist and their values are correct.</p>
+
+ <div id="log"></div>
+
+ <script>
+ test_namespace('navigation');
+
+ test_enum('navigation', 'TYPE_NAVIGATE', 0);
+ test_enum('navigation', 'TYPE_RELOAD', 1);
+ test_enum('navigation', 'TYPE_BACK_FORWARD', 2);
+ test_enum('navigation', 'TYPE_RESERVED', 255);
+ </script>
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>window.performance.navigation.type with a reloaded 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="./support/webperftestharness.js"></script>
+ <link rel="stylesheet" href="../../resources/testharness.css" />
+ <script id="metadata_cache">/*
+ {
+ "window.performance is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "window.performance.navigation is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "window.performance.navigation.type == TYPE_RELOAD,{help:"http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface"}": {},
+ "Reload connectEnd(1340376070295) > Original connectEnd(1340376070163)": {},
+ "Reload connectStart(1340376070295) > Original connectStart(1340376070163)": {},
+ "Reload domComplete(1340376070300) > Original domComplete(1340376070179)": {},
+ "Reload domContentLoadedEventEnd(1340376070300) > Original domContentLoadedEventEnd(1340376070179)": {},
+ "Reload domContentLoadedEventStart(1340376070300) > Original domContentLoadedEventStart(1340376070179)": {},
+ "Reload domInteractive(1340376070300) > Original domInteractive(1340376070179)": {},
+ "Reload domLoading(1340376070299) > Original domLoading(1340376070178)": {},
+ "Reload domainLookupEnd(1340376070295) > Original domainLookupEnd(1340376070163)": {},
+ "Reload domainLookupStart(1340376070295) > Original domainLookupStart(1340376070163)": {},
+ "Reload fetchStart(1340376070290) > Original fetchStart(1340376070163)": {},
+ "Reload loadEventEnd(1340376070300) > Original loadEventEnd(1340376070179)": {},
+ "Reload loadEventStart(1340376070300) > Original loadEventStart(1340376070179)": {},
+ "Reload navigationStart(1340376070290) > Original navigationStart(1340376070163)": {},
+ "Reload redirectEnd(0) == Original redirectEnd(0)": {},
+ "Reload redirectStart(0) == Original redirectStart(0)": {},
+ "Reload requestStart(1340376070295) > Original requestStart(1340376070164)": {},
+ "Reload responseEnd(1340376070296) > Original responseEnd(1340376070174)": {},
+ "Reload responseStart(1340376070296) > Original responseStart(1340376070164)": {},
+ "Reload unloadEventEnd(1340376070296) > Original unloadEventEnd(0)": {},
+ "Reload unloadEventStart(1340376070296) > Original unloadEventStart(0)": {}
+ }
+ */</script>
+ <script>
+ setup({explicit_done: true});
+
+ // explicitly test the namespace before we start testing
+ test_namespace('navigation');
+ var reload_frame;
+ var startingTime;
+
+ function deepCopy(p, c)
+ {
+ var c = c || {};
+ for (var i in p)
+ {
+ if (typeof p[i] === 'object')
+ {
+ c[i] = (p[i].constructor === Array) ? [] : {};
+ deepCopy(p[i], c[i]);
+ } else c[i] = p[i];
+ }
+ return c;
+ }
+
+
+ function onload_test()
+ {
+ reload_frame = document.getElementById("frameContext");
+ reload_frame.onload = function() {
+ /* Need to make sure we don't examine loadEventEnd
+ until after the load event has finished firing */
+ setTimeout(do_test, 0);
+ }
+ setTimeout("reload_the_frame();", 100);
+ }
+
+ function reload_the_frame()
+ {
+ //Before reloading, save the current timing
+ startingTime = deepCopy(reload_frame.contentWindow.performance.timing);
+ reload_frame.contentWindow.location.reload(true);
+ }
+
+ function do_test()
+ {
+ reload_frame.onload = null;
+ if (performanceNamespace)
+ {
+ //Verify that the navigation type has updated to reload
+ test_equals(reload_frame.contentWindow.performance.navigation.type,
+ performanceNamespace.navigation.TYPE_RELOAD,
+ 'window.performance.navigation.type == TYPE_RELOAD,{help:"http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface"}');
+
+ //Verify that the timing data has been updated into the future
+ var reloadTime = reload_frame.contentWindow.performance.timing;
+ for (attribute in timingAttributes)
+ {
+ var time = timingAttributes[attribute];
+ if (reloadTime[time] === 0)
+ {
+ test_equals(reloadTime[time],
+ startingTime[time],
+ "Reload " + time + "(" + reloadTime[time] + ")" +
+ " == " +
+ "Original " + time + "(" + startingTime[time] + ")");
+ }
+ else
+ {
+ test_greater_than(reloadTime[time],
+ startingTime[time],
+ "Reload " + time + "(" + reloadTime[time] + ")" +
+ " > " +
+ "Original " + time + "(" + startingTime[time] + ")");
+ }
+ }
+ }
+
+ done();
+ }
+ </script>
+ </head>
+ <body onload="onload_test();">
+ <h1>Description</h1>
+ <p>This test validates the value of window.performance.navigation.type and the values of
+ window.performance.timing.* with a reloaded navigation.</p>
+
+ <p>This page should be loaded with a green background frame below. The frame will be automatically reloaded
+ and then verified that
+ <ul>
+ <li>The window.performance.navigation.type = TYPE_RELOAD</li>
+ <li>All of the widow.performance.timing.* values after reload are > all of the window.performance.timing.* values
+ prior to reload.</li>
+ </ul>
+ </p>
+
+ <div id="log"></div>
+ <br />
+ <iframe id="frameContext" src="./support/blank_page_green.htm" style="width: 250px; height: 250px;"></iframe>
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>window.performance.timing attributes on an initial navigation</title>
+ <link rel="author" title="Google" href="http://www.google.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="./support/webperftestharness.js"></script>
+ <script id="metadata_cache">/*
+ {
+ "window.performance is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "window.performance.navigation is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "timing.navigation.type is TYPE_NAVIGATE": { "help": "http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface" },
+ "timing.unloadEventStart == 0 on navigation with no previous document": {},
+ "timing.unloadEventEnd == 0 navigation with no previous document": {}
+ }
+ */</script>
+ <link rel="stylesheet" href="../../resources/testharness.css" />
+
+ <script>
+ setup({explicit_done: true});
+
+ var frame;
+ function onload_test()
+ {
+ frame = document.getElementById("frameContext");
+ test_namespace('navigation');
+ if (performanceNamespace)
+ {
+ test_true(frame.contentWindow.performance.navigation.type == performanceNamespace.navigation.TYPE_NAVIGATE,
+ 'timing.navigation.type is TYPE_NAVIGATE',{help:"http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface"});
+
+ test_equals(frame.contentWindow.performance.timing.unloadEventStart, 0, 'timing.unloadEventStart == 0 on navigation with no previous document');
+ test_equals(frame.contentWindow.performance.timing.unloadEventEnd, 0, 'timing.unloadEventEnd == 0 navigation with no previous document');
+ }
+ done();
+ }
+ </script>
+
+ </head>
+ <body onload="onload_test();">
+ <h1>Description</h1>
+ <p>This test validates the unload event times are 0 when there is no previous document.</p>
+
+ <div id="log"></div><br />
+ <iframe id="frameContext" src="./support/blank_page_green.htm" style="width: 250px; height: 250px;"></iframe>
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>window.performance.timing.redirect attributes on a client redirect 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="./support/webperftestharness.js"></script>
+ <link rel="stylesheet" href="../../resources/testharness.css" />
+ <script id="metadata_cache">/*
+ {
+ "window.performance is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "window.performance.navigation is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "window.performance.timing is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "timing.navigation.type is TYPE_NAVIGATE": { "help": "http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface" },
+ "navigation.redirectCount == 0 on an client redirected navigation": { "help": "http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface" },
+ "timing.redirectStart == 0 on an client redirected navigation": {},
+ "timing.redirectEnd == 0 on an client redirected navigation": {}
+ }
+ */</script>
+ <script>
+ setup({explicit_done: true});
+
+ test_namespace('navigation');
+ test_namespace('timing', true);
+
+ var redirect_frame;
+ function onload_test()
+ {
+ if (performanceNamespace === undefined)
+ {
+ // avoid script errors
+ done();
+ return;
+ }
+
+ redirect_frame = document.getElementById("frameContext");
+ redirect_frame.onload = do_test;
+ }
+
+ function do_test()
+ {
+ redirect_frame.onload = "";
+ test_true(redirect_frame.contentWindow.performance.navigation.type == performanceNamespace.navigation.TYPE_NAVIGATE,
+ 'timing.navigation.type is TYPE_NAVIGATE',{help:"http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface"});
+
+ test_equals(redirect_frame.contentWindow.performance.navigation.redirectCount, 0, 'navigation.redirectCount == 0 on an client redirected navigation',{help:"http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface"});
+ test_equals(redirect_frame.contentWindow.performance.timing.redirectStart, 0, 'timing.redirectStart == 0 on an client redirected navigation');
+ test_equals(redirect_frame.contentWindow.performance.timing.redirectEnd, 0, 'timing.redirectEnd == 0 on an client redirected navigation');
+
+ done();
+ }
+ </script>
+
+ </head>
+ <body onload="onload_test();">
+ <h1>Description</h1>
+ <p>This test validates the values of the window.navigation.redirectCount and the
+ window.performance.timing.redirectStart/End times on a client side redirect.</p>
+
+ <div id="log"></div><br />
+ <iframe id="frameContext" src="./support/blank_page_meta_redirect.htm" style="width: 250px; height: 250px;"></iframe>
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>window.performance.timing attributes after a reloaded 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="./support/webperftestharness.js"></script>
+ <link rel="stylesheet" href="../../resources/testharness.css" />
+ <script id="metadata_cache">/*
+ {
+ "window.performance is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "window.performance.navigation is defined": {
+ "help": "http://www.w3.org/TR/navigation-timing/#sec-window.performance-attribute",
+ "assert": "The window.performance attribute provides a hosting area for performance related attributes. ",
+ "author": "W3C http://www.w3.org/"
+ },
+ "window.performance.navigation.type == TYPE_RELOAD": { "help": "http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface" },
+ "connectEnd is different after the reload.": {},
+ "connectStart is different after the reload.": {},
+ "domComplete is different after the reload.": {},
+ "domContentLoadedEventEnd is different after the reload.": {},
+ "domContentLoadedEventStart is different after the reload.": {},
+ "domInteractive is different after the reload.": {},
+ "domLoading is different after the reload.": {},
+ "domainLookupEnd is different after the reload.": {},
+ "domainLookupStart is different after the reload.": {},
+ "fetchStart is different after the reload.": {},
+ "loadEventEnd is different after the reload.": {},
+ "loadEventStart is different after the reload.": {},
+ "navigationStart is different after the reload.": {},
+ "requestStart is different after the reload.": {},
+ "responseEnd is different after the reload.": {},
+ "responseStart is different after the reload.": {}
+ }
+ */</script>
+ <script>
+ setup({explicit_done: true});
+
+ // explicitly test the namespace before we start testing
+ test_namespace('navigation');
+
+ var reload_frame;
+ var initial_timing;
+
+ function onload_test()
+ {
+ reload_frame = document.getElementById("frameContext");
+
+ if (reload_frame.contentWindow.performance === undefined)
+ {
+ // avoid script errors
+ done();
+ return;
+ }
+
+ reload_frame.onload = do_test;
+
+ // save frame's initial timings
+ initial_timing = {};
+ var timing = reload_frame.contentWindow.performance.timing;
+
+ for (var i = 0; i < timingAttributes.length; ++i)
+ {
+ var property = timingAttributes[i];
+ initial_timing[property] = timing[property];
+ }
+
+ setTimeout("reload_the_frame();", 100);
+ }
+
+ function reload_the_frame()
+ {
+ reload_frame.contentWindow.location.reload(true);
+ }
+
+ function do_test()
+ {
+ reload_frame.onload = "";
+
+ // ensure the frame reloaded
+ test_equals(reload_frame.contentWindow.performance.navigation.type,
+ performanceNamespace.navigation.TYPE_RELOAD,
+ "window.performance.navigation.type == TYPE_RELOAD", {help:"http://www.w3.org/TR/navigation-timing/#sec-navigation-info-interface"});
+
+ // ensure reload timings changed
+ var timing = reload_frame.contentWindow.performance.timing;
+ for (var i = 0; i < timingAttributes.length; ++i)
+ {
+ var property = timingAttributes[i];
+
+ // ignore any timings that were zero initially
+ if (initial_timing[property] !== 0)
+ {
+ test_not_equals(timing[property], initial_timing[property],
+ property + " is different after the reload.");
+ }
+ }
+
+ done();
+ }
+ </script>
+ </head>
+ <body onload="onload_test();">
+ <h1>Description</h1>
+ <p>This test validates that the window.performance.timing attributes change when a page is reloaded.</p>
+
+ <p>This page should be loaded with a green background frame below. The frame will be automatically reloaded
+ and then verified that the window.performance.timing attributes have been updated to the new reloaded navigation timings.</p>
+
+ <div id="log"></div>
+ <br />
+ <iframe id="frameContext" src="./support/blank_page_green.htm" style="width: 250px; height: 250px;"></iframe>
+
+ </body>
+</html>
--- /dev/null
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>window.performance.timing.redirect attributes on a same-origin server redirected 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="./support/webperftestharness.js"></script>
+ <script src="./support/phpLocation.js"></script>
+
+ <script>
+ var i = 1;
+ function onload_test()
+ { test_namespace('navigation');
+ if(i == 1){
+ i++;
+ }else{
+ if (performanceNamespace === undefined)
+ {
+ // avoid script errors
+ done();
+ return;
+ }
+
+ performanceNamespace = document.getElementById("frameContext").contentWindow.performance;
+ test_equals(performanceNamespace.navigation.type,
+ performanceNamespace.navigation.TYPE_NAVIGATE,
+ 'timing.navigation.type is TYPE_NAVIGATE');
+ test_equals(performanceNamespace.navigation.redirectCount, 1, 'navigation.redirectCount == 1 on an server redirected navigation');
+
+ test_timing_greater_than('navigationStart', 0);
+
+ test_timing_order('redirectStart', 'navigationStart');
+ test_timing_order('redirectEnd', 'redirectStart');
+ test_timing_order('fetchStart', 'redirectEnd');
+ }
+ }
+ </script>
+
+ </head>
+ <body>
+ <h1>Description</h1>
+ <p>This test validates the values of the window.performance.redirectCount and the
+ window.performance.timing.redirectStart/End times for a same-origin server side redirect navigation.</p>
+
+ <div id="log"></div>
+ <br />
+ <iframe id="frameContext" onload="onload_test();" src="" style="width: 250px; height: 250px;"></iframe>
+ <script>
+ document.getElementById("frameContext").src = phpLocation;
+ </script>
+ </body>
+</html>
</spec>
</specs>
</testcase>
+ <testcase purpose="This test validates window.performance.timing remains constant when a document is replaced using document.open." type="compliance" status="approved" component="WebAPI/TBD/Navigation Timing" execution_type="auto" priority="P3" id="test_document_open">
+ <description>
+ <pre_condition/>
+ <post_condition/>
+ <steps>
+ <step order="1">
+ <step_desc>This page should be loaded with a yellow frame. It then replaces the document in that frame with a green document.</step_desc>
+ <expected>The test passes if all of the checks to performance.timing are correct and the frame ends with a green background.</expected>
+ </step>
+ </steps>
+ <test_script_entry timeout="90" test_script_expected_result="0">/opt/tct-navigationtiming-w3c-tests/navigationtiming/w3c/test_document_open.htm</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion usage="true" interface="PerformanceTiming" specification="Navigation Timing" section="TBD" category="Tizen W3C API Specifications"/>
+ <spec_url>http://www.w3.org/TR/2012/REC-navigation-timing-20121217/</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="This test validates the values of the window.navigation.redirectCount and the window.performance.timing.redirectStart/End times on a client side redirect." type="compliance" status="approved" component="WebAPI/TBD/Navigation Timing" execution_type="auto" priority="P3" id="test_timing_client_redirect">
+ <description>
+ <pre_condition/>
+ <post_condition/>
+ <steps>
+ <step order="1">
+ <step_desc>This page should be loaded with a yellow frame. It then redirect the document in that frame with a green document. After the page loads, the frame is navigated to a new blank page with a green background.</step_desc>
+ <expected>This test passes if all of the checks to the values of the window.navigation.redirectCount and the window.performance.timing.redirectStart/End times are zero.</expected>
+ </step>
+ </steps>
+ <test_script_entry timeout="90" test_script_expected_result="0">/opt/tct-navigationtiming-w3c-tests/navigationtiming/w3c/test_timing_client_redirect.htm</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion usage="true" interface="Performance" specification="Navigation Timing" section="TBD" category="Tizen W3C API Specifications"/>
+ <spec_url>http://www.w3.org/TR/2012/REC-navigation-timing-20121217/</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="This test validates the values of the window.navigation.redirectCount and the window.performance.timing.redirectStart/End times for a same-origin server side redirect navigation." type="compliance" status="approved" component="WebAPI/TBD/Navigation Timing" execution_type="auto" priority="P3" id="test_timing_server_redirect">
+ <description>
+ <pre_condition/>
+ <post_condition/>
+ <steps>
+ <step order="1">
+ <step_desc>This page should be redirect to a green frame by the php in same-origin server. After the page redirected, the frame is navigated to a new blank page with a green background.</step_desc>
+ <expected>This test passes if all of the checks to the values of the window.navigation.redirectCount and the window.performance.timing.redirectStart/End times are set correctlly.</expected>
+ </step>
+ </steps>
+ <test_script_entry timeout="90" test_script_expected_result="0">http://127.0.0.1:80/opt/tct-navigationtiming-w3c-tests/navigationtiming/w3c/test_timing_server_redirect.htm</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion usage="true" interface="Performance" specification="Navigation Timing" section="TBD" category="Tizen W3C API Specifications"/>
+ <spec_url>http://www.w3.org/TR/2012/REC-navigation-timing-20121217/</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="This test validates that all of the window.performance.timing attributes remain unchanged after an in document navigation (URL fragment change)." type="compliance" status="approved" component="WebAPI/TBD/Navigation Timing" execution_type="auto" priority="P3" id="test_navigate_within_document">
+ <description>
+ <pre_condition/>
+ <post_condition/>
+ <steps>
+ <step order="1">
+ <step_desc>Navigate in document (URL fragment change)</step_desc>
+ <expected>The test passes if all of the checks to performance.timing remain unchanged.</expected>
+ </step>
+ </steps>
+ <test_script_entry timeout="90" test_script_expected_result="0">/opt/tct-navigationtiming-w3c-tests/navigationtiming/w3c/test_navigate_within_document.htm</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion usage="true" interface="PerformanceTiming" specification="Navigation Timing" section="TBD" category="Tizen W3C API Specifications"/>
+ <spec_url>http://www.w3.org/TR/2012/REC-navigation-timing-20121217/</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="This test validates that the value of the window.performance.navigation.redirectCount attribute, as well as the window.performance.timing.redirectStart and redirectEnd attributes on a non-redirected navigation." type="compliance" status="approved" component="WebAPI/TBD/Navigation Timing" execution_type="auto" priority="P3" id="test_navigation_redirectCount_none">
+ <description>
+ <pre_condition/>
+ <post_condition/>
+ <steps>
+ <step order="1">
+ <step_desc>No redirected navigation is invoked.</step_desc>
+ <expected>This test passes if all of the checks to the values of window.performance.navigation.redirectCount attribute, window.performance.timing.redirectStart and redirectEnd are zero.</expected>
+ </step>
+ </steps>
+ <test_script_entry timeout="90" test_script_expected_result="0">/opt/tct-navigationtiming-w3c-tests/navigationtiming/w3c/test_navigation_redirectCount_none.htm</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion usage="true" interface="Performance" specification="Navigation Timing" section="TBD" category="Tizen W3C API Specifications"/>
+ <spec_url>http://www.w3.org/TR/2012/REC-navigation-timing-20121217/</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="This test validates the value of window.performance.navigation.type and the values of window.performance.timing.* with a reloaded navigation." type="compliance" status="approved" component="WebAPI/TBD/Navigation Timing" execution_type="auto" priority="P3" id="test_navigation_type_reload">
+ <description>
+ <pre_condition/>
+ <post_condition/>
+ <steps>
+ <step order="1">
+ <step_desc>This page be loaded with a green background frame. The frame will be automatically reloaded.</step_desc>
+ <expected>The window.performance.navigation.type = TYPE_RELOAD. All of the widow.performance.timing.* values after reload are > all of the window.performance.timing.* values prior to reload.</expected>
+ </step>
+ </steps>
+ <test_script_entry timeout="90" test_script_expected_result="0">/opt/tct-navigationtiming-w3c-tests/navigationtiming/w3c/test_navigation_type_reload.htm</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion usage="true" interface="Performance" specification="Navigation Timing" section="TBD" category="Tizen W3C API Specifications"/>
+ <spec_url>http://www.w3.org/TR/2012/REC-navigation-timing-20121217/</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="This test validates the unload event times are 0 when there is no previous document." type="compliance" status="approved" component="WebAPI/TBD/Navigation Timing" execution_type="auto" priority="P3" id="test_no_previous_document">
+ <description>
+ <pre_condition/>
+ <post_condition/>
+ <steps>
+ <step order="1">
+ <step_desc>Navigated with no previous document.</step_desc>
+ <expected>The window.performance.navigation.type = TYPE_NAVIGATE. Window.performance.timing.unloadEventStart and window.performance.timing.unloadEventEnd values are 0.</expected>
+ </step>
+ </steps>
+ <test_script_entry timeout="90" test_script_expected_result="0">/opt/tct-navigationtiming-w3c-tests/navigationtiming/w3c/test_no_previous_document.htm</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion usage="true" interface="Performance" specification="Navigation Timing" section="TBD" category="Tizen W3C API Specifications"/>
+ <spec_url>http://www.w3.org/TR/2012/REC-navigation-timing-20121217/</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
+ <testcase purpose="This test validates that the window.performance.timing attributes change when a page is reloaded." type="compliance" status="approved" component="WebAPI/TBD/Navigation Timing" execution_type="auto" priority="P3" id="test_timing_reload">
+ <description>
+ <pre_condition/>
+ <post_condition/>
+ <steps>
+ <step order="1">
+ <step_desc>This page should be loaded with a green background frame. The frame will be automatically reloaded.</step_desc>
+ <expected>Window.performance.timing attributes have been updated to the new reloaded navigation timings.</expected>
+ </step>
+ </steps>
+ <test_script_entry timeout="90" test_script_expected_result="0">/opt/tct-navigationtiming-w3c-tests/navigationtiming/w3c/test_timing_reload.htm</test_script_entry>
+ </description>
+ <specs>
+ <spec>
+ <spec_assertion usage="true" interface="Performance" specification="Navigation Timing" section="TBD" category="Tizen W3C API Specifications"/>
+ <spec_url>http://www.w3.org/TR/2012/REC-navigation-timing-20121217/</spec_url>
+ <spec_statement>TBD</spec_statement>
+ </spec>
+ </specs>
+ </testcase>
</set>
</suite>
</test_definition>