summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authordennisjeffrey@chromium.org <dennisjeffrey@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-26 17:14:14 +0000
committerdennisjeffrey@chromium.org <dennisjeffrey@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-26 17:14:14 +0000
commit364d4fdc988b0706551acb574c1bdb1df800b6a1 (patch)
tree4a3afdad4d543f52bdeaa4584f77a31fea8a4d2d /chrome
parente988ffd3c55d2d4369b1625ab2ed6f3b9ce38877 (diff)
downloadchromium_src-364d4fdc988b0706551acb574c1bdb1df800b6a1.zip
chromium_src-364d4fdc988b0706551acb574c1bdb1df800b6a1.tar.gz
chromium_src-364d4fdc988b0706551acb574c1bdb1df800b6a1.tar.bz2
Refactor pyauto tests to use pprint() and pformat() from pyauto.py.
Also added a Debug() function to process_count.py. BUG=97663 TEST=None Review URL: http://codereview.chromium.org/8037007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102747 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/test/functional/autofill.py5
-rw-r--r--chrome/test/functional/browser.py5
-rw-r--r--chrome/test/functional/chromeos_security.py12
-rw-r--r--chrome/test/functional/enterprise.py8
-rw-r--r--chrome/test/functional/extensions.py5
-rw-r--r--chrome/test/functional/history.py5
-rw-r--r--chrome/test/functional/https.py5
-rw-r--r--chrome/test/functional/infobars.py4
-rw-r--r--chrome/test/functional/notifications.py6
-rw-r--r--chrome/test/functional/ntp.py4
-rw-r--r--chrome/test/functional/omnibox.py4
-rw-r--r--chrome/test/functional/passwords.py4
-rw-r--r--chrome/test/functional/plugins.py4
-rw-r--r--chrome/test/functional/plugins_check.py7
-rw-r--r--chrome/test/functional/popups.py4
-rw-r--r--chrome/test/functional/prefs.py20
-rw-r--r--chrome/test/functional/process_count.py9
-rw-r--r--chrome/test/functional/search_engines.py4
-rw-r--r--chrome/test/functional/themes.py4
-rw-r--r--chrome/test/functional/translate.py4
20 files changed, 44 insertions, 79 deletions
diff --git a/chrome/test/functional/autofill.py b/chrome/test/functional/autofill.py
index c47ff8c..ab321e5 100644
--- a/chrome/test/functional/autofill.py
+++ b/chrome/test/functional/autofill.py
@@ -23,12 +23,9 @@ class AutofillTest(pyauto.PyUITest):
This method will not run automatically.
"""
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
while True:
raw_input('Hit <enter> to dump info.. ')
- info = self.GetAutofillProfile()
- pp.pprint(info)
+ self.pprint(self.GetAutofillProfile())
def testFillProfile(self):
"""Test filling profiles and overwriting with new profiles."""
diff --git a/chrome/test/functional/browser.py b/chrome/test/functional/browser.py
index 255f664a..fadf5f450 100644
--- a/chrome/test/functional/browser.py
+++ b/chrome/test/functional/browser.py
@@ -20,12 +20,9 @@ class BrowserTest(pyauto.PyUITest):
This method will not run automatically.
"""
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
while True:
raw_input('Hit <enter> to dump info.. ')
- info = self.GetBrowserInfo()
- pp.pprint(info)
+ self.pprint(self.GetBrowserInfo())
def setUp(self):
pyauto.PyUITest.setUp(self)
diff --git a/chrome/test/functional/chromeos_security.py b/chrome/test/functional/chromeos_security.py
index acbb54f..40be9f6 100644
--- a/chrome/test/functional/chromeos_security.py
+++ b/chrome/test/functional/chromeos_security.py
@@ -4,7 +4,6 @@
# found in the LICENSE file.
import os
-import pprint
import pyauto_functional
import pyauto
@@ -17,7 +16,6 @@ class ChromeosSecurity(pyauto.PyUITest):
"""
def setUp(self):
pyauto.PyUITest.setUp(self)
- self.pp = pprint.PrettyPrinter(indent=2)
baseline_file = os.path.abspath(os.path.join(
pyauto.PyUITest.DataDir(), 'pyauto_private', 'chromeos',
'security', 'extension_permission_baseline.txt'))
@@ -83,8 +81,8 @@ class ChromeosSecurity(pyauto.PyUITest):
'\nActual extension info:\n%s' %
(perm_type, full_expected_info['name'],
_GetSetDifferenceMessage(expected_set, actual_set),
- self.pp.pformat(full_expected_info),
- self.pp.pformat(full_actual_info))))
+ self.pformat(full_expected_info),
+ self.pformat(full_actual_info))))
def _AssertExtensionNamesAreExpected(self, expected_set, actual_set,
ext_type, full_expected_info,
@@ -106,12 +104,12 @@ class ChromeosSecurity(pyauto.PyUITest):
strings.append('Missing item: "%s"' % missing_item)
located_ext_info = [info for info in full_expected_info if
info['name'] == missing_item][0]
- strings.append(self.pp.pformat(located_ext_info))
+ strings.append(self.pformat(located_ext_info))
for extra_item in actual_set.difference(expected_set):
strings.append('Unexpected (extra) item: "%s"' % extra_item)
located_ext_info = [info for info in full_actual_info if
info['name'] == extra_item][0]
- strings.append(self.pp.pformat(located_ext_info))
+ strings.append(self.pformat(located_ext_info))
return '\n'.join(strings)
self.assertEqual(
@@ -140,7 +138,7 @@ class ChromeosSecurity(pyauto.PyUITest):
located_ext_info,
msg=('Cannot locate extension info for "%s".\n'
'Expected extension info:\n%s' %
- (ext_expected_info['name'], self.pp.pformat(ext_expected_info))))
+ (ext_expected_info['name'], self.pformat(ext_expected_info))))
ext_actual_info = located_ext_info[0]
self._AssertPermissionSetIsExpected(
set(ext_expected_info['effective_host_permissions']),
diff --git a/chrome/test/functional/enterprise.py b/chrome/test/functional/enterprise.py
index 695d389..18f2f25 100644
--- a/chrome/test/functional/enterprise.py
+++ b/chrome/test/functional/enterprise.py
@@ -29,11 +29,9 @@ class EnterpriseTest(pyauto.PyUITest):
This method will not run automatically.
"""
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
while True:
raw_input('Interact with the browser and hit <enter> to dump prefs... ')
- pp.pprint(self.GetPrefsInfo().Prefs())
+ self.pprint(self.GetPrefsInfo().Prefs())
@staticmethod
def _Cleanup():
@@ -414,11 +412,9 @@ class EnterpriseTestReverse(pyauto.PyUITest):
This method will not run automatically.
"""
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
while True:
raw_input('Interact with the browser and hit <enter> to dump prefs... ')
- pp.pprint(self.GetPrefsInfo().Prefs())
+ self.pprint(self.GetPrefsInfo().Prefs())
@staticmethod
def _Cleanup():
diff --git a/chrome/test/functional/extensions.py b/chrome/test/functional/extensions.py
index 22a14be..c949a71 100644
--- a/chrome/test/functional/extensions.py
+++ b/chrome/test/functional/extensions.py
@@ -34,10 +34,7 @@ class ExtensionsTest(pyauto.PyUITest):
while True:
raw_input('Interact with the browser and hit <enter> to dump history.. ')
print '*' * 20
- extensions = self.GetExtensionsInfo()
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
- pp.pprint(extensions)
+ self.pprint(self.GetExtensionsInfo())
def _GetInstalledExtensionIds(self):
return [extension['id'] for extension in self.GetExtensionsInfo()]
diff --git a/chrome/test/functional/history.py b/chrome/test/functional/history.py
index d10c4f1..47c853e2 100644
--- a/chrome/test/functional/history.py
+++ b/chrome/test/functional/history.py
@@ -32,10 +32,7 @@ class HistoryTest(pyauto.PyUITest):
while True:
raw_input('Interact with the browser and hit <enter> to dump history.. ')
print '*' * 20
- history = self.GetHistoryInfo().History()
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
- pp.pprint(history)
+ self.pprint(self.GetHistoryInfo().History())
def testHistoryPersists(self):
"""Verify that history persists after session restart."""
diff --git a/chrome/test/functional/https.py b/chrome/test/functional/https.py
index a39eb4f..af6c910 100644
--- a/chrome/test/functional/https.py
+++ b/chrome/test/functional/https.py
@@ -17,12 +17,9 @@ class HTTPSTest(pyauto.PyUITest):
This method will not run automatically.
Use: python chrome/test/functional/ssl.py ssl.SSLTest.Debug
"""
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
while True:
raw_input('Hit <enter> to dump info.. ')
- info = self.GetNavigationInfo()
- pp.pprint(info)
+ self.pprint(self.GetNavigationInfo())
def testSSLPageBasic(self):
"""Verify the navigation state in an https page."""
diff --git a/chrome/test/functional/infobars.py b/chrome/test/functional/infobars.py
index 1f9f3ce..75b661b 100644
--- a/chrome/test/functional/infobars.py
+++ b/chrome/test/functional/infobars.py
@@ -22,15 +22,13 @@ class InfobarTest(pyauto.PyUITest):
To run:
python chrome/test/functional/infobars.py infobars.InfobarTest.Debug
"""
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
while True:
raw_input('Hit <enter> to dump info.. ')
info = self.GetBrowserInfo()
for window in info['windows']:
for tab in window['tabs']:
print 'Window', window['index'], 'tab', tab['index']
- pp.pprint(tab['infobars'])
+ self.pprint(tab['infobars'])
def setUp(self):
pyauto.PyUITest.setUp(self)
diff --git a/chrome/test/functional/notifications.py b/chrome/test/functional/notifications.py
index 78092a9..4fdc9499 100644
--- a/chrome/test/functional/notifications.py
+++ b/chrome/test/functional/notifications.py
@@ -33,10 +33,8 @@ class NotificationsTest(pyauto.PyUITest):
raw_input('Interact with the browser and hit <enter> to dump notification'
'state...')
print '*' * 20
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
- pp.pprint(self.GetActiveNotifications())
- pp.pprint(self._GetDefaultPermissionSetting())
+ self.pprint(self.GetActiveNotifications())
+ self.pprint(self._GetDefaultPermissionSetting())
def _SetDefaultPermissionSetting(self, setting):
"""Sets the default setting for whether sites are allowed to create
diff --git a/chrome/test/functional/ntp.py b/chrome/test/functional/ntp.py
index 2a3abee..841d96c 100644
--- a/chrome/test/functional/ntp.py
+++ b/chrome/test/functional/ntp.py
@@ -53,9 +53,7 @@ class NTPTest(pyauto.PyUITest):
while True:
raw_input('Interact with the browser and hit <enter> to dump NTP info...')
print '*' * 20
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
- pp.pprint(self._GetNTPInfo())
+ self.pprint(self._GetNTPInfo())
def __init__(self, methodName='runTest'):
super(NTPTest, self).__init__(methodName)
diff --git a/chrome/test/functional/omnibox.py b/chrome/test/functional/omnibox.py
index 388ff1f..e6c05ba 100644
--- a/chrome/test/functional/omnibox.py
+++ b/chrome/test/functional/omnibox.py
@@ -23,11 +23,9 @@ class OmniboxTest(pyauto.PyUITest):
This method will not run automatically.
"""
- import pprint
import time
- pp = pprint.PrettyPrinter(indent=2)
while True:
- pp.pprint(self.GetOmniboxInfo().omniboxdict)
+ self.pprint(self.GetOmniboxInfo().omniboxdict)
time.sleep(1)
def testFocusOnStartup(self):
diff --git a/chrome/test/functional/passwords.py b/chrome/test/functional/passwords.py
index 9bdf7aa..e8bd6b3 100644
--- a/chrome/test/functional/passwords.py
+++ b/chrome/test/functional/passwords.py
@@ -21,9 +21,7 @@ class PasswordTest(pyauto.PyUITest):
while True:
raw_input('Interact with the browser and hit <enter> to dump passwords. ')
print '*' * 20
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
- pp.pprint(self.GetSavedPasswords())
+ self.pprint(self.GetSavedPasswords())
def setUp(self):
pyauto.PyUITest.setUp(self)
diff --git a/chrome/test/functional/plugins.py b/chrome/test/functional/plugins.py
index 6d4ac61..8229cd4 100644
--- a/chrome/test/functional/plugins.py
+++ b/chrome/test/functional/plugins.py
@@ -20,11 +20,9 @@ class PluginsTest(pyauto.PyUITest):
This method will not run automatically.
"""
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
while True:
raw_input('Interact with the browser and hit <enter> to list plugins...')
- pp.pprint(self.GetPluginsInfo().Plugins())
+ self.pprint(self.GetPluginsInfo().Plugins())
def setUp(self):
pyauto.PyUITest.setUp(self)
diff --git a/chrome/test/functional/plugins_check.py b/chrome/test/functional/plugins_check.py
index d8a576c..0da3c1b 100644
--- a/chrome/test/functional/plugins_check.py
+++ b/chrome/test/functional/plugins_check.py
@@ -5,7 +5,6 @@
import logging
import os
-import pprint
import sys
import pyauto_functional # Must be imported before pyauto
@@ -74,15 +73,15 @@ class PluginsCheck(pyauto.PyUITest):
self.assertEqual(browser_plugin[key], plugin[key], 'The following'
' plugin attributes do not match the whitelist:'
'\n\tplugin:\n%s\n\tlist:\n%s'
- % (pprint.pformat(browser_plugin), pprint.pformat(plugin)))
+ % (self.pformat(browser_plugin), self.pformat(plugin)))
break;
self.assertTrue(found_plugin, 'The following plugin in the whitelist '
- 'does not match any on the system:\n%s' % pprint.pformat(plugin))
+ 'does not match any on the system:\n%s' % self.pformat(plugin))
if self.IsChromeOS():
self.assertEqual(len(plugins_list), len(browser_plugins_list),
'The number of plugins on the system do not match the number in the '
'whitelist.\n\tSystem list: %s\n\tWhitelist: %s' %
- (pprint.pformat(browser_plugins_list), pprint.pformat(plugins_list)))
+ (self.pformat(browser_plugins_list), self.pformat(plugins_list)))
if __name__ == '__main__':
diff --git a/chrome/test/functional/popups.py b/chrome/test/functional/popups.py
index 384afd6..300a0a4 100644
--- a/chrome/test/functional/popups.py
+++ b/chrome/test/functional/popups.py
@@ -18,11 +18,9 @@ class PopupsTest(pyauto.PyUITest):
This method will not run automatically.
"""
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
while True:
raw_input('Interact with the browser and hit <enter>')
- pp.pprint(self.GetBlockedPopupsInfo())
+ self.pprint(self.GetBlockedPopupsInfo())
def testPopupBlockerEnabled(self):
"""Verify popup blocking is enabled."""
diff --git a/chrome/test/functional/prefs.py b/chrome/test/functional/prefs.py
index 6ac9dce..54f70e9 100644
--- a/chrome/test/functional/prefs.py
+++ b/chrome/test/functional/prefs.py
@@ -15,6 +15,15 @@ import pyauto
class PrefsTest(pyauto.PyUITest):
"""TestCase for Preferences."""
+ def Debug(self):
+ """Test method for experimentation.
+
+ This method will not run automatically.
+ """
+ while True:
+ raw_input('Interact with the browser and hit <enter> to dump prefs... ')
+ self.pprint(self.GetPrefsInfo().Prefs())
+
def testSessionRestore(self):
"""Test session restore preference."""
url1 = 'http://www.google.com/'
@@ -34,17 +43,6 @@ class PrefsTest(pyauto.PyUITest):
self.ActivateTab(1)
self.assertEqual(url2, self.GetActiveTabURL().spec())
- def Debug(self):
- """Test method for experimentation.
-
- This method will not run automatically.
- """
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
- while True:
- raw_input('Interact with the browser and hit <enter> to dump prefs... ')
- pp.pprint(self.GetPrefsInfo().Prefs())
-
def testNavigationStateOnSessionRestore(self):
"""Verify navigation state is preserved on session restore."""
urls = ('http://www.google.com/',
diff --git a/chrome/test/functional/process_count.py b/chrome/test/functional/process_count.py
index 99caed1..20f8e02 100644
--- a/chrome/test/functional/process_count.py
+++ b/chrome/test/functional/process_count.py
@@ -26,6 +26,15 @@ class ProcessCountTest(pyauto.PyUITest):
'chromeos': 'chrome',
}
+ def Debug(self):
+ """Test method for experimentation.
+
+ This method will not run automatically.
+ """
+ while True:
+ raw_input('Hit <enter> to dump process info...')
+ self.pprint(self.GetProcessInfo())
+
def setUp(self):
self.proc_count_fresh_profile = 0
self.chrome_proc_name = ''
diff --git a/chrome/test/functional/search_engines.py b/chrome/test/functional/search_engines.py
index 1a115c4..2115262 100644
--- a/chrome/test/functional/search_engines.py
+++ b/chrome/test/functional/search_engines.py
@@ -36,11 +36,9 @@ class SearchEnginesTest(pyauto.PyUITest):
This method will not run automatically.
"""
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
while True:
raw_input('Interact with the browser and hit <enter>')
- pp.pprint(self.GetSearchEngineInfo())
+ self.pprint(self.GetSearchEngineInfo())
def testDiscoverSearchEngine(self):
"""Test that chrome discovers youtube search engine after searching."""
diff --git a/chrome/test/functional/themes.py b/chrome/test/functional/themes.py
index 298eec6..b718949 100644
--- a/chrome/test/functional/themes.py
+++ b/chrome/test/functional/themes.py
@@ -19,11 +19,9 @@ class ThemesTest(pyauto.PyUITest):
This method will not run automatically.
"""
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
while True:
raw_input('Hit <enter> to dump info.. ')
- pp.pprint(self.GetThemeInfo())
+ self.pprint(self.GetThemeInfo())
def testSetTheme(self):
"""Verify theme install."""
diff --git a/chrome/test/functional/translate.py b/chrome/test/functional/translate.py
index fbab00c..51a15af 100644
--- a/chrome/test/functional/translate.py
+++ b/chrome/test/functional/translate.py
@@ -24,11 +24,9 @@ class TranslateTest(pyauto.PyUITest):
def Debug(self):
""" Test method for experimentation. """
- import pprint
- pp = pprint.PrettyPrinter(indent=2)
while True:
raw_input('Hit <enter> to dump translate info.. ')
- pp.pprint(self.GetTranslateInfo())
+ self.pprint(self.GetTranslateInfo())
def _GetDefaultSpanishURL(self):
return self.GetFileURLForDataPath('translate', self.spanish, 'google.html')