|
42 | 42 | description("This tests that menu lists that are disabled will not be triggered by AXPress actions.");
|
43 | 43 |
|
44 | 44 | // We don't test for enabled controls because opening menu lists waits on the UI process to display the menu.
|
45 |
| - var numOfTests = 3, notificationCount = 0; |
| 45 | + var testCount = 3, testIndex = 0; |
46 | 46 | var lists = [null, null, null];
|
47 |
| - if (window.accessibilityController) { |
48 |
| - jsTestIsAsync = true; |
49 |
| - pressNext(0); |
50 |
| - } |
51 | 47 |
|
52 |
| - function pressNext(testId) { |
53 |
| - if (testId > numOfTests) |
| 48 | + function testNextList() { |
| 49 | + if (testIndex >= testCount) { |
| 50 | + finishJSTest(); |
54 | 51 | return;
|
55 |
| - var menulist = accessibilityController.accessibleElementById("test" + testId); |
| 52 | + } |
| 53 | + |
| 54 | + var menulist = accessibilityController.accessibleElementById("test" + testIndex); |
56 | 55 | menulist.addNotificationListener(pressListener);
|
57 | 56 | menulist.press();
|
58 |
| - lists[testId] = menulist; |
59 |
| - window.setTimeout(function() { |
60 |
| - pressNext(testId + 1); |
61 |
| - }, 0); |
| 57 | + lists[testIndex] = menulist; |
62 | 58 | }
|
63 | 59 |
|
64 | 60 | function pressListener(notification) {
|
65 |
| - if (notification == "AXPressDidFail" || notification == "AXPressDidSucceed") |
66 |
| - notificationCount++; |
| 61 | + lists[testIndex].removeNotificationListener(pressListener); |
67 | 62 |
|
68 | 63 | debug("Got notification: " + notification);
|
69 |
| - lists[notificationCount-1].removeNotificationListener(pressListener); |
70 |
| - if (notificationCount == numOfTests) { |
71 |
| - finishJSTest(); |
72 |
| - } |
| 64 | + |
| 65 | + testIndex++; |
| 66 | + testNextList(); |
| 67 | + } |
| 68 | + |
| 69 | + if (window.accessibilityController) { |
| 70 | + jsTestIsAsync = true; |
| 71 | + testNextList(); |
73 | 72 | }
|
74 | 73 | </script>
|
75 | 74 |
|
|
0 commit comments