2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 """Dump Chrome's ATK accessibility tree to the command line.
8 Accerciser is slow and buggy. This is a quick way to check that Chrome is
9 exposing its interface to ATK from the command line.
14 # Helper function to check application name
15 def AppNameFinder(name
):
16 if (name
.lower().find('chromium') !=0 and
17 name
.lower().find('chrome') !=0 and
18 name
.lower().find('google chrome') != 0):
22 def Dump(obj
, indent
):
25 indent_str
= ' ' * indent
26 role
= obj
.get_role_name()
28 bounds
= obj
.get_extents(pyatspi
.DESKTOP_COORDS
)
29 bounds_str
= '(%d, %d) size (%d x %d)' % (
30 bounds
.x
, bounds
.y
, bounds
.width
, bounds
.height
)
31 print '%s%s name="%s" %s' % (indent_str
, role
, name
, bounds_str
)
33 # Don't recurse into applications other than Chrome
34 if role
== 'application':
35 if (not AppNameFinder(name
)):
38 for i
in range(obj
.get_child_count()):
39 Dump(obj
.get_child_at_index(i
), indent
+ 1)
41 desktop
= pyatspi
.Registry
.getDesktop(0)