Skip to content
This repository was archived by the owner on Sep 19, 2018. It is now read-only.

Define setup_default_test_properties. #119

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions testharness.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,14 @@ policies and contribution forms [3].
test_environment.on_new_harness_properties(properties);
}

function setup_default_test_properties(properties)
{
if (typeof properties !== "object") {
throw new Error("Default test properties should be an object and it is " + typeof properties);
}
tests.default_test_properties = properties;
}

function done() {
if (tests.tests.length === 0) {
tests.set_file_is_test();
Expand Down Expand Up @@ -597,6 +605,7 @@ policies and contribution forms [3].
expose(promise_rejects, 'promise_rejects');
expose(generate_tests, 'generate_tests');
expose(setup, 'setup');
expose(setup_default_test_properties, 'setup_default_test_properties');
expose(done, 'done');
expose(on_event, 'on_event');

Expand Down Expand Up @@ -1228,6 +1237,12 @@ policies and contribution forms [3].
this.index = null;

this.properties = properties;
for (var attr in tests.default_test_properties) {
if (!(attr in this.properties)) {
this.properties[attr] = tests.default_test_properties[attr];
}
}

var timeout = properties.timeout ? properties.timeout : settings.test_timeout;
if (timeout !== null) {
this.timeout_length = timeout * tests.timeout_multiplier;
Expand Down Expand Up @@ -1604,6 +1619,7 @@ policies and contribution forms [3].
this.phase = this.phases.INITIAL;

this.properties = {};
this.default_test_properties = {};

this.wait_for_finish = false;
this.processing_callbacks = false;
Expand Down