diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 02:24:04 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-02 02:24:04 +0000 |
commit | 59a6112447827f01c4e40ef3072819f821989570 (patch) | |
tree | be9f7a44a64e899dd2c27fb35d5c17bacd77b088 /chrome/test/functional/downloads.py | |
parent | 94953a56eb19ddef86c0264ef9cd0ac1f0f18332 (diff) | |
download | chromium_src-59a6112447827f01c4e40ef3072819f821989570.zip chromium_src-59a6112447827f01c4e40ef3072819f821989570.tar.gz chromium_src-59a6112447827f01c4e40ef3072819f821989570.tar.bz2 |
Add generic "json dict" entry point for pyauto commands. Will prevent
the need to modify the automation proxy anymore. New pyauto commands
will only need to edit pyauto.py (to add a new SendJSONCommand() call)
and browser_proxy.cc (to implement the other side). Contrast with the
normal editing of ~8 files.
Also added WaitForAllDownloadsToComplete using new JSON path.
BUG=http://crbug.com/39274
Review URL: http://codereview.chromium.org/1547012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43436 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/functional/downloads.py')
-rw-r--r-- | chrome/test/functional/downloads.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/chrome/test/functional/downloads.py b/chrome/test/functional/downloads.py index d2bf5be..4be9128 100644 --- a/chrome/test/functional/downloads.py +++ b/chrome/test/functional/downloads.py @@ -22,6 +22,10 @@ class DownloadsTest(pyauto.PyUITest): md5.update(open(filename, 'rb').read()) return md5.hexdigest() + def testNoDownloadWaitingNeeded(self): + """Make sure "wait for downloads" returns quickly if we have none.""" + self.WaitForAllDownloadsToComplete() + def testZip(self): """Download a zip and verify that it downloaded correctly. Also verify that the download shelf showed up. @@ -38,17 +42,28 @@ class DownloadsTest(pyauto.PyUITest): # Download self.NavigateToURL(file_url) - # TODO: Remove this sleep. Wait until all downloads finish. - time.sleep(4) + # Wait for the download to finish + start = time.time() + self.WaitForAllDownloadsToComplete() + end = time.time() + print 'Wait for downloads to complete: %2.2fsec' % (end - start) # Verify that the download shelf is visible self.assertTrue(self.IsDownloadShelfVisible()) # Verify that the file was correctly downloaded self.assertTrue(os.path.exists(downloaded_pkg)) + # print 'Download size is %d' % os.path.getsize(downloaded_pkg) self.assertEqual(golden_md5sum, self._ComputeMD5sum(downloaded_pkg)) + def testBigZip(self): + # TODO: download something "pretty big". The above test will + # usually wortk even without the WaitForAllDownloadsToComplete(). + # Manual testing shows it isn't just a noop, but an explicit test + # is needed here. However, if the download is TOO big, we hit a + # 30sec timeout in our automation proxy / IPC (didn't track down + # where exactly). + pass if __name__ == '__main__': pyauto_functional.Main() - |