Chromium Code Reviews| 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): |
|
nduca
2012/07/17 22:40:25
In general, prefer test name that tell someone who
|
| + """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' |
|
nduca
2012/07/17 22:40:25
I think the intent of this is that it consumes a l
|
| + |
| + 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 |
|
nduca
2012/07/17 22:40:25
Hmmm so how are you going to compute this? Doesn't
|
| + 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 |
|
nduca
2012/07/17 22:40:25
How?
|
| + # 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 |
|
nduca
2012/07/17 22:40:25
Maybe using a fixed amount of memory is good here
|
| + print 'Using ', self._getGpuMemUsage(), ' bytes of GPU memory' |
|
nduca
2012/07/17 22:40:25
Should we have a test that verifies that we get a
mmocny
2012/07/18 15:20:18
GpuMemoryManager will have unittests here, but tho
|
| + |
| +if __name__ == '__main__': |
| + pyauto_functional.Main() |