Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4602)

Unified Diff: chrome/test/functional/find_in_page.py

Issue 4166006: moved commonly used private functions to it's own utility file. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/functional/test_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/functional/find_in_page.py
===================================================================
--- chrome/test/functional/find_in_page.py (revision 64201)
+++ chrome/test/functional/find_in_page.py (working copy)
@@ -8,6 +8,7 @@
import pyauto_functional
import pyauto
+import test_utils
class FindMatchTests(pyauto.PyUITest):
@@ -74,40 +75,29 @@
"""Verify search for text within special URLs such as chrome:history.
chrome://history, chrome://downloads, pyAuto Data directory
"""
+ zip_file = 'a_zip_file.zip'
self.NavigateToURL(self.GetFileURLForPath(self.DataDir()))
# search in Data directory
self.assertEqual(1,
self.FindInPage('downloads', tab_index=0)['match_count'])
# search in History page
self.AppendTab(pyauto.GURL('chrome://history'))
+ # the contents in the history page load asynchronously after tab loads
+ self.WaitUntil(
+ lambda: self.FindInPage('data', tab_index=1)['match_count'],
+ expect_retval=1)
self.assertEqual(1, self.FindInPage('data', tab_index=1)['match_count'])
# search in Downloads page
- self._DownloadZipFile()
+ test_utils.DownloadTestFile(self, zip_file)
self.AppendTab(pyauto.GURL('chrome://downloads'))
+ # the contents in the downloads page load asynchronously after tab loads
+ self.WaitUntil(
+ lambda: self.FindInPage(zip_file, tab_index=2)['match_count'],
+ expect_retval=2)
self.assertEqual(2,
- self.FindInPage('a_zip_file.zip', tab_index=2)['match_count'])
- self._RemoveZipFile()
+ self.FindInPage(zip_file, tab_index=2)['match_count'])
+ test_utils.RemoveTestFile(self, zip_file)
- def _DownloadZipFile(self):
- """Download a zip file."""
- zip_file = 'a_zip_file.zip'
- download_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads')
- file_path = os.path.join(download_dir, zip_file)
- file_url = self.GetFileURLForPath(file_path)
- downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), zip_file)
- # Check if zip file already exists. If so then delete it.
- if os.path.exists(downloaded_pkg):
- self._RemoveZipFile()
- self.DownloadAndWaitForStart(file_url)
- # Wait for the download to finish
- self.WaitForAllDownloadsToComplete()
- def _RemoveZipFile(self):
- """Delete a_zip_file.zip from the download directory."""
- downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(),
- 'a_zip_file.zip')
- os.remove(downloaded_pkg)
-
-
if __name__ == '__main__':
pyauto_functional.Main()
« no previous file with comments | « no previous file | chrome/test/functional/test_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698