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

Side by Side Diff: functional/downloads.py

Issue 6369010: Add additional logging to diagnose flaky testZipInIncognito test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/test/
Patch Set: Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import commands 6 import commands
7 import filecmp 7 import filecmp
8 import logging 8 import logging
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 145 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(),
146 'a_zip_file.zip') 146 'a_zip_file.zip')
147 self._ClearLocalDownloadState(downloaded_pkg) 147 self._ClearLocalDownloadState(downloaded_pkg)
148 148
149 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) # open incognito window 149 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) # open incognito window
150 # Downloads from incognito window do not figure in GetDownloadsInfo() 150 # Downloads from incognito window do not figure in GetDownloadsInfo()
151 # since the download manager's list doesn't contain it. 151 # since the download manager's list doesn't contain it.
152 # Using WaitUntil is the only resort. 152 # Using WaitUntil is the only resort.
153 self.NavigateToURL(file_url, 1, 0) 153 self.NavigateToURL(file_url, 1, 0)
154 self.assertTrue(self.WaitUntil(lambda: os.path.exists(downloaded_pkg))) 154 self.assertTrue(self.WaitUntil(lambda: os.path.exists(downloaded_pkg)))
155 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg)) 155 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg),
156 msg='%s (size %d) and %s (size %d) do not match' % (
157 file_path, os.path.getsize(file_path),
158 downloaded_pkg, os.path.getsize(downloaded_pkg)))
156 self.assertTrue(self.IsDownloadShelfVisible(1)) 159 self.assertTrue(self.IsDownloadShelfVisible(1))
157 160
158 def testSaveDangerousFile(self): 161 def testSaveDangerousFile(self):
159 """Verify that we can download and save a dangerous file.""" 162 """Verify that we can download and save a dangerous file."""
160 file_path = self._GetDangerousDownload() 163 file_path = self._GetDangerousDownload()
161 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 164 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(),
162 os.path.basename(file_path)) 165 os.path.basename(file_path))
163 self._ClearLocalDownloadState(downloaded_pkg) 166 self._ClearLocalDownloadState(downloaded_pkg)
164 self._TriggerUnsafeDownload(os.path.basename(file_path)) 167 self._TriggerUnsafeDownload(os.path.basename(file_path))
165 self.PerformActionOnDownload(self._GetDownloadId(), 168 self.PerformActionOnDownload(self._GetDownloadId(),
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 598
596 # Verify download in Incognito Window. 599 # Verify download in Incognito Window.
597 # WaitForAllDownloadsToComplete does not wait for incognito downloads 600 # WaitForAllDownloadsToComplete does not wait for incognito downloads
598 self.assertTrue(self.WaitUntil( 601 self.assertTrue(self.WaitUntil(
599 lambda: os.path.exists(downloaded_pkg_incog))) 602 lambda: os.path.exists(downloaded_pkg_incog)))
600 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog)) 603 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog))
601 604
602 605
603 if __name__ == '__main__': 606 if __name__ == '__main__':
604 pyauto_functional.Main() 607 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698