Lines Matching refs:tests

4 /* Documentation: https://web-platform-tests.org/writing-tests/testharness-api.html
5 * (../docs/_writing-tests/testharness-api.md) */
29 * // Invoked after the global 'tests' object has been created and it's
81 function (tests, harness_status, asserts) {
82 var cloned_tests = map(tests, function(test) {
85 this_obj._dispatch("completion_callback", [tests, harness_status],
87 tests: cloned_tests,
183 add_completion_callback(function (tests, harness_status, asserts_run) {
184 this_obj.output_handler.show_results(tests, harness_status, asserts_run);
305 function(tests, harness_status, asserts) {
308 tests: map(tests,
322 // worker tests behave as if settings.explicit_timeout is true.
345 // workers to explicitly signal when the tests are done.
346 tests.wait_for_finish = true;
371 // workers to explicitly signal when the tests are done.
372 tests.wait_for_finish = true;
396 // equivalent of an onload event for a document. All tests should have
398 // necessary to wait until the onactivate event. However, tests for
401 // onmessage event is used for that purpose since tests using
443 * Signal to the test environment that the tests are ready and the on-loaded
621 if (tests.promise_setup_called) {
622 tests.status.status = tests.status.ERROR;
623 tests.status.message = '`test` invoked after `promise_setup`';
624 tests.complete();
641 tests.status.status = tests.status.ERROR;
642 tests.status.message = msg;
663 if (tests.promise_setup_called) {
664 tests.status.status = tests.status.ERROR;
665 tests.status.message = '`async_test` invoked after `promise_setup`';
666 tests.complete();
697 tests.set_status(tests.status.ERROR, msg);
698 tests.complete();
707 * Promise tests are tests which are represented by a promise
727 // If there is no promise tests queue make one.
728 if (!tests.promise_tests) {
729 tests.promise_tests = Promise.resolve();
731 tests.promise_tests = tests.promise_tests.then(function() {
1032 * before declaring all tests complete (this is always true for
1033 * single-page tests).
1039 * called This should typically only be set for manual tests, or
1073 tests.setup(func, properties);
1079 * before running any `promise_test` tests.
1082 * run synchronously. Promise tests are not run until after this
1091 tests.set_status(tests.status.ERROR,
1093 tests.complete();
1096 tests.promise_setup_called = true;
1098 if (!tests.promise_tests) {
1099 tests.promise_tests = Promise.resolve();
1102 tests.promise_tests = tests.promise_tests
1107 tests.setup(null, properties);
1118 tests.set_status(tests.status.ERROR,
1121 tests.complete();
1133 * For single page tests this marks the test as complete and sets its status.
1134 * For other tests, this marks test loading as complete, but doesn't affect ongoing tests.
1137 if (tests.tests.length === 0) {
1141 if (tests.status.status === null) {
1142 tests.status.status = tests.status.ERROR;
1143 tests.status.message = "done() was called without first defining any tests";
1146 tests.complete();
1149 if (tests.file_is_test) {
1152 tests.tests[0].done();
1154 tests.end_wait();
1158 * @deprecated generate a list of tests from a function and list of arguments
1160 * This is deprecated because it runs all the tests outside of the test functions
1161 * and as a result any test throwing an exception will result in no tests being
1165 * @param {Function} func - The function that will be called for each generated tests.
1200 * Global version of :js:func:`Test.step_timeout` for use in single page tests.
1212 }, timeout * tests.timeout_multiplier);
1381 // Special-case Node objects, since those come up a lot in my tests. I
1431 console.debug("ASSERT", name, tests.current_test && tests.current_test.name, args);
1433 if (tests.output) {
1434 tests.set_assert(name, args);
1444 if (tests.output && !stack) {
1447 if (tests.output) {
1448 tests.set_assert_status(status, stack);
1557 // See https://github.com/web-platform-tests/wpt/issues/2033
1563 * <https://github.com/web-platform-tests/wpt/issues/2033>`_ for
2364 * Note that tests with multiple allowed pass conditions are bad
2402 * This function should be used to early-exit from tests in which there is
2419 * This function should be used to early-exit from tests in which there is
2448 if (tests.file_is_test && tests.tests.length) {
2454 this.phase = (tests.is_aborted || tests.phase === tests.phases.COMPLETE) ?
2465 this.timeout_length *= tests.timeout_multiplier;
2483 if (tests.phase === tests.phases.COMPLETE) {
2487 tests.push(this);
2571 tests.started = true;
2572 tests.current_test = this;
2573 tests.notify_test_state(this);
2711 }), timeout * tests.timeout_multiplier);
2736 var timeout_full = timeout * tests.timeout_multiplier;
2947 // Abort tests immediately so that tests declared within subsequent
2949 tests.abort();
2969 // Abort tests immediately so that tests declared
2971 tests.abort();
3017 tests.status.status = tests.status.ERROR;
3018 tests.status.stack = null;
3019 tests.status.message = "Test named '" + test.name +
3024 tests.status.message += ", and " + errors.length + " failed";
3025 tests.status.stack = ((typeof errors[0] === "object" &&
3033 tests.status.message += ", and " + bad_value_count +
3037 tests.status.message += ".";
3041 tests.result(test);
3066 tests.push(this);
3095 * `RemoteTest` instances are objects which represent tests running in
3132 * and maintain RemoteTest objects that mirror the tests running in the
3141 this.tests = new Array();
3200 tests.set_status(tests.status.ERROR,
3215 var remote_test = this.tests[data.test.index];
3218 this.tests[data.test.index] = remote_test;
3221 tests.notify_test_state(remote_test);
3225 var remote_test = this.tests[data.test.index];
3228 tests.result(remote_test);
3232 if (tests.status.status === null &&
3234 tests.set_status(data.status.status, data.status.message, data.status.stack);
3241 record.test = assert.test != null ? this.tests[assert.test.index] : null;
3244 tests.asserts_run.push(record);
3264 if (tests.all_done()) {
3265 tests.complete();
3364 this.tests = [];
3385 // dependency on ECMAScript 2015 Promises to all tests.
3482 if (this.tests.length > 0) {
3487 // Create the test, which will add it to the list of tests
3488 tests.current_test = async_test();
3514 forEach(this.tests,
3529 // tests.
3534 tests.status.stack = null;
3557 test.index = this.tests.push(test);
3570 return (this.tests.length > 0 || this.pending_remotes.length > 0) &&
3594 // phase, subsequent tests should not cause it to revert.
3625 var incomplete = filter(this.tests,
3665 * should cancel all further testing. Update all previously-defined tests
3672 forEach(this.tests,
3681 * Determine if any tests share the same `name` property. Return an array
3688 forEach (this.tests,
3717 function sanitize_all_unpaired_surrogates(tests) {
3718 forEach (tests,
3740 sanitize_all_unpaired_surrogates(this.tests);
3760 callback(this_obj.tests, this_obj.status, this_obj.asserts_run);
3765 * Constructs a RemoteContext that tracks tests from a specific worker.
3784 * Constructs a RemoteContext that tracks tests from a specific window.
3812 * running tests..
3813 * @returns {Promise} - A promise that's resolved once all the remote tests are complete.
3816 return tests.fetch_tests_from_worker(port);
3829 * Aggregate tests from separate windows or iframes
3837 * @param {Window} window - The window to fetch tests from.
3840 tests.fetch_tests_from_window(window);
3848 * @returns {Promise} - A promise that's resolved once all the remote tests are complete.
3855 var done = tests.fetch_tests_from_worker(chan.port2);
3863 * Begin running tests in this shadow realm test harness.
3865 * To be called after all tests have been loaded; it is an error to call
3884 * Timeout the tests.
3891 if (tests.timeout_length === null) {
3892 tests.timeout();
3904 tests.start_callbacks.push(callback);
3914 tests.test_state_callbacks.push(callback);
3924 tests.test_done_callbacks.push(callback);
3928 * Add a callback that's triggered when all tests are complete.
3941 tests.all_done_callbacks.push(callback);
3957 remove(tests.start_callbacks, callback);
3961 remove(tests.test_state_callbacks, callback);
3965 remove(tests.test_done_callbacks, callback);
3969 remove(tests.all_done_callbacks, callback);
4070 var done_count = tests.tests.length - tests.num_pending;
4071 if (this.output_node && !tests.hide_test_state) {
4077 tests.num_pending + " remain";
4082 Output.prototype.show_results = function (tests, harness_status, asserts_run) {
4112 forEach(tests,
4154 ["p", {}, "Found ${num_tests} tests"],
4173 log.appendChild(render(summary_template, {num_tests:tests.length}, output_document));
4202 // large test suites (tens of thousands of tests).
4213 for (var i = 0; i < tests.length; i++) {
4214 if (tests[i].properties.hasOwnProperty("assert")) {
4285 for (var i = 0; i < tests.length; i++) {
4286 var test = tests[i];
4298 escape_html(test.message ? tests[i].message : " ") +
4299 (tests[i].stack ? "<pre>" +
4300 escape_html(tests[i].stack) +
4746 var tests = new Tests();
4751 if (tests.file_is_test) {
4752 var test = tests.tests[0];
4759 } else if (!tests.allow_uncaught_exception) {
4760 var status = optional_unsupported ? tests.status.PRECONDITION_FAILED : tests.status.ERROR;
4761 tests.status.status = status;
4762 tests.status.message = message;
4763 tests.status.stack = stack;
4770 if (!tests.allow_uncaught_exception) {