1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/test_nsIAccessibleDocument.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,96 @@ 1.4 +<html> 1.5 +<!-- 1.6 +https://bugzilla.mozilla.org/show_bug.cgi?id=441737 1.7 +--> 1.8 +<head> 1.9 + <title>nsIAccessibleDocument chrome tests</title> 1.10 + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 1.11 + 1.12 + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.13 + 1.14 + <script type="application/javascript" 1.15 + src="common.js"></script> 1.16 + <script type="application/javascript" 1.17 + src="role.js"></script> 1.18 + <script type="application/javascript" 1.19 + src="states.js"></script> 1.20 + 1.21 + <script type="application/javascript" 1.22 + src="chrome://mochikit/content/chrome-harness.js"></script> 1.23 + 1.24 + <script type="application/javascript"> 1.25 + function doTest() 1.26 + { 1.27 + var docAcc = getAccessible(document, [nsIAccessibleDocument]); 1.28 + if (docAcc) { 1.29 + // nsIAccessible 1.30 + is(docAcc.name, "nsIAccessibleDocument chrome tests", 1.31 + "Name for document accessible not correct!"); 1.32 + 1.33 + testRole(docAcc, ROLE_DOCUMENT); 1.34 + 1.35 + // check if it is focusable, read-only. 1.36 + testStates(docAcc, (STATE_READONLY | STATE_FOCUSABLE)); 1.37 + 1.38 + // No actions wanted on doc 1.39 + is(docAcc.actionCount, 0, "Wrong number of actions for document!"); 1.40 + 1.41 + // attributes should contain tag:body 1.42 + attributes = docAcc.attributes; 1.43 + is(attributes.getStringProperty("tag"), "body", 1.44 + "Wrong attribute on document!"); 1.45 + 1.46 + // Document URL. 1.47 + var rootDir = getRootDirectory(window.location.href); 1.48 + is(docAcc.URL, rootDir + "test_nsIAccessibleDocument.html", 1.49 + "Wrong URL for document!"); 1.50 + 1.51 + // Document title and mime type. 1.52 + is(docAcc.title, "nsIAccessibleDocument chrome tests", 1.53 + "Wrong title for document!"); 1.54 + is(docAcc.mimeType, "text/html", 1.55 + "Wrong mime type for document!"); 1.56 + 1.57 + // DocAccessible::getDocType currently returns NS_ERROR_FAILURE. 1.58 + // See bug 442005. After fixing, please remove this comment and 1.59 + // uncomment the below two lines to enable the test. 1.60 +// is(docAcc.docType, "HTML", 1.61 +// "Wrong type of document!"); 1.62 + 1.63 + // Test for correct nsIDOMDocument retrieval. 1.64 + var domDoc = null; 1.65 + try { 1.66 + domDoc = docAcc.DOMDocument.QueryInterface(nsIDOMDocument); 1.67 + } catch(e) {} 1.68 + ok(domDoc, "no nsIDOMDocument for this doc accessible!"); 1.69 + is(domDoc, document, "Document nodes do not match!"); 1.70 + 1.71 + // Test for correct nsIDOMWindow retrieval. 1.72 + var domWindow = null; 1.73 + try { 1.74 + domWindow = docAcc.window.QueryInterface(nsIDOMWindow); 1.75 + } catch(e) {} 1.76 + ok(domWindow, "no nsIDOMWindow for this doc accessible!"); 1.77 + is(domWindow, window, "Window nodes do not match!"); 1.78 + } 1.79 + 1.80 + SimpleTest.finish(); 1.81 + } 1.82 + 1.83 + SimpleTest.waitForExplicitFinish(); 1.84 + addA11yLoadEvent(doTest); 1.85 + </script> 1.86 +</head> 1.87 +<body> 1.88 + 1.89 + <a target="_blank" 1.90 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=441737" 1.91 + title="nsAccessibleDocument chrome tests"> 1.92 + Mozilla Bug 441737 1.93 + </a> 1.94 + <p id="display"></p> 1.95 + <div id="content" style="display: none"></div> 1.96 + <pre id="test"> 1.97 + </pre> 1.98 +</body> 1.99 +</html>