From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001
From: "Matt A. Tobin" This test validates window.performance.timing remains constant when a
+document is replaced using document.open. This page should be loaded with a yellow frame below. It then replaces the
+document in that frame with a green document. The test passes if all of the checks to performance.timing are correct and
+the frame below ends with a green background. This test validates that the "loading", "interactive" and "complete"
+ document.readyState states are available during a navigation. Refresh this page to guarantee all readyState phases. This test validates that all of the window.performance.timing attributes remain unchanged after an in document navigation (URL fragment change). This test validates that all of the window.performance.navigation attributes exist (but does not validate that their values are correct). 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.
+ This test validates the value of window.performance.navigation.type with a forward
+ and back navigation. This page should be loaded with a yellow background frame below. It should turn green for a starting
+ navigation, back to yellow for a back navigation and then back to green again for a forward navigation. Along the navigation timeline the frame.window.performance.type is checked for TYPE_BACK_FORWARD. This test passes if all of the checks to the navigation.type are correct throughout the navigation
+ scenario and the frame below ends with a green background. Otherwise, this test fails. This test validates that the TYPE_* enumerations of window.performance.navigation exist and their values are correct. This test validates the value of window.performance.navigation.type and the values of
+ window.performance.timing.* with a reloaded navigation. This page should be loaded with a green background frame below. The frame will be automatically reloaded
+ and then verified that
+ Navigation Timing IDL tests
+
+
+
+
+
+interface PerformanceTiming {
+ readonly attribute unsigned long long navigationStart;
+ readonly attribute unsigned long long unloadEventStart;
+ readonly attribute unsigned long long unloadEventEnd;
+ readonly attribute unsigned long long redirectStart;
+ readonly attribute unsigned long long redirectEnd;
+ readonly attribute unsigned long long fetchStart;
+ readonly attribute unsigned long long domainLookupStart;
+ readonly attribute unsigned long long domainLookupEnd;
+ readonly attribute unsigned long long connectStart;
+ readonly attribute unsigned long long connectEnd;
+ readonly attribute unsigned long long secureConnectionStart;
+ readonly attribute unsigned long long requestStart;
+ readonly attribute unsigned long long responseStart;
+ readonly attribute unsigned long long responseEnd;
+ readonly attribute unsigned long long domLoading;
+ readonly attribute unsigned long long domInteractive;
+ readonly attribute unsigned long long domContentLoadedEventStart;
+ readonly attribute unsigned long long domContentLoadedEventEnd;
+ readonly attribute unsigned long long domComplete;
+ readonly attribute unsigned long long loadEventStart;
+ readonly attribute unsigned long long loadEventEnd;
+};
+
+interface PerformanceNavigation {
+ const unsigned short TYPE_NAVIGATE = 0;
+ const unsigned short TYPE_RELOAD = 1;
+ const unsigned short TYPE_BACK_FORWARD = 2;
+ const unsigned short TYPE_RESERVED = 255;
+ readonly attribute unsigned short type;
+ readonly attribute unsigned short redirectCount;
+};
+
+interface Performance : EventTarget {
+ readonly attribute PerformanceTiming timing;
+ readonly attribute PerformanceNavigation navigation;
+};
+
+partial interface Window {
+ [Replaceable] readonly attribute Performance performance;
+};
+
+
+
+
+
diff --git a/testing/web-platform/tests/navigation-timing/resources/blank_page_green.html b/testing/web-platform/tests/navigation-timing/resources/blank_page_green.html
new file mode 100644
index 000000000..b8a1947b7
--- /dev/null
+++ b/testing/web-platform/tests/navigation-timing/resources/blank_page_green.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Placeholder
+
+
diff --git a/testing/web-platform/tests/navigation-timing/resources/blank_page_green_with_onunload.html b/testing/web-platform/tests/navigation-timing/resources/blank_page_green_with_onunload.html
new file mode 100644
index 000000000..2f401747b
--- /dev/null
+++ b/testing/web-platform/tests/navigation-timing/resources/blank_page_green_with_onunload.html
@@ -0,0 +1,11 @@
+
+
+
+
+ Placeholder
+
+
diff --git a/testing/web-platform/tests/navigation-timing/resources/blank_page_meta_redirect.html b/testing/web-platform/tests/navigation-timing/resources/blank_page_meta_redirect.html
new file mode 100644
index 000000000..50d6e7057
--- /dev/null
+++ b/testing/web-platform/tests/navigation-timing/resources/blank_page_meta_redirect.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+ Placeholder
+
+
diff --git a/testing/web-platform/tests/navigation-timing/resources/blank_page_unload.html b/testing/web-platform/tests/navigation-timing/resources/blank_page_unload.html
new file mode 100644
index 000000000..bb2a27f16
--- /dev/null
+++ b/testing/web-platform/tests/navigation-timing/resources/blank_page_unload.html
@@ -0,0 +1,25 @@
+
+
+
+
+
+ Unload
+
+
diff --git a/testing/web-platform/tests/navigation-timing/resources/blank_page_yellow.html b/testing/web-platform/tests/navigation-timing/resources/blank_page_yellow.html
new file mode 100644
index 000000000..4e5e1a000
--- /dev/null
+++ b/testing/web-platform/tests/navigation-timing/resources/blank_page_yellow.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Placeholder
+
+
\ No newline at end of file
diff --git a/testing/web-platform/tests/navigation-timing/resources/blank_page_yellow_with_onunload.html b/testing/web-platform/tests/navigation-timing/resources/blank_page_yellow_with_onunload.html
new file mode 100644
index 000000000..771e0701d
--- /dev/null
+++ b/testing/web-platform/tests/navigation-timing/resources/blank_page_yellow_with_onunload.html
@@ -0,0 +1,11 @@
+
+
+
+
+ Placeholder
+
+
\ No newline at end of file
diff --git a/testing/web-platform/tests/navigation-timing/resources/webperftestharness.js b/testing/web-platform/tests/navigation-timing/resources/webperftestharness.js
new file mode 100644
index 000000000..750946dde
--- /dev/null
+++ b/testing/web-platform/tests/navigation-timing/resources/webperftestharness.js
@@ -0,0 +1,155 @@
+/*
+Distributed under both the W3C Test Suite License [1] and the W3C
+3-clause BSD License [2]. To contribute to a W3C Test Suite, see the
+policies and contribution forms [3].
+
+[1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license
+[2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license
+[3] http://www.w3.org/2004/10/27-testcases
+ */
+
+//
+// Helper Functions for NavigationTiming W3C tests
+//
+
+var performanceNamespace = window.performance;
+var timingAttributes = [
+ 'connectEnd',
+ 'connectStart',
+ 'domComplete',
+ 'domContentLoadedEventEnd',
+ 'domContentLoadedEventStart',
+ 'domInteractive',
+ 'domLoading',
+ 'domainLookupEnd',
+ 'domainLookupStart',
+ 'fetchStart',
+ 'loadEventEnd',
+ 'loadEventStart',
+ 'navigationStart',
+ 'redirectEnd',
+ 'redirectStart',
+ 'requestStart',
+ 'responseEnd',
+ 'responseStart',
+ 'unloadEventEnd',
+ 'unloadEventStart'
+];
+
+var namespace_check = false;
+
+//
+// All test() functions in the WebPerf test suite should use wp_test() instead.
+//
+// wp_test() validates the window.performance namespace exists prior to running tests and
+// immediately shows a single failure if it does not.
+//
+
+function wp_test(func, msg, properties)
+{
+ // only run the namespace check once
+ if (!namespace_check)
+ {
+ namespace_check = true;
+
+ if (performanceNamespace === undefined || performanceNamespace == null)
+ {
+ // show a single error that window.performance is undefined
+ test(function() { assert_true(performanceNamespace !== undefined && performanceNamespace != null, "window.performance is defined and not null"); }, "window.performance is defined and not null.", {author:"W3C http://www.w3.org/",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. "});
+ }
+ }
+
+ test(func, msg, properties);
+}
+
+function test_namespace(child_name, skip_root)
+{
+ if (skip_root === undefined) {
+ var msg = 'window.performance is defined';
+ wp_test(function () { assert_true(performanceNamespace !== undefined, msg); }, msg,{author:"W3C http://www.w3.org/",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. "});
+ }
+
+ if (child_name !== undefined) {
+ var msg2 = 'window.performance.' + child_name + ' is defined';
+ wp_test(function() { assert_true(performanceNamespace[child_name] !== undefined, msg2); }, msg2,{author:"W3C http://www.w3.org/",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. "});
+ }
+}
+
+function test_attribute_exists(parent_name, attribute_name, properties)
+{
+ var msg = 'window.performance.' + parent_name + '.' + attribute_name + ' is defined.';
+ wp_test(function() { assert_true(performanceNamespace[parent_name][attribute_name] !== undefined, msg); }, msg, properties);
+}
+
+function test_enum(parent_name, enum_name, value, properties)
+{
+ var msg = 'window.performance.' + parent_name + '.' + enum_name + ' is defined.';
+ wp_test(function() { assert_true(performanceNamespace[parent_name][enum_name] !== undefined, msg); }, msg, properties);
+
+ msg = 'window.performance.' + parent_name + '.' + enum_name + ' = ' + value;
+ wp_test(function() { assert_equals(performanceNamespace[parent_name][enum_name], value, msg); }, msg, properties);
+}
+
+function test_timing_order(attribute_name, greater_than_attribute, properties)
+{
+ // ensure it's not 0 first
+ var msg = "window.performance.timing." + attribute_name + " > 0";
+ wp_test(function() { assert_true(performanceNamespace.timing[attribute_name] > 0, msg); }, msg, properties);
+
+ // ensure it's in the right order
+ msg = "window.performance.timing." + attribute_name + " >= window.performance.timing." + greater_than_attribute;
+ wp_test(function() { assert_true(performanceNamespace.timing[attribute_name] >= performanceNamespace.timing[greater_than_attribute], msg); }, msg, properties);
+}
+
+function test_timing_greater_than(attribute_name, greater_than, properties)
+{
+ var msg = "window.performance.timing." + attribute_name + " > " + greater_than;
+ test_greater_than(performanceNamespace.timing[attribute_name], greater_than, msg, properties);
+}
+
+function test_timing_equals(attribute_name, equals, msg, properties)
+{
+ var test_msg = msg || "window.performance.timing." + attribute_name + " == " + equals;
+ test_equals(performanceNamespace.timing[attribute_name], equals, test_msg, properties);
+}
+
+//
+// Non-test related helper functions
+//
+
+function sleep_milliseconds(n)
+{
+ var start = new Date().getTime();
+ while (true) {
+ if ((new Date().getTime() - start) >= n) break;
+ }
+}
+
+//
+// Common helper functions
+//
+
+function test_true(value, msg, properties)
+{
+ wp_test(function () { assert_true(value, msg); }, msg, properties);
+}
+
+function test_equals(value, equals, msg, properties)
+{
+ wp_test(function () { assert_equals(value, equals, msg); }, msg, properties);
+}
+
+function test_greater_than(value, greater_than, msg, properties)
+{
+ wp_test(function () { assert_true(value > greater_than, msg); }, msg, properties);
+}
+
+function test_greater_or_equals(value, greater_than, msg, properties)
+{
+ wp_test(function () { assert_true(value >= greater_than, msg); }, msg, properties);
+}
+
+function test_not_equals(value, notequals, msg, properties)
+{
+ wp_test(function() { assert_true(value !== notequals, msg); }, msg, properties);
+}
diff --git a/testing/web-platform/tests/navigation-timing/test_document_open.html b/testing/web-platform/tests/navigation-timing/test_document_open.html
new file mode 100644
index 000000000..1fe75da4e
--- /dev/null
+++ b/testing/web-platform/tests/navigation-timing/test_document_open.html
@@ -0,0 +1,82 @@
+
+
+
+
+Description
+
+
+
+
diff --git a/testing/web-platform/tests/navigation-timing/test_document_readiness_exist.html b/testing/web-platform/tests/navigation-timing/test_document_readiness_exist.html
new file mode 100644
index 000000000..58f5659a0
--- /dev/null
+++ b/testing/web-platform/tests/navigation-timing/test_document_readiness_exist.html
@@ -0,0 +1,49 @@
+
+
+
+
+ Description
+ Description
+ Description
+ Description
+
+ Description
+
+
+
+
diff --git a/testing/web-platform/tests/navigation-timing/test_navigation_type_enums.html b/testing/web-platform/tests/navigation-timing/test_navigation_type_enums.html
new file mode 100644
index 000000000..8bf8e4f3d
--- /dev/null
+++ b/testing/web-platform/tests/navigation-timing/test_navigation_type_enums.html
@@ -0,0 +1,27 @@
+
+
+
+
+ Description
+ Description
+
+
+
This test validates the unload event times are 0 when there is no previous document.
+ +This test validates that the navigation and timing attributes exist for window.performance + (but does not validate that their values are correct).
+ + + + diff --git a/testing/web-platform/tests/navigation-timing/test_performance_attributes_exist_in_object.html b/testing/web-platform/tests/navigation-timing/test_performance_attributes_exist_in_object.html new file mode 100644 index 000000000..0464758c6 --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/test_performance_attributes_exist_in_object.html @@ -0,0 +1,28 @@ + + + + +This test validates that the window.performance object exists in an + object element (but does not validate that their values are correct).
+ + + + diff --git a/testing/web-platform/tests/navigation-timing/test_readwrite.html b/testing/web-platform/tests/navigation-timing/test_readwrite.html new file mode 100644 index 000000000..3d2a96f18 --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/test_readwrite.html @@ -0,0 +1,27 @@ + + + + +This test validates that the window.performance object is read/write.
+ + + + diff --git a/testing/web-platform/tests/navigation-timing/test_timing_attributes_exist.html b/testing/web-platform/tests/navigation-timing/test_timing_attributes_exist.html new file mode 100644 index 000000000..f3dea6838 --- /dev/null +++ b/testing/web-platform/tests/navigation-timing/test_timing_attributes_exist.html @@ -0,0 +1,27 @@ + + + + +This test validates that all of the window.performance.timing attributes exist (but does not validate that their values are correct).
+ + + + + + 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 @@ + + + + +This test validates the ordering of the window.performance.timing attributes.
+ +This page should be loaded with a yellow background frame below which contains an unload event + handler.
+ +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
+ +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.
+ +This test validates the values of the window.navigation.redirectCount and the + window.performance.timing.redirectStart/End times on a client side redirect.
+ +This test validates that the window.performance.timing attributes change when a page is reloaded.
+ +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.
+ + +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.
+ + +This test validates the values of the window.performance.redirectCount and the + window.performance.timing.redirectStart/End times for a cross-origin server side redirect navigation.
+ + +This test validates that each window has a unique window.performance object.
+ + + + + -- cgit v1.2.3