summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authoralyssad@google.com <alyssad@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-27 21:20:52 +0000
committeralyssad@google.com <alyssad@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-27 21:20:52 +0000
commit8708aa43fa34e36056f06d970dc7f1a5ebc48a87 (patch)
tree3e9c80366a86fcb0cdb95fa5d8c9a3e6a632934a /chrome/test
parente5b9fca9ff76dad920caa091dae204b7da00bdf5 (diff)
downloadchromium_src-8708aa43fa34e36056f06d970dc7f1a5ebc48a87.zip
chromium_src-8708aa43fa34e36056f06d970dc7f1a5ebc48a87.tar.gz
chromium_src-8708aa43fa34e36056f06d970dc7f1a5ebc48a87.tar.bz2
New pyauto hook (wait until extension has been installed) and test.
The hook waits until a downloaded .crx file has been installed. The test is for downloading a theme. Review URL: http://codereview.chromium.org/3152045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/functional/downloads.py16
-rw-r--r--chrome/test/pyautolib/pyauto.py16
2 files changed, 32 insertions, 0 deletions
diff --git a/chrome/test/functional/downloads.py b/chrome/test/functional/downloads.py
index 2342694..e70e6cd 100644
--- a/chrome/test/functional/downloads.py
+++ b/chrome/test/functional/downloads.py
@@ -362,6 +362,22 @@ class DownloadsTest(pyauto.PyUITest):
self.assertEqual(file_url, downloads[0]['url'])
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
+ def testDownloadTheme(self):
+ """Verify downloading and saving a theme file installs the theme."""
+ test_dir = os.path.join(os.path.abspath(self.DataDir()), 'extensions')
+ file_url = self.GetFileURLForPath(os.path.join(test_dir, 'theme.crx'))
+ downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(),
+ 'theme.crx')
+ os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
+
+ self.DownloadAndWaitForStart(file_url)
+ self.PerformActionOnDownload(self._GetDownloadId(),
+ 'save_dangerous_download')
+ # Wait for the theme to be set automatically.
+ self.assertTrue(self.WaitUntilDownloadedThemeSet('camo theme'))
+ self.assertTrue(self.WaitUntil(lambda path: not os.path.exists(path),
+ args=[downloaded_pkg]))
+
if __name__ == '__main__':
pyauto_functional.Main()
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py
index 555deb0..6aa64a2 100644
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -1282,6 +1282,22 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
"""
return self.InstallExtension(crx_file_path, True)
+ def WaitUntilDownloadedThemeSet(self, theme_name):
+ """Waits until the theme has been set.
+
+ This should not be called after SetTheme(). It only needs to be called after
+ downloading a theme file (which will automatically set the theme).
+
+ Uses WaitUntil so timeout is capped by automation timeout.
+
+ Args:
+ theme_name: The name that the theme will have once it is installed.
+ """
+ def _ReturnThemeSet(name):
+ theme_info = self.GetThemeInfo()
+ return theme_info and theme_info['name'] == name
+ return self.WaitUntil(_ReturnThemeSet, args=[theme_name])
+
def ClearTheme(self):
"""Clear the theme. Resets to default.