| Index: chrome/test/functional/gpu_mem.py
|
| diff --git a/chrome/test/functional/gpu_mem.py b/chrome/test/functional/gpu_mem.py
|
| new file mode 100755
|
| index 0000000000000000000000000000000000000000..09fdbbb1a2c0a90576d2fc8d3cdb90766bed96a2
|
| --- /dev/null
|
| +++ b/chrome/test/functional/gpu_mem.py
|
| @@ -0,0 +1,40 @@
|
| +#!/usr/bin/env python
|
| +# Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +import pyauto_functional
|
| +import pyauto
|
| +
|
| +class GpuMemTest(pyauto.PyUITest):
|
| + # Return the number of bytes of GPU memory being used
|
| + def _getGpuMemUsage(self):
|
| + gpuMemStats = self.GetGpuMemStats()
|
| + if gpuMemStats['gpu_active'] == False:
|
| + self.fail(msg='GPU process not active.')
|
| + return gpuMemStats['gpu_memory_bytes_used']
|
| +
|
| + def testSanity(self):
|
| + """Report GPU memory usage when test page with 3D CSS is open."""
|
| + url_3dcss = self.GetFileURLForDataPath('gpu/mem_3dcss.html')
|
| + self.NavigateToURL(url_3dcss, 0)
|
| + print 'Using ', self._getGpuMemUsage(), ' bytes of GPU memory'
|
| +
|
| + def testOverSubscribe(self):
|
| + """Over-subscribe GPU memory."""
|
| + url_3dcss = self.GetFileURLForDataPath('gpu/mem_3dcss.html')
|
| + # Let tabs_to_open be the number of instances of mem_3dcss.html that
|
| + # will oversubscribe all available GPU memory by a factor of 4
|
| + # TODO - compute this reliably -- this is a wild guess
|
| + tabs_to_open = 2
|
| + # Record memory usage statistics as each new tab is opened
|
| + for i in xrange(tabs_to_open):
|
| + self.AppendTab(url_3dcss, windex=0)
|
| + # TODO - verify that we never exceeded the GPU memory budget
|
| + # TODO - verify that we actually used 'most' of the GPU memory (say,
|
| + # half of it), and that the GPU memory manager did kick
|
| + # around some resources
|
| + print 'Using ', self._getGpuMemUsage(), ' bytes of GPU memory'
|
| +
|
| +if __name__ == '__main__':
|
| + pyauto_functional.Main()
|
|
|