Commit d2538d5c authored by Nicolas Pena's avatar Nicolas Pena Committed by Commit Bot

Remove http/tests/w3c

This CL moves the final user-timing tests to external/wpt and removes
the folder. The performance_entrylist_checker is changed as in the http
counterpart to allow de-duplicating test messages.

There are some tests that are related to the wpt counterparts, but not
equivalent and in a different format, so unifying some of these tests
can be done in the future.

Bug: 498037
Change-Id: I6f35d962ba088d92a9768e49a65dea4d5c267491
Reviewed-on: https://chromium-review.googlesource.com/1007888Reviewed-by: default avatarTimothy Dresser <tdresser@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550310}
parent b587e04e
......@@ -5,10 +5,11 @@
<title>functionality test of window.performance.clearMarks</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/user-timing/#extensions-performance-interface"/>
<script src="/w3c/resources/testharness.js"></script>
<script src="/w3c/resources/testharnessreport.js"></script>
<script src="/w3c/webperf/resources/webperftestharness.js"></script>
<script src="/w3c/webperf/resources/webperftestharnessextension.js"></script>
<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 src="resources/webperftestharnessextension.js"></script>
<script>
setup({ explicit_done: true });
......
......@@ -5,10 +5,11 @@
<title>functionality test of window.performance.clearMeasures</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/user-timing/#extensions-performance-interface"/>
<script src="/w3c/resources/testharness.js"></script>
<script src="/w3c/resources/testharnessreport.js"></script>
<script src="/w3c/webperf/resources/webperftestharness.js"></script>
<script src="/w3c/webperf/resources/webperftestharnessextension.js"></script>
<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 src="resources/webperftestharnessextension.js"></script>
<script>
setup({ explicit_done: true });
......
......@@ -5,10 +5,11 @@
<title>functionality test of window.performance.mark</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/user-timing/#extensions-performance-interface"/>
<script src="/w3c/resources/testharness.js"></script>
<script src="/w3c/resources/testharnessreport.js"></script>
<script src="/w3c/webperf/resources/webperftestharness.js"></script>
<script src="/w3c/webperf/resources/webperftestharnessextension.js"></script>
<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 src="resources/webperftestharnessextension.js"></script>
<script>
setup({ explicit_done: true });
......
......@@ -5,10 +5,11 @@
<title>functionality test of window.performance.measure</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/user-timing/#extensions-performance-interface"/>
<script src="/w3c/resources/testharness.js"></script>
<script src="/w3c/resources/testharnessreport.js"></script>
<script src="/w3c/webperf/resources/webperftestharness.js"></script>
<script src="/w3c/webperf/resources/webperftestharnessextension.js"></script>
<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 src="resources/webperftestharnessextension.js"></script>
<script>
setup({ explicit_done: true });
......
......@@ -5,10 +5,11 @@
<title>exception test of window.performance.measure</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/user-timing/#extensions-performance-interface"/>
<script src="/w3c/resources/testharness.js"></script>
<script src="/w3c/resources/testharnessreport.js"></script>
<script src="/w3c/webperf/resources/webperftestharness.js"></script>
<script src="/w3c/webperf/resources/webperftestharnessextension.js"></script>
<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 src="resources/webperftestharnessextension.js"></script>
</head>
<body>
......
......@@ -5,10 +5,11 @@
<title>functionality test of window.performance.measure</title>
<link rel="author" title="Intel" href="http://www.intel.com/" />
<link rel="help" href="http://www.w3.org/TR/user-timing/#extensions-performance-interface"/>
<script src="/w3c/resources/testharness.js"></script>
<script src="/w3c/resources/testharnessreport.js"></script>
<script src="/w3c/webperf/resources/webperftestharness.js"></script>
<script src="/w3c/webperf/resources/webperftestharnessextension.js"></script>
<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 src="resources/webperftestharnessextension.js"></script>
<script>
setup({ explicit_done: true });
......
......@@ -88,28 +88,29 @@ function test_resource_entries(entries, expected_entries)
}
}
}
function performance_entrylist_checker(type)
{
var entryType = type;
const entryType = type;
function entry_check(entry, expectedNames)
function entry_check(entry, expectedNames, testDescription = '')
{
var msg = 'Entry \"' + entry.name + '\" should be one that we have set.';
const msg = testDescription + 'Entry \"' + entry.name + '\" should be one that we have set.';
wp_test(function() { assert_in_array(entry.name, expectedNames, msg); }, msg);
test_equals(entry.entryType, entryType, 'entryType should be \"' + entryType + '\".');
test_equals(entry.entryType, entryType, testDescription + 'entryType should be \"' + entryType + '\".');
if (type === "measure") {
test_true(isFinite(entry.startTime), 'startTime should be a number.');
test_true(isFinite(entry.duration), 'duration should be a number.');
test_true(isFinite(entry.startTime), testDescription + 'startTime should be a number.');
test_true(isFinite(entry.duration), testDescription + 'duration should be a number.');
} else if (type === "mark") {
test_greater_than(entry.startTime, 0, 'startTime should greater than 0.');
test_equals(entry.duration, 0, 'duration of mark should be 0.');
test_greater_than(entry.startTime, 0, testDescription + 'startTime should greater than 0.');
test_equals(entry.duration, 0, testDescription + 'duration of mark should be 0.');
}
}
function entrylist_order_check(entryList)
{
var inOrder = true;
for (var i = 0; i < entryList.length - 1; ++i)
let inOrder = true;
for (let i = 0; i < entryList.length - 1; ++i)
{
if (entryList[i + 1].startTime < entryList[i].startTime) {
inOrder = false;
......@@ -119,13 +120,13 @@ function performance_entrylist_checker(type)
return inOrder;
}
function entrylist_check(entryList, expectedLength, expectedNames)
function entrylist_check(entryList, expectedLength, expectedNames, testDescription = '')
{
test_equals(entryList.length, expectedLength, 'There should be ' + expectedLength + ' entries.');
test_true(entrylist_order_check(entryList), 'Entries in entrylist should be in order.');
for (var i = 0; i < entryList.length; ++i)
test_equals(entryList.length, expectedLength, testDescription + 'There should be ' + expectedLength + ' entries.');
test_true(entrylist_order_check(entryList), testDescription + 'Entries in entrylist should be in order.');
for (let i = 0; i < entryList.length; ++i)
{
entry_check(entryList[i], expectedNames);
entry_check(entryList[i], expectedNames, testDescription + 'Entry_list ' + i + '. ');
}
}
......
This directory contains files imported from the W3C.
== THIS DIRECTORY IS OBSOLETE ==
Tests are now imported into LayoutTests/imported (see README there).
The tests in LayoutTests/http/tests/w3c/webperf were imported from
https://dvcs.w3.org/hg/webperf/ but have been migrated into the
https://github.com/w3c/web-platform-tests repo:
* HighResolutionTime -> hr-time/
* navigation-timing -> navigation-timing/
* resource-timing -> resource-timing/
* UserTiming -> user-timing/
This directory now contains:
* Submissions that were not "approved" - these should be reviewed
for redundancy with approved tests in web-platform-tests
* Tests that require a http/s server. Tracked as:
http://crbug.com/360762
Please do not add additional tests to this directory, and strive
to remove them. Removing this directory is tracked as:
http://crbug.com/498037
== Previous Documentation ==
With only one exception (below), these files should not be modified directly. Instead, please
source the files from the following locations:
resources/testharness.js - and...
resources/testharness.css - Fetch from http://w3c-test.org/resources/
resources/testharnessreport.js - Modify directly. It's the vendor specific portion.
webperf/ - Use Tools/Scripts/import-w3c-performance-wg-tests
/*
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);
}
/*
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
*/
var mark_names = [
'',
'1',
'abc',
];
var measures = [
[''],
['2', 1],
['aaa', 'navigationStart', ''],
];
function test_method_exists(method, method_name, properties)
{
var msg;
if (typeof method === 'function')
msg = 'performance.' + method.name + ' is supported!';
else
msg = 'performance.' + method_name + ' is supported!';
wp_test(function() { assert_true(typeof method === 'function', msg); }, msg, properties);
}
function test_method_throw_exception(func_str, exception, msg)
{
var exception_name = typeof exception === "object" ? exception.name : exception;
var msg = 'Invocation of ' + func_str + ' should throw ' + exception_name + ' Exception.';
wp_test(function() { assert_throws(exception, function() {eval(func_str)}, msg); }, msg);
}
function test_noless_than(value, greater_than, msg, properties)
{
wp_test(function () { assert_true(value >= greater_than, msg); }, msg, properties);
}
function test_fail(msg, properties)
{
wp_test(function() { assert_unreached(); }, msg, properties);
}
function test_resource_entries(entries, expected_entries)
{
// This is slightly convoluted so that we can sort the output.
var actual_entries = {};
var origin = window.location.protocol + "//" + window.location.host;
for (var i = 0; i < entries.length; ++i) {
var entry = entries[i];
var found = false;
for (var expected_entry in expected_entries) {
if (entry.name == origin + expected_entry) {
found = true;
if (expected_entry in actual_entries) {
test_fail(expected_entry + ' is not expected to have duplicate entries');
}
actual_entries[expected_entry] = entry;
break;
}
}
if (!found) {
test_fail(entries[i].name + ' is not expected to be in the Resource Timing buffer');
}
}
sorted_urls = [];
for (var i in actual_entries) {
sorted_urls.push(i);
}
sorted_urls.sort();
for (var i in sorted_urls) {
var url = sorted_urls[i];
test_equals(actual_entries[url].initiatorType,
expected_entries[url],
origin + url + ' is expected to have initiatorType ' + expected_entries[url]);
}
for (var j in expected_entries) {
if (!(j in actual_entries)) {
test_fail(origin + j + ' is expected to be in the Resource Timing buffer');
}
}
}
function performance_entrylist_checker(type)
{
var entryType = type;
function entry_check(entry, expectedNames, testDescription='')
{
var msg = testDescription + 'Entry \"' + entry.name + '\" should be one that we have set.';
wp_test(function() { assert_in_array(entry.name, expectedNames, msg); }, msg);
test_equals(entry.entryType, entryType, testDescription + 'entryType should be \"' + entryType + '\".');
if (type === "measure") {
test_true(isFinite(entry.startTime), testDescription + 'startTime should be a number.');
test_true(isFinite(entry.duration), testDescription + 'duration should be a number.');
} else if (type === "mark") {
test_greater_than(entry.startTime, 0, testDescription + 'startTime should greater than 0.');
test_equals(entry.duration, 0, testDescription + 'duration of mark should be 0.');
}
}
function entrylist_order_check(entryList)
{
var inOrder = true;
for (var i = 0; i < entryList.length - 1; ++i)
{
if (entryList[i + 1].startTime < entryList[i].startTime) {
inOrder = false;
break;
}
}
return inOrder;
}
function entrylist_check(entryList, expectedLength, expectedNames, testDescription='')
{
test_equals(entryList.length, expectedLength, testDescription + 'There should be ' + expectedLength + ' entries.');
test_true(entrylist_order_check(entryList), testDescription + 'Entries in entrylist should be in order.');
for (var i = 0; i < entryList.length; ++i)
{
if (testDescription != '')
entry_check(entryList[i], expectedNames, testDescription + 'Entry_list ' + i + '. ');
else
entry_check(entryList[i], expectedNames);
}
}
return{"entrylist_check":entrylist_check};
}
function PerformanceContext(context)
{
this.performanceContext = context;
}
PerformanceContext.prototype =
{
initialMeasures: function(item, index, array)
{
(this.performanceContext.measure ||
this.performanceContext.mozMeasure ||
this.performanceContext.msMeasure ||
this.performanceContext.oMeasure ||
this.performanceContext.webkitMeasure)
.apply(this.performanceContext, item);
},
mark: function()
{
(this.performanceContext.mark ||
this.performanceContext.mozMark ||
this.performanceContext.msMark ||
this.performanceContext.oMark ||
this.performanceContext.webkitMark)
.apply(this.performanceContext, arguments);
},
measure: function()
{
(this.performanceContext.measure ||
this.performanceContext.mozMeasure ||
this.performanceContext.msMeasure ||
this.performanceContext.oMeasure ||
this.performanceContext.webkitMeasure)
.apply(this.performanceContext, arguments);
},
clearMarks: function()
{
(this.performanceContext.clearMarks ||
this.performanceContext.mozClearMarks ||
this.performanceContext.msClearMarks ||
this.performanceContext.oClearMarks ||
this.performanceContext.webkitClearMarks)
.apply(this.performanceContext, arguments);
},
clearMeasures: function()
{
(this.performanceContext.clearMeasures ||
this.performanceContext.mozClearMeasures ||
this.performanceContext.msClearMeasures ||
this.performanceContext.oClearMeasures ||
this.performanceContext.webkitClearMeasures)
.apply(this.performanceContext, arguments);
},
getEntries: function()
{
return (this.performanceContext.getEntries ||
this.performanceContext.mozGetEntries ||
this.performanceContext.msGetEntries ||
this.performanceContext.oGetEntries ||
this.performanceContext.webkitGetEntries)
.apply(this.performanceContext, arguments);
},
getEntriesByType: function()
{
return (this.performanceContext.getEntriesByType ||
this.performanceContext.mozGetEntriesByType ||
this.performanceContext.msGetEntriesByType ||
this.performanceContext.oGetEntriesByType ||
this.performanceContext.webkitGetEntriesByType)
.apply(this.performanceContext, arguments);
},
getEntriesByName: function()
{
return (this.performanceContext.getEntriesByName ||
this.performanceContext.mozGetEntriesByName ||
this.performanceContext.msGetEntriesByName ||
this.performanceContext.oGetEntriesByName ||
this.performanceContext.webkitGetEntriesByName)
.apply(this.performanceContext, arguments);
},
setResourceTimingBufferSize: function()
{
return (this.performanceContext.setResourceTimingBufferSize ||
this.performanceContext.mozSetResourceTimingBufferSize ||
this.performanceContext.msSetResourceTimingBufferSize ||
this.performanceContext.oSetResourceTimingBufferSize ||
this.performanceContext.webkitSetResourceTimingBufferSize)
.apply(this.performanceContext, arguments);
},
registerResourceTimingBufferFullCallback: function(func)
{
if (typeof this.performanceContext.onresourcetimingbufferfull !== "undefined")
this.performanceContext.onresourcetimingbufferfull = func;
else if (typeof this.performanceContext.onmozresourcetimingbufferfull !== "undefined")
this.performanceContext.onmozresourcetimingbufferfull = func;
else if (typeof this.performanceContext.onmsresourcetimingbufferfull !== "undefined")
this.performanceContext.onmsresourcetimingbufferfull = func;
else if (typeof this.performanceContext.onoresourcetimingbufferfull !== "undefined")
this.performanceContext.onoresourcetimingbufferfull = func;
else if (typeof this.performanceContext.onwebkitresourcetimingbufferfull !== "undefined")
this.performanceContext.onwebkitresourcetimingbufferfull = func;
},
clearResourceTimings: function()
{
(this.performanceContext.clearResourceTimings ||
this.performanceContext.mozClearResourceTimings ||
this.performanceContext.msClearResourceTimings ||
this.performanceContext.oClearResourceTimings ||
this.performanceContext.webkitClearResourceTimings)
.apply(this.performanceContext, arguments);
}
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment