diff options
author | nirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-21 01:05:31 +0000 |
---|---|---|
committer | nirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-21 01:05:31 +0000 |
commit | d345da8e3a16aa212e415eb58a259f45ca81ae77 (patch) | |
tree | 329e80d87dd770d10dc1243e1ddcd01cc949ad12 /chrome/test | |
parent | 67f816514744e36bbb8f0328a870325d33519d77 (diff) | |
download | chromium_src-d345da8e3a16aa212e415eb58a259f45ca81ae77.zip chromium_src-d345da8e3a16aa212e415eb58a259f45ca81ae77.tar.gz chromium_src-d345da8e3a16aa212e415eb58a259f45ca81ae77.tar.bz2 |
revert crazy_filenames
Review URL: http://codereview.chromium.org/1742001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45137 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
9 files changed, 69 insertions, 8 deletions
diff --git a/chrome/test/data/downloads/crazy_filenames/Picture 1.doc b/chrome/test/data/downloads/crazy_filenames/Picture 1.doc Binary files differdeleted file mode 100644 index a82c507..0000000 --- a/chrome/test/data/downloads/crazy_filenames/Picture 1.doc +++ /dev/null diff --git a/chrome/test/data/downloads/crazy_filenames/Wohoo-to hoo+I.rtf b/chrome/test/data/downloads/crazy_filenames/Wohoo-to hoo+I.rtf deleted file mode 100644 index e965047..0000000 --- a/chrome/test/data/downloads/crazy_filenames/Wohoo-to hoo+I.rtf +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/chrome/test/data/downloads/crazy_filenames/jiho!@#$tiho$%^&-()_+=miho copy.rtf b/chrome/test/data/downloads/crazy_filenames/jiho!@#$tiho$%^&-()_+=miho copy.rtf deleted file mode 100644 index e965047..0000000 --- a/chrome/test/data/downloads/crazy_filenames/jiho!@#$tiho$%^&-()_+=miho copy.rtf +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/chrome/test/data/downloads/crazy_filenames/jiho....tiho...miho.rtf b/chrome/test/data/downloads/crazy_filenames/jiho....tiho...miho.rtf deleted file mode 100644 index e965047..0000000 --- a/chrome/test/data/downloads/crazy_filenames/jiho....tiho...miho.rtf +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/chrome/test/data/downloads/crazy_filenames/tini(玉树强震已致760人遇难).rtf b/chrome/test/data/downloads/crazy_filenames/tini(玉树强震已致760人遇难).rtf deleted file mode 100644 index e965047..0000000 --- a/chrome/test/data/downloads/crazy_filenames/tini(玉树强震已致760人遇难).rtf +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/chrome/test/data/downloads/crazy_filenames/Цинхай достигло 760-540.rtf b/chrome/test/data/downloads/crazy_filenames/Цинхай достигло 760-540.rtf deleted file mode 100644 index e965047..0000000 --- a/chrome/test/data/downloads/crazy_filenames/Цинхай достигло 760-540.rtf +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/chrome/test/data/downloads/crazy_filenames/супруги Мишель.rtf b/chrome/test/data/downloads/crazy_filenames/супруги Мишель.rtf deleted file mode 100644 index e965047..0000000 --- a/chrome/test/data/downloads/crazy_filenames/супруги Мишель.rtf +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/chrome/test/data/downloads/crazy_filenames/截至15日下午16时30分.rtf b/chrome/test/data/downloads/crazy_filenames/截至15日下午16时30分.rtf deleted file mode 100644 index e965047..0000000 --- a/chrome/test/data/downloads/crazy_filenames/截至15日下午16时30分.rtf +++ /dev/null @@ -1 +0,0 @@ -Hello diff --git a/chrome/test/functional/downloads.py b/chrome/test/functional/downloads.py index 6a8492d..fb9eef9 100644 --- a/chrome/test/functional/downloads.py +++ b/chrome/test/functional/downloads.py @@ -108,7 +108,7 @@ class DownloadsTest(pyauto.PyUITest): test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads', 'crazy_filenames') data_file = os.path.join(test_dir, 'download_filenames') - filenames = os.listdir(test_dir) + filenames = filter(os.path.isfile, os.listdir(test_dir)) logging.info('Testing with %d crazy filenames' % len(filenames)) for filename in filenames: downloaded_file = os.path.join(download_dir, filename) @@ -129,6 +129,74 @@ class DownloadsTest(pyauto.PyUITest): self._ComputeMD5sum(os.path.join(test_dir, filename))) os.path.exists(downloaded_file) and os.remove(downloaded_file) + def testDownloadInIncognito(self): + """Download a zip in incognito window and verify. + + Also verify that the download shelf showed up. + """ + test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') + checksum_file = os.path.join(test_dir, 'a_zip_file.md5sum') + file_url = self.GetFileURLForPath(os.path.join(test_dir, 'a_zip_file.zip')) + golden_md5sum = urllib.urlopen(checksum_file).read() + downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), + 'a_zip_file.zip') + os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) + self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) + self.NavigateToURL(file_url, 1, 0) # in incognito window + + # Wait for the download to finish. + self.WaitForAllDownloadsToComplete() + + # Verify that the download shelf is visible in Incognito Window + self.assertTrue(self.IsDownloadShelfVisible(1)) + + # Verify that the download shelf is not visible in regular window + self.assertFalse(self.IsDownloadShelfVisible(0)) + + # Verify that the file was correctly downloaded + self.assertTrue(os.path.exists(downloaded_pkg)) + self.assertEqual(golden_md5sum, self._ComputeMD5sum(downloaded_pkg)) + downloads = self.GetDownloadsInfo().Downloads() + print downloads + + def testDownloadIncognitoAndRegular(self): + """Download the same zip file in regular and incognito window and verify that it downloaded correctly with same file name + appended with counter for the second download in regular window. + Also verify that the download shelf showed up. + """ + test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') + checksum_file = os.path.join(test_dir, 'a_zip_file.md5sum') + file_url = 'file://%s' % os.path.join(test_dir, 'a_zip_file.zip') + golden_md5sum = urllib.urlopen(checksum_file).read() + downloaded_pkg_incog = os.path.join(self.GetDownloadDirectory().value(), + 'a_zip_file.zip') + downloaded_pkg_regul= os.path.join(self.GetDownloadDirectory().value(), + 'a_zip_file (1).zip') + os.path.exists(downloaded_pkg_incog) and os.remove(downloaded_pkg_incog) + os.path.exists(downloaded_pkg_regul) and os.remove(downloaded_pkg_regul) + self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) + self.NavigateToURL(file_url, 1, 0) + self.NavigateToURL(file_url, 0, 0) + + # Wait for the download to finish. + self.WaitForAllDownloadsToComplete() + + # Verify that the download shelf is visible in Incognito Window + self.assertTrue(self.WaitUntil(lambda: self.IsDownloadShelfVisible(1))) + + # Verify that the download shelf is visible in regular window + self.assertTrue(self.WaitUntil(lambda: self.IsDownloadShelfVisible(0))) + + # Verify that the file was correctly downloaded in Incognito window and match with actual file name + self.assertTrue(os.path.exists(downloaded_pkg_incog)) + # print 'Download size is %d' % os.path.getsize(downloaded_pkg_incog) + self.assertEqual(golden_md5sum, self._ComputeMD5sum(downloaded_pkg_incog)) + + # Verify that the file was correctly downloaded in regular window and match with actual file name with counter appended + self.assertTrue(os.path.exists(downloaded_pkg_regul)) + # print 'Download size is %d' % os.path.getsize(downloaded_pkg_regul) + self.assertEqual(golden_md5sum, self._ComputeMD5sum(downloaded_pkg_regul)) + if __name__ == '__main__': pyauto_functional.Main() |