OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import cgi | 7 import cgi |
8 import os | 8 import os |
9 | 9 |
10 import pyauto_functional # Must be imported before pyauto | 10 import pyauto_functional # Must be imported before pyauto |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 def _AssertInstantDoesNotDownloadFile(self, path): | 222 def _AssertInstantDoesNotDownloadFile(self, path): |
223 """Asserts instant does not download the specified file. | 223 """Asserts instant does not download the specified file. |
224 | 224 |
225 Args: | 225 Args: |
226 path: Path to file. | 226 path: Path to file. |
227 """ | 227 """ |
228 self.NavigateToURL('chrome://downloads') | 228 self.NavigateToURL('chrome://downloads') |
229 filepath = self.GetFileURLForDataPath(path) | 229 filepath = self.GetFileURLForDataPath(path) |
230 self.SetOmniboxText(filepath) | 230 self.SetOmniboxText(filepath) |
231 self.WaitUntilOmniboxQueryDone() | 231 self.WaitUntilOmniboxQueryDone() |
232 self.WaitForAllDownloadsToComplete() | 232 self.WaitForAllDownloadsToComplete([]) |
233 self.assertFalse(self.GetDownloadsInfo().Downloads(), | 233 self.assertFalse(self.GetDownloadsInfo().Downloads(), |
234 msg='Should not download: %s' % filepath) | 234 msg='Should not download: %s' % filepath) |
235 | 235 |
236 def testInstantDoesNotDownloadZipFile(self): | 236 def testInstantDoesNotDownloadZipFile(self): |
237 """Test that instant does not download zip file.""" | 237 """Test that instant does not download zip file.""" |
238 self._AssertInstantDoesNotDownloadFile(os.path.join('zip', 'test.zip')) | 238 self._AssertInstantDoesNotDownloadFile(os.path.join('zip', 'test.zip')) |
239 | 239 |
240 def testInstantDoesNotDownloadPDFFile(self): | 240 def testInstantDoesNotDownloadPDFFile(self): |
241 """Test that instant does not download PDF file.""" | 241 """Test that instant does not download PDF file.""" |
242 self._AssertInstantDoesNotDownloadFile(os.path.join('printing', | 242 self._AssertInstantDoesNotDownloadFile(os.path.join('printing', |
(...skipping 24 matching lines...) Expand all Loading... |
267 """Test that instant loads PNG file.""" | 267 """Test that instant loads PNG file.""" |
268 self._AssertInstantLoadsFile(os.path.join('save_page', '1.png')) | 268 self._AssertInstantLoadsFile(os.path.join('save_page', '1.png')) |
269 | 269 |
270 def testInstantLoadsSVG(self): | 270 def testInstantLoadsSVG(self): |
271 """Test that instant loads SVG file.""" | 271 """Test that instant loads SVG file.""" |
272 self._AssertInstantLoadsFile(os.path.join('circle.svg')) | 272 self._AssertInstantLoadsFile(os.path.join('circle.svg')) |
273 | 273 |
274 | 274 |
275 if __name__ == '__main__': | 275 if __name__ == '__main__': |
276 pyauto_functional.Main() | 276 pyauto_functional.Main() |
OLD | NEW |