Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: tools/accessibility/dump_accessibility_tree_auralinux.py

Issue 1016743002: Adding helper function to check for correct application name (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding helper Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Dump Chrome's ATK accessibility tree to the command line. 6 """Dump Chrome's ATK accessibility tree to the command line.
7 7
8 Accerciser is slow and buggy. This is a quick way to check that Chrome is 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. 9 exposing its interface to ATK from the command line.
10 """ 10 """
11 11
12 import pyatspi 12 import pyatspi
13 13
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
21
14 def Dump(obj, indent): 22 def Dump(obj, indent):
15 if not obj: 23 if not obj:
16 return 24 return
17 indent_str = ' ' * indent 25 indent_str = ' ' * indent
18 role = obj.get_role_name() 26 role = obj.get_role_name()
19 name = obj.get_name() 27 name = obj.get_name()
20 print '%s%s name="%s"' % (indent_str, role, name) 28 print '%s%s name="%s"' % (indent_str, role, name)
21 29
22 # Don't recurse into applications other than Chrome 30 # Don't recurse into applications other than Chrome
23 if role == 'application': 31 if role == 'application':
24 if (name.lower().find('chrom') != 0 and 32 if (not AppNameFinder(name)):
25 name.lower().find('google chrome') != 0):
26 return 33 return
27 34
28 for i in range(obj.get_child_count()): 35 for i in range(obj.get_child_count()):
29 Dump(obj.get_child_at_index(i), indent + 1) 36 Dump(obj.get_child_at_index(i), indent + 1)
30 37
31 desktop = pyatspi.Registry.getDesktop(0) 38 desktop = pyatspi.Registry.getDesktop(0)
32 Dump(desktop, 0) 39 Dump(desktop, 0)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698