forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 2
/
testTextboxes.js
46 lines (40 loc) · 1.41 KB
/
testTextboxes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function testValue(aID, aAcc, aValue, aRole)
{
if (aRole == ROLE_PASSWORD_TEXT) {
var value;
try {
value = aAcc.value;
do_throw("We do not want a value on " + aID + "!");
} catch(e) {
is(e.result, Components.results.NS_ERROR_FAILURE,
"Wrong return value for getValue on " + aID + "!");
}
} else
is(aAcc.value, aValue, "Wrong value for " + aID + "!");
}
function testAction(aID, aAcc, aNumActions, aActionName, aActionDescription)
{
var numActions = aAcc.numActions;
is(numActions, aNumActions, "Wrong number of actions for " + aID + "!");
if (numActions != 0) {
// Test first action. Normally only 1 should be present.
is(aAcc.getActionName(0), aActionName,
"Wrong name of action for " + aID + "!");
is(aAcc.getActionDescription(0), aActionDescription,
"Wrong description of action for " + aID + "!");
}
}
function testThis(aID, aName, aValue, aDescription, aRole, aState,
aExtraState, aAbsentState, aNumActions, aActionName,
aActionDescription)
{
var acc = getAccessible(aID);
if (!acc)
return;
is(acc.name, aName, "Wrong name for " + aID + "!");
testValue(aID, acc, aValue, aRole);
is(acc.description, aDescription, "Wrong description for " + aID + "!");
testRole(aID, aRole);
testStates(acc, aState, aExtraState, aAbsentState);
testAction(aID, acc, aNumActions, aActionName, aActionDescription);
}