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

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

Issue 10702200: PyAuto test for GPU memory consumption (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 """PyAuto: Python Interface to Chromium's Automation Proxy. 6 """PyAuto: Python Interface to Chromium's Automation Proxy.
7 7
8 PyAuto uses swig to expose Automation Proxy interfaces to Python. 8 PyAuto uses swig to expose Automation Proxy interfaces to Python.
9 For complete documentation on the functionality available, 9 For complete documentation on the functionality available,
10 run pydoc on this file. 10 run pydoc on this file.
(...skipping 3812 matching lines...) Expand 10 before | Expand all | Expand 10 after
3823 { 'renderer_id': 23567, 3823 { 'renderer_id': 23567,
3824 'routing_id': 1, 3824 'routing_id': 1,
3825 'fps': 29.404298782348633 } 3825 'fps': 29.404298782348633 }
3826 """ 3826 """
3827 cmd_dict = { # Prepare command for the json interface. 3827 cmd_dict = { # Prepare command for the json interface.
3828 'command': 'GetFPS', 3828 'command': 'GetFPS',
3829 'tab_index': tab_index, 3829 'tab_index': tab_index,
3830 } 3830 }
3831 return self._GetResultFromJSONRequest(cmd_dict, windex=windex) 3831 return self._GetResultFromJSONRequest(cmd_dict, windex=windex)
3832 3832
3833 def GetGpuMemStats(self, windex=0):
3834 """Returns the current FPS associated with the renderer process for a tab.
3835
3836 FPS is the rendered frames per second.
3837
3838 Args:
3839 window_index: The window index, default is 0.
3840
3841 Returns:
3842 A dictionary containing GPU memory usage info.
3843 Example:
3844 { 'gpu_active': true,
3845 'gpu_memory_bytes_total': 1073741824,
3846 'gpu_memory_bytes_used': 16777216 }
3847 """
3848 cmd_dict = { # Prepare command for the json interface.
3849 'command': 'GetGpuMemStats',
3850 }
3851 return self._GetResultFromJSONRequest(cmd_dict, windex=windex)
3852
3833 def IsFullscreenForBrowser(self, windex=0): 3853 def IsFullscreenForBrowser(self, windex=0):
3834 """Returns true if the window is currently fullscreen and was initially 3854 """Returns true if the window is currently fullscreen and was initially
3835 transitioned to fullscreen by a browser (vs tab) mode transition.""" 3855 transitioned to fullscreen by a browser (vs tab) mode transition."""
3836 return self._GetResultFromJSONRequest( 3856 return self._GetResultFromJSONRequest(
3837 { 'command': 'IsFullscreenForBrowser' }, 3857 { 'command': 'IsFullscreenForBrowser' },
3838 windex=windex).get('result') 3858 windex=windex).get('result')
3839 3859
3840 def IsFullscreenForTab(self, windex=0): 3860 def IsFullscreenForTab(self, windex=0):
3841 """Returns true if fullscreen has been caused by a tab.""" 3861 """Returns true if fullscreen has been caused by a tab."""
3842 return self._GetResultFromJSONRequest( 3862 return self._GetResultFromJSONRequest(
(...skipping 2159 matching lines...) Expand 10 before | Expand all | Expand 10 after
6002 successful = result.wasSuccessful() 6022 successful = result.wasSuccessful()
6003 if not successful: 6023 if not successful:
6004 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) 6024 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename)
6005 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ 6025 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \
6006 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) 6026 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL)
6007 sys.exit(not successful) 6027 sys.exit(not successful)
6008 6028
6009 6029
6010 if __name__ == '__main__': 6030 if __name__ == '__main__':
6011 Main() 6031 Main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698