Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / tools / accessibility / dump_accessibility_tree_auralinux.py
blob6ec7fdc69c18b2988ea08b549368b5426b18e749
1 #!/usr/bin/env python
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.
10 """
12 import pyatspi
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):
19 return False
20 return True
22 def Dump(obj, indent):
23 if not obj:
24 return
25 indent_str = ' ' * indent
26 role = obj.get_role_name()
27 name = obj.get_name()
28 print '%s%s name="%s"' % (indent_str, role, name)
30 # Don't recurse into applications other than Chrome
31 if role == 'application':
32 if (not AppNameFinder(name)):
33 return
35 for i in range(obj.get_child_count()):
36 Dump(obj.get_child_at_index(i), indent + 1)
38 desktop = pyatspi.Registry.getDesktop(0)
39 Dump(desktop, 0)