OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 411 matching lines...) Loading... |
422 # Verify that there's no download shelf anymore. | 422 # Verify that there's no download shelf anymore. |
423 self.assertFalse(self.IsDownloadShelfVisible(), | 423 self.assertFalse(self.IsDownloadShelfVisible(), |
424 'Download shelf persisted browser restart.') | 424 'Download shelf persisted browser restart.') |
425 # Verify that the download history persists. | 425 # Verify that the download history persists. |
426 downloads = self.GetDownloadsInfo().Downloads() | 426 downloads = self.GetDownloadsInfo().Downloads() |
427 self.assertEqual(1, len(downloads)) | 427 self.assertEqual(1, len(downloads)) |
428 self.assertEqual('a_zip_file.zip', downloads[0]['file_name']) | 428 self.assertEqual('a_zip_file.zip', downloads[0]['file_name']) |
429 self.assertEqual(file_url, downloads[0]['url']) | 429 self.assertEqual(file_url, downloads[0]['url']) |
430 self._DeleteAfterShutdown(downloaded_pkg) | 430 self._DeleteAfterShutdown(downloaded_pkg) |
431 | 431 |
432 def testDownloadTheme(self): | |
433 """Verify downloading and saving a theme file installs the theme.""" | |
434 test_dir = os.path.join(os.path.abspath(self.DataDir()), 'extensions') | |
435 file_url = self.GetFileURLForPath(os.path.join(test_dir, 'theme.crx')) | |
436 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), | |
437 'theme.crx') | |
438 self._ClearLocalDownloadState(downloaded_pkg) | |
439 | |
440 self.DownloadAndWaitForStart(file_url) | |
441 self.PerformActionOnDownload(self._GetDownloadId(), | |
442 'save_dangerous_download') | |
443 # Wait for the theme to be set automatically. | |
444 self.assertTrue(self.WaitUntilDownloadedThemeSet('camo theme')) | |
445 self.assertTrue(self.WaitUntil(lambda path: not os.path.exists(path), | |
446 args=[downloaded_pkg])) | |
447 | |
448 def testExtendedAttributesOnMac(self): | 432 def testExtendedAttributesOnMac(self): |
449 """Verify that Chrome sets the extended attributes on a file. | 433 """Verify that Chrome sets the extended attributes on a file. |
450 This test is for mac only. | 434 This test is for mac only. |
451 """ | 435 """ |
452 if not self.IsMac(): | 436 if not self.IsMac(): |
453 logging.info('Skipping testExtendedAttributesOnMac on non-Mac') | 437 logging.info('Skipping testExtendedAttributesOnMac on non-Mac') |
454 return | 438 return |
455 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), | 439 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), |
456 'a_zip_file.zip') | 440 'a_zip_file.zip') |
457 self._ClearLocalDownloadState(downloaded_pkg) | 441 self._ClearLocalDownloadState(downloaded_pkg) |
(...skipping 63 matching lines...) Loading... |
521 # Verify download in incognito window. | 505 # Verify download in incognito window. |
522 # bug 69738 WaitForAllDownloadsToComplete is flaky for this test case. | 506 # bug 69738 WaitForAllDownloadsToComplete is flaky for this test case. |
523 # Using extra WaitUntil until this is resolved. | 507 # Using extra WaitUntil until this is resolved. |
524 self.assertTrue(self.WaitUntil( | 508 self.assertTrue(self.WaitUntil( |
525 lambda: os.path.exists(downloaded_pkg_incog))) | 509 lambda: os.path.exists(downloaded_pkg_incog))) |
526 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog)) | 510 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog)) |
527 | 511 |
528 | 512 |
529 if __name__ == '__main__': | 513 if __name__ == '__main__': |
530 pyauto_functional.Main() | 514 pyauto_functional.Main() |
OLD | NEW |