diff options
Diffstat (limited to 'testing/web-platform/tests/service-workers/service-worker/resources/interfaces.js')
-rw-r--r-- | testing/web-platform/tests/service-workers/service-worker/resources/interfaces.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/testing/web-platform/tests/service-workers/service-worker/resources/interfaces.js b/testing/web-platform/tests/service-workers/service-worker/resources/interfaces.js new file mode 100644 index 000000000..eb00df65f --- /dev/null +++ b/testing/web-platform/tests/service-workers/service-worker/resources/interfaces.js @@ -0,0 +1,15 @@ +function verify_interface(name, instance, attributes) { + assert_true(name in self, + name + ' should be an defined type'); + if (instance) { + assert_true(instance instanceof self[name], + instance + ' should be an instance of ' + name); + Object.keys(attributes || {}).forEach(function(attribute) { + var type = attributes[attribute]; + assert_true(attribute in instance, + attribute + ' should be an attribute of ' + name); + assert_equals(typeof instance[attribute], type, + attribute + ' should be of type ' + type); + }); + } +} |