| OLD | NEW |
| (Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 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. |
| 5 |
| 6 import pyauto_functional |
| 7 import pyauto |
| 8 |
| 9 class GpuMemTest(pyauto.PyUITest): |
| 10 # Return the number of bytes of GPU memory being used |
| 11 def _getGpuMemUsage(self): |
| 12 gpuMemStats = self.GetGpuMemStats() |
| 13 if gpuMemStats['gpu_active'] == False: |
| 14 self.fail(msg='GPU process not active.') |
| 15 return gpuMemStats['gpu_memory_bytes_used'] |
| 16 |
| 17 def testSanity(self): |
| 18 """Report GPU memory usage when test page with 3D CSS is open.""" |
| 19 url_3dcss = self.GetFileURLForDataPath('gpu/mem_3dcss.html') |
| 20 self.NavigateToURL(url_3dcss, 0) |
| 21 print 'Using ', self._getGpuMemUsage(), ' bytes of GPU memory' |
| 22 |
| 23 def testOverSubscribe(self): |
| 24 """Over-subscribe GPU memory.""" |
| 25 url_3dcss = self.GetFileURLForDataPath('gpu/mem_3dcss.html') |
| 26 # Let tabs_to_open be the number of instances of mem_3dcss.html that |
| 27 # will oversubscribe all available GPU memory by a factor of 4 |
| 28 # TODO - compute this reliably -- this is a wild guess |
| 29 tabs_to_open = 2 |
| 30 # Record memory usage statistics as each new tab is opened |
| 31 for i in xrange(tabs_to_open): |
| 32 self.AppendTab(url_3dcss, windex=0) |
| 33 # TODO - verify that we never exceeded the GPU memory budget |
| 34 # TODO - verify that we actually used 'most' of the GPU memory (say, |
| 35 # half of it), and that the GPU memory manager did kick |
| 36 # around some resources |
| 37 print 'Using ', self._getGpuMemUsage(), ' bytes of GPU memory' |
| 38 |
| 39 if __name__ == '__main__': |
| 40 pyauto_functional.Main() |
| OLD | NEW |