Bug 708927 - enable events/test_focus_menu.xul partially, add more logging capabilities, r=tbsaunde

This commit is contained in:
Alexander Surkov 2012-10-05 22:00:28 +09:00
Родитель 2d2237893c
Коммит a324e51448
4 изменённых файлов: 62 добавлений и 21 удалений

Просмотреть файл

@ -695,11 +695,40 @@ logging::AccessibleNNode(const char* aDescr, Accessible* aAccessible)
static_cast<void*>(aAccessible->Document()), static_cast<void*>(aAccessible->Document()),
static_cast<void*>(aAccessible->GetDocumentNode())); static_cast<void*>(aAccessible->GetDocumentNode()));
printf(" Document"); printf(" Document ");
LogDocURI(static_cast<nsIDocument*>(aAccessible->GetDocumentNode())); LogDocURI(static_cast<nsIDocument*>(aAccessible->GetDocumentNode()));
printf("\n"); printf("\n");
} }
void
logging::AccessibleNNode(const char* aDescr, nsINode* aNode)
{
DocAccessible* document =
GetAccService()->GetDocAccessible(aNode->OwnerDoc());
if (document) {
Accessible* accessible = document->GetAccessible(aNode);
if (accessible) {
AccessibleNNode(aDescr, accessible);
return;
}
}
nsAutoCString nodeDescr("Not accessible ");
nodeDescr.Append(aDescr);
Node(nodeDescr.get(), aNode);
}
void
logging::DOMEvent(const char* aDescr, nsINode* aOrigTarget,
const nsAString& aEventType)
{
logging::MsgBegin("DOMEvents", "event '%s' %s",
NS_ConvertUTF16toUTF8(aEventType).get(), aDescr);
logging::AccessibleNNode("Target", aOrigTarget);
logging::MsgEnd();
}
void void
logging::Stack() logging::Stack()
{ {

Просмотреть файл

@ -153,6 +153,13 @@ void Node(const char* aDescr, nsINode* aNode);
* Log the accessible and its DOM node as a message entry. * Log the accessible and its DOM node as a message entry.
*/ */
void AccessibleNNode(const char* aDescr, Accessible* aAccessible); void AccessibleNNode(const char* aDescr, Accessible* aAccessible);
void AccessibleNNode(const char* aDescr, nsINode* aNode);
/**
* Log the DOM event.
*/
void DOMEvent(const char* aDescr, nsINode* aOrigTarget,
const nsAString& aEventType);
/** /**
* Log the call stack, two spaces offset is used. * Log the call stack, two spaces offset is used.

Просмотреть файл

@ -258,22 +258,18 @@ RootAccessible::HandleEvent(nsIDOMEvent* aDOMEvent)
if (!origTargetNode) if (!origTargetNode)
return NS_OK; return NS_OK;
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eDOMEvents)) {
nsAutoString eventType;
aDOMEvent->GetType(eventType);
logging::DOMEvent("handled", origTargetNode, eventType);
}
#endif
DocAccessible* document = DocAccessible* document =
GetAccService()->GetDocAccessible(origTargetNode->OwnerDoc()); GetAccService()->GetDocAccessible(origTargetNode->OwnerDoc());
if (document) { if (document) {
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eDOMEvents)) {
nsAutoString eventType;
aDOMEvent->GetType(eventType);
logging::MsgBegin("DOMEvents", "event '%s' handled",
NS_ConvertUTF16toUTF8(eventType).get());
logging::Node("target", origTargetNode);
logging::MsgEnd();
}
#endif
// Root accessible exists longer than any of its descendant documents so // Root accessible exists longer than any of its descendant documents so
// that we are guaranteed notification is processed before root accessible // that we are guaranteed notification is processed before root accessible
// is destroyed. // is destroyed.
@ -296,6 +292,11 @@ RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
nsAutoString eventType; nsAutoString eventType;
aDOMEvent->GetType(eventType); aDOMEvent->GetType(eventType);
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eDOMEvents))
logging::DOMEvent("processed", origTargetNode, eventType);
#endif
if (eventType.EqualsLiteral("popuphiding")) { if (eventType.EqualsLiteral("popuphiding")) {
HandlePopupHidingEvent(origTargetNode); HandlePopupHidingEvent(origTargetNode);
return; return;

Просмотреть файл

@ -21,19 +21,11 @@
src="../events.js" /> src="../events.js" />
<script type="application/javascript"> <script type="application/javascript">
//gA11yEventDumpID = "eventdump"; // debug stuff
//gA11yEventDumpToConsole = true; // debug stuff //gA11yEventDumpToConsole = true; // debug stuff
var gQueue = null; var gQueue = null;
function doTests() function doTests()
{ {
// bug 708927 - test times out on Linux
if (LINUX) {
todo(false, "Reenable on Linux after fixing bug 708927!");
SimpleTest.finish();
return;
}
// Test focus events. // Test focus events.
gQueue = new eventQueue(); gQueue = new eventQueue();
@ -67,6 +59,13 @@
gQueue.push(new synthClick("vehicle", new focusChecker("vehicle"))); gQueue.push(new synthClick("vehicle", new focusChecker("vehicle")));
gQueue.push(new synthMouseMove("cycle", new focusChecker("cycle"))); gQueue.push(new synthMouseMove("cycle", new focusChecker("cycle")));
// XXXbug708927 - test times out on Linux, see more info at
// https://bugzilla.mozilla.org/show_bug.cgi?id=708927#c360. If needed
// then enable logging below.
if (LINUX) {
todo(false, "Reenable on Linux after fixing bug 708927!");
} else {
// open submenu // open submenu
gQueue.push(new synthRightKey("cycle", new focusChecker("tricycle"))); gQueue.push(new synthRightKey("cycle", new focusChecker("tricycle")));
@ -78,6 +77,11 @@
// click menuitem to close menu, focus gets back to document // click menuitem to close menu, focus gets back to document
gQueue.push(new synthClick("tricycle", new focusChecker(document))); gQueue.push(new synthClick("tricycle", new focusChecker(document)));
}
//enableLogging("focus,DOMEvents,tree"); // logging for bug708927
//gQueue.onFinish = function() { disableLogging(); }
gQueue.invoke(); // Will call SimpleTest.finish(); gQueue.invoke(); // Will call SimpleTest.finish();
} }