summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-15 00:26:17 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-15 00:26:17 +0000
commit23d50ceba2892577f8fa7bcedbe27ad0de4c0c93 (patch)
treef47c2944f377e268e2ee0b7680a14f864ec6ac59 /chrome/test
parentb3d0081c321dca05923461169747ae371be7be8f (diff)
downloadchromium_src-23d50ceba2892577f8fa7bcedbe27ad0de4c0c93.zip
chromium_src-23d50ceba2892577f8fa7bcedbe27ad0de4c0c93.tar.gz
chromium_src-23d50ceba2892577f8fa7bcedbe27ad0de4c0c93.tar.bz2
Fix pyauto gpu tests by waiting for gpu features to load and by
restarting the browser instead of killing the gpu process. BUG=94682,93423,92446 TEST=none Review URL: http://codereview.chromium.org/8297008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105620 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/functional/PYAUTO_TESTS6
-rw-r--r--chrome/test/functional/gpu.py75
2 files changed, 44 insertions, 37 deletions
diff --git a/chrome/test/functional/PYAUTO_TESTS b/chrome/test/functional/PYAUTO_TESTS
index 58f4d20..aeb25f2 100644
--- a/chrome/test/functional/PYAUTO_TESTS
+++ b/chrome/test/functional/PYAUTO_TESTS
@@ -135,10 +135,6 @@
# when downloading the small zip file.
# crbug.com/91225
'-find_in_page.FindMatchTests.testSearchInPDF',
- # crbug.com/94682
- '-gpu.GpuTest.test2dCanvas',
- # crbug.com/93423
- '-gpu.GpuTest.test3dCss',
# Disabled on vista in the actual test. crbug.com/89767
# -imports.ImportsTest.testImportFirefoxDataTwice
# Disabled on vista in the actual test. crbug.com/89767
@@ -458,8 +454,6 @@
'win': [
'enterprise',
'gpu',
- # crbug.com/92446
- '-gpu.GpuTest.testGpuWithVideo',
# Preloaded extensions affect process count: crbug.com/94350
'-process_count',
diff --git a/chrome/test/functional/gpu.py b/chrome/test/functional/gpu.py
index 5b04dc4..e0b7d68 100644
--- a/chrome/test/functional/gpu.py
+++ b/chrome/test/functional/gpu.py
@@ -24,13 +24,26 @@ class GpuTest(pyauto.PyUITest):
def _IsHardwareAccelerated(self, feature):
"""Check if gpu is enabled in the machine before running any tests."""
self.NavigateToURL('about:gpu')
+ def IsFeatureStatusLoaded():
+ """Returns whether the feature status UI has been loaded.
+
+ The about:gpu page fetches status for features asynchronously, so use
+ this to check if the fetch is done.
+ """
+ js = """
+ var list = document.querySelector(".feature-status-list");
+ domAutomationController.send(list.hasChildNodes() ? "done" : "");
+ """
+ return self.ExecuteJavascript(js)
+ self.assertTrue(self.WaitUntil(IsFeatureStatusLoaded, 10))
search = feature + ': Hardware accelerated'
find_result = self.FindInPage(search)['match_count']
if find_result:
- # about:gpu page starts a gpu process.
- # Make sure to kill the GPU process after navigating to about:gpu page
- pid = self._GetGpuPID()
- self.Kill(pid)
+ # about:gpu page starts a gpu process. Restart the browser to clear
+ # the state. We could kill the gpu process, but navigating to a page
+ # after killing the gpu can lead to flakiness.
+ # See crbug.com/93423.
+ self.RestartBrowser()
return True
else:
logging.warn('Hardware acceleration not available')
@@ -49,48 +62,48 @@ class GpuTest(pyauto.PyUITest):
def test2dCanvas(self):
"""Verify that gpu process is spawned when viewing a 2D canvas."""
- if self._IsHardwareAccelerated('Canvas'):
- self._VerifyGPUProcessOnPage('CanvasDemo.html')
+ self.assertTrue(self._IsHardwareAccelerated('Canvas'))
+ self._VerifyGPUProcessOnPage('CanvasDemo.html')
def test3dCss(self):
"""Verify that gpu process is spawned when viewing a 3D CSS page."""
- if self._IsHardwareAccelerated('3D CSS'):
- self._VerifyGPUProcessOnPage('3dCss.html')
+ self.assertTrue(self._IsHardwareAccelerated('3D CSS'))
+ self._VerifyGPUProcessOnPage('3dCss.html')
def testCompositing(self):
"""Verify gpu process in compositing example."""
- if self._IsHardwareAccelerated('Compositing'):
- self._VerifyGPUProcessOnPage('WebGLTeapot.html')
+ self.assertTrue(self._IsHardwareAccelerated('Compositing'))
+ self._VerifyGPUProcessOnPage('WebGLTeapot.html')
def testWebGL(self):
"""Verify that gpu process is spawned in webgl example."""
- if self._IsHardwareAccelerated('WebGL'):
- self._VerifyGPUProcessOnPage('WebGLField.html')
+ self.assertTrue(self._IsHardwareAccelerated('WebGL'))
+ self._VerifyGPUProcessOnPage('WebGLField.html')
def testGpuWithVideo(self):
"""Verify that gpu process is started when viewing video."""
- if self._IsHardwareAccelerated('WebGL'):
- self._VerifyGPUProcessOnPage('color2.ogv')
+ self.assertTrue(self._IsHardwareAccelerated('WebGL'))
+ self._VerifyGPUProcessOnPage('color2.ogv')
def testSingleGpuProcess(self):
"""Verify there's only one gpu process shared across all uses."""
- if self._IsHardwareAccelerated('WebGL'):
- url = self.GetFileURLForDataPath('pyauto_private',
- 'gpu', 'WebGLField.html')
- self.AppendTab(pyauto.GURL(url))
- # Open a new window.
- self.OpenNewBrowserWindow(True)
- self.NavigateToURL(url, 1, 0)
- # Open a new incognito window.
- self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW)
- self.NavigateToURL(url, 1, 0)
- # Verify there's only 1 gpu process.
- gpu_process_count = 0
- for x in self.GetBrowserInfo()['child_processes']:
- if x['type'] == 'GPU':
- gpu_process_count += 1
- self.assertEqual(1, gpu_process_count)
+ self.assertTrue(self._IsHardwareAccelerated('WebGL'))
+ url = self.GetFileURLForDataPath('pyauto_private',
+ 'gpu', 'WebGLField.html')
+ self.AppendTab(pyauto.GURL(url))
+ # Open a new window.
+ self.OpenNewBrowserWindow(True)
+ self.NavigateToURL(url, 1, 0)
+ # Open a new incognito window.
+ self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW)
+ self.NavigateToURL(url, 1, 0)
+ # Verify there's only 1 gpu process.
+ gpu_process_count = 0
+ for x in self.GetBrowserInfo()['child_processes']:
+ if x['type'] == 'GPU':
+ gpu_process_count += 1
+ self.assertEqual(1, gpu_process_count)
if __name__ == '__main__':
- pyauto_functional.Main() \ No newline at end of file
+ pyauto_functional.Main()