tenfourfox/dom/inputport/test/xpcshell/test_inputport_data.js
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00

62 lines
1.4 KiB
JavaScript

"use strict";
var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
function run_test() {
run_next_test();
}
add_test(function test_valid_inputport_id() {
var inputportId = "inputportId";
var data = Cc["@mozilla.org/inputport/inputportdata;1"].
createInstance(Ci.nsIInputPortData);
data.id = inputportId;
equal(data.id, inputportId);
run_next_test();
});
add_test(function test_empty_inputport_id() {
var data = Cc["@mozilla.org/inputport/inputportdata;1"].
createInstance(Ci.nsIInputPortData);
Assert.throws(function() {
data.id = "";
}, /NS_ERROR_ILLEGAL_VALUE/i);
run_next_test();
});
add_test(function test_valid_type() {
var inputportType = "hdmi";
var data = Cc["@mozilla.org/inputport/inputportdata;1"].
createInstance(Ci.nsIInputPortData);
data.type = inputportType;
equal(data.type, inputportType);
run_next_test();
});
add_test(function test_empty_type() {
var data = Cc["@mozilla.org/inputport/inputportdata;1"].
createInstance(Ci.nsIInputPortData);
Assert.throws(function() {
data.type = "";
}, /NS_ERROR_ILLEGAL_VALUE/i);
run_next_test();
});
add_test(function test_is_connected() {
var data = Cc["@mozilla.org/inputport/inputportdata;1"].
createInstance(Ci.nsIInputPortData);
data.connected = true;
ok(data.connected);
run_next_test();
});