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

Side by Side Diff: chrome/test/pyautolib/pyauto.py

Issue 7108025: Add PyAuto automation call GetPanelInfo(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment. Created 9 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | 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/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """PyAuto: Python Interface to Chromium's Automation Proxy. 7 """PyAuto: Python Interface to Chromium's Automation Proxy.
8 8
9 PyAuto uses swig to expose Automation Proxy interfaces to Python. 9 PyAuto uses swig to expose Automation Proxy interfaces to Python.
10 For complete documentation on the functionality available, 10 For complete documentation on the functionality available,
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 u'infobars': [ { 1183 u'infobars': [ {
1184 u'buttons': [u'Allow', u'Deny'], 1184 u'buttons': [u'Allow', u'Deny'],
1185 u'link_text': u'Learn more', 1185 u'link_text': u'Learn more',
1186 u'text': u'slides.html5rocks.com wants to track ' 1186 u'text': u'slides.html5rocks.com wants to track '
1187 'your physical location', 1187 'your physical location',
1188 u'type': u'confirm_infobar'}], 1188 u'type': u'confirm_infobar'}],
1189 u'pinned': False, 1189 u'pinned': False,
1190 u'renderer_pid': 93929, 1190 u'renderer_pid': 93929,
1191 u'url': u'http://slides.html5rocks.com/#slide14'}, 1191 u'url': u'http://slides.html5rocks.com/#slide14'},
1192 ], 1192 ],
1193 u'type': u'tabbed',
1193 u'width': 925, 1194 u'width': 925,
1194 u'x': 26, 1195 u'x': 26,
1195 u'y': 44}]} 1196 u'y': 44}]}
1196 1197
1197 Raises: 1198 Raises:
1198 pyauto_errors.JSONInterfaceError if the automation call returns an error. 1199 pyauto_errors.JSONInterfaceError if the automation call returns an error.
1199 """ 1200 """
1200 cmd_dict = { # Prepare command for the json interface 1201 cmd_dict = { # Prepare command for the json interface
1201 'command': 'GetBrowserInfo', 1202 'command': 'GetBrowserInfo',
1202 } 1203 }
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
2911 u'battery_time_to_empty': 29617, 2912 u'battery_time_to_empty': 29617,
2912 u'battery_percentage': 100.0, 2913 u'battery_percentage': 100.0,
2913 u'battery_fully_charged': False } 2914 u'battery_fully_charged': False }
2914 2915
2915 Raises: 2916 Raises:
2916 pyauto_errors.JSONInterfaceError if the automation call returns an error. 2917 pyauto_errors.JSONInterfaceError if the automation call returns an error.
2917 """ 2918 """
2918 cmd_dict = { 'command': 'GetBatteryInfo' } 2919 cmd_dict = { 'command': 'GetBatteryInfo' }
2919 return self._GetResultFromJSONRequest(cmd_dict, windex=-1) 2920 return self._GetResultFromJSONRequest(cmd_dict, windex=-1)
2920 2921
2922 def GetPanelInfo(self):
2923 """Get details about open ChromeOS panels.
2924
2925 A panel is actually a type of browser window, so all of
2926 this information is also available using GetBrowserInfo().
2927
2928 Returns:
2929 A dictionary.
2930 Sample:
2931 [{ 'incognito': False,
2932 'renderer_pid': 4820,
2933 'title': u'Downloads',
2934 'url': u'chrome://active-downloads/'}]
2935
2936 Raises:
2937 pyauto_errors.JSONInterfaceError if the automation call returns an error.
2938 """
2939 panels = []
2940 for browser in self.GetBrowserInfo()['windows']:
2941 if browser['type'] != 'panel':
2942 continue
2943
2944 panel = {}
2945 panels.append(panel)
2946 tab = browser['tabs'][0]
2947 panel['incognito'] = browser['incognito']
2948 panel['renderer_pid'] = tab['renderer_pid']
2949 panel['title'] = self.GetActiveTabTitle(browser['index'])
2950 panel['url'] = tab['url']
2951
2952 return panels
2953
2921 def GetNetworkInfo(self): 2954 def GetNetworkInfo(self):
2922 """Get details about ethernet, wifi, and cellular networks on chromeos. 2955 """Get details about ethernet, wifi, and cellular networks on chromeos.
2923 2956
2924 Returns: 2957 Returns:
2925 A dictionary. 2958 A dictionary.
2926 Sample: 2959 Sample:
2927 { u'connected_ethernet': u'/profile/default/ethernet_abcd', 2960 { u'connected_ethernet': u'/profile/default/ethernet_abcd',
2928 u'connected_wifi': u'/profile/default/wifi_abcd_1234_managed_none', 2961 u'connected_wifi': u'/profile/default/wifi_abcd_1234_managed_none',
2929 u'ethernet_networks': 2962 u'ethernet_networks':
2930 { u'/profile/default/ethernet_abcd': 2963 { u'/profile/default/ethernet_abcd':
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
3624 if self._options.verbose: 3657 if self._options.verbose:
3625 verbosity = 2 3658 verbosity = 2
3626 result = PyAutoTextTestRuner(verbosity=verbosity).run(pyauto_suite) 3659 result = PyAutoTextTestRuner(verbosity=verbosity).run(pyauto_suite)
3627 del loaded_tests # Need to destroy test cases before the suite 3660 del loaded_tests # Need to destroy test cases before the suite
3628 del pyauto_suite 3661 del pyauto_suite
3629 sys.exit(not result.wasSuccessful()) 3662 sys.exit(not result.wasSuccessful())
3630 3663
3631 3664
3632 if __name__ == '__main__': 3665 if __name__ == '__main__':
3633 Main() 3666 Main()
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698