From ef413cad1e7daa23b6b52062066462d4e76f2374 Mon Sep 17 00:00:00 2001 From: "nirnimesh@chromium.org" Date: Tue, 25 May 2010 21:09:14 +0000 Subject: Fetch a bunch of info from the browser This includes info about the browser/renderer/extension/other PIDs, window size. Add a method to set window size. Add tests to verify window size, and verify flash loading. BUG=43234 TEST=python chrome/test/functional/browser.py Review URL: http://codereview.chromium.org/2133013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48192 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/test/functional/PYAUTO_TESTS | 1 + chrome/test/functional/browser.py | 35 ++++++++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) (limited to 'chrome/test/functional') diff --git a/chrome/test/functional/PYAUTO_TESTS b/chrome/test/functional/PYAUTO_TESTS index a0c80c0..656f2b99 100644 --- a/chrome/test/functional/PYAUTO_TESTS +++ b/chrome/test/functional/PYAUTO_TESTS @@ -44,6 +44,7 @@ 'linux': [ '-omnibox', # http://crbug.com/44203 + '-browser.BrowserTest.testWindowResize', # crbug.com/44963 ], # TODO(nirnimesh): Add a ChromeOS section diff --git a/chrome/test/functional/browser.py b/chrome/test/functional/browser.py index 7d2b08b..05aea1e 100644 --- a/chrome/test/functional/browser.py +++ b/chrome/test/functional/browser.py @@ -3,6 +3,7 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import os import re import pyauto_functional # Must be imported before pyauto @@ -21,14 +22,38 @@ class BrowserTest(pyauto.PyUITest): pp = pprint.PrettyPrinter(indent=2) while True: raw_input('Hit to dump info.. ') - properties = self.GetBrowserInfo() - self.assertTrue(properties) - pp.pprint(properties) + info = self.GetBrowserInfo() + pp.pprint(info) def testGotVersion(self): """Verify there's a valid version string.""" - version_string = self.GetBrowserInfo()['ChromeVersion'] - self.assertTrue(re.match("\d+\.\d+\.\d+.\.\d+", version_string)) + version_string = self.GetBrowserInfo()['properties']['ChromeVersion'] + self.assertTrue(re.match('\d+\.\d+\.\d+.\.\d+', version_string)) + + def testWindowResize(self): + """Verify window resizing and persistence after restart.""" + def _VerifySize(x, y, width, height): + info = self.GetBrowserInfo() + self.assertEqual(x, info['windows'][0]['x']) + self.assertEqual(y, info['windows'][0]['y']) + self.assertEqual(width, info['windows'][0]['width']) + self.assertEqual(height, info['windows'][0]['height']) + self.SetWindowDimensions(x=20, y=40, width=600, height=300) + _VerifySize(20, 40, 600, 300) + self.RestartBrowser(clear_profile=False) + _VerifySize(20, 40, 600, 300) + + def testCanLoadFlash(self): + """Verify that we can play Flash. + + We merely check that the flash process kicks in. + """ + flash_url = self.GetFileURLForPath(os.path.join(self.DataDir(), + 'plugin', 'flash.swf')) + self.NavigateToURL(flash_url) + child_processes = self.GetBrowserInfo()['child_processes'] + self.assertTrue([x for x in child_processes + if x['type'] == 'Plug-in' and x['name'] == 'Shockwave Flash']) if __name__ == '__main__': -- cgit v1.1