| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 logging | 6 import logging |
| 7 import os | 7 import os |
| 8 import shutil | 8 import shutil |
| 9 import sys | 9 import sys |
| 10 | 10 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 """Verify download dir pref.""" | 94 """Verify download dir pref.""" |
| 95 test_dir = os.path.join(self.DataDir(), 'downloads') | 95 test_dir = os.path.join(self.DataDir(), 'downloads') |
| 96 file_url = self.GetFileURLForPath(os.path.join(test_dir, 'a_zip_file.zip')) | 96 file_url = self.GetFileURLForPath(os.path.join(test_dir, 'a_zip_file.zip')) |
| 97 download_dir = self.GetDownloadDirectory().value() | 97 download_dir = self.GetDownloadDirectory().value() |
| 98 new_dl_dir = os.path.join(download_dir, 'My+Downloads Folder') | 98 new_dl_dir = os.path.join(download_dir, 'My+Downloads Folder') |
| 99 downloaded_pkg = os.path.join(new_dl_dir, 'a_zip_file.zip') | 99 downloaded_pkg = os.path.join(new_dl_dir, 'a_zip_file.zip') |
| 100 os.path.exists(new_dl_dir) and shutil.rmtree(new_dl_dir) | 100 os.path.exists(new_dl_dir) and shutil.rmtree(new_dl_dir) |
| 101 os.makedirs(new_dl_dir) | 101 os.makedirs(new_dl_dir) |
| 102 # Set pref to download in new_dl_dir | 102 # Set pref to download in new_dl_dir |
| 103 self.SetPrefs(pyauto.kDownloadDefaultDirectory, new_dl_dir) | 103 self.SetPrefs(pyauto.kDownloadDefaultDirectory, new_dl_dir) |
| 104 pre_download_ids = [x['id'] for x in self.GetDownloadsInfo().Downloads()] |
| 104 self.DownloadAndWaitForStart(file_url) | 105 self.DownloadAndWaitForStart(file_url) |
| 105 self.WaitForAllDownloadsToComplete() | 106 self.WaitForAllDownloadsToComplete(pre_download_ids) |
| 106 self.assertTrue(os.path.exists(downloaded_pkg)) | 107 self.assertTrue(os.path.exists(downloaded_pkg)) |
| 107 shutil.rmtree(new_dl_dir, ignore_errors=True) # cleanup | 108 shutil.rmtree(new_dl_dir, ignore_errors=True) # cleanup |
| 108 | 109 |
| 109 def testToolbarButtonsPref(self): | 110 def testToolbarButtonsPref(self): |
| 110 """Verify toolbar buttons prefs.""" | 111 """Verify toolbar buttons prefs.""" |
| 111 # Assert defaults first | 112 # Assert defaults first |
| 112 self.assertFalse(self.GetPrefsInfo().Prefs(pyauto.kShowHomeButton)) | 113 self.assertFalse(self.GetPrefsInfo().Prefs(pyauto.kShowHomeButton)) |
| 113 self.SetPrefs(pyauto.kShowHomeButton, True) | 114 self.SetPrefs(pyauto.kShowHomeButton, True) |
| 114 self.RestartBrowser(clear_profile=False) | 115 self.RestartBrowser(clear_profile=False) |
| 115 self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kShowHomeButton)) | 116 self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kShowHomeButton)) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 self.assertEqual(title1, self.GetActiveTabTitle()) | 188 self.assertEqual(title1, self.GetActiveTabTitle()) |
| 188 self.SetPrefs('webkit.webprefs.javascript_enabled', False) | 189 self.SetPrefs('webkit.webprefs.javascript_enabled', False) |
| 189 title = 'This is html title' | 190 title = 'This is html title' |
| 190 self.NavigateToURL(url) | 191 self.NavigateToURL(url) |
| 191 self.assertEqual(title, self.GetActiveTabTitle()) | 192 self.assertEqual(title, self.GetActiveTabTitle()) |
| 192 | 193 |
| 193 | 194 |
| 194 if __name__ == '__main__': | 195 if __name__ == '__main__': |
| 195 pyauto_functional.Main() | 196 pyauto_functional.Main() |
| 196 | 197 |
| OLD | NEW |