Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / accessibility / other-aria-attribute-change-sends-notification.html
blobea53a1b1ebf2a9643c09d94464aa66f48c5c2ae9
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script src="../resources/js-test.js"></script>
5 </head>
6 <body>
8 <div id="container">
9 <button id="aria-busy" aria-busy="false">Busy</button>
10 <button id="aria-disabled" aria-disabled="false">Disabled</button>
11 <button id="aria-readonly" aria-readonly="false">Readonly</button>
12 <button id="aria-required" aria-required="false">Required</button>
13 </div>
15 <div id="console"></div>
16 <script>
17 description("This test ensures that a change to any ARIA attribute, not just a state, sends a notification.");
18 window.jsTestIsAsync = true;
20 if (window.testRunner && window.accessibilityController) {
21 testRunner.dumpAsText();
23 function accessibleElementById(id) {
24 return accessibilityController.accessibleElementById(id);
27 window.successCount = 0;
28 function gotSuccessfulNotification() {
29 successCount++;
30 if (successCount != 4)
31 return;
33 debug('All notifications received successfully.');
34 accessibleElementById('aria-busy').removeNotificationListener();
35 accessibleElementById('aria-disabled').removeNotificationListener();
36 accessibleElementById('aria-readonly').removeNotificationListener();
37 accessibleElementById('aria-required').removeNotificationListener();
39 document.getElementById('container').hidden = true;
40 finishJSTest();
43 accessibleElementById('aria-busy').addNotificationListener(function(notification) {
44 debug('Got ' + notification + ' notification on aria-busy');
45 gotSuccessfulNotification();
46 });
47 document.getElementById('aria-busy').setAttribute('aria-busy', 'true');
49 accessibleElementById('aria-disabled').addNotificationListener(function(notification) {
50 debug('Got ' + notification + ' notification on aria-disabled');
51 gotSuccessfulNotification();
52 });
53 document.getElementById('aria-disabled').setAttribute('aria-disabled', 'true');
55 accessibleElementById('aria-readonly').addNotificationListener(function(notification) {
56 debug('Got ' + notification + ' notification on aria-readonly');
57 gotSuccessfulNotification();
58 });
59 document.getElementById('aria-readonly').setAttribute('aria-readonly', 'true');
61 accessibleElementById('aria-required').addNotificationListener(function(notification) {
62 debug('Got ' + notification + ' notification on aria-required');
63 gotSuccessfulNotification();
64 });
65 document.getElementById('aria-required').setAttribute('aria-required', 'true');
67 debug('');
70 </script>
72 </body>
73 </html>