Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 os | 6 import os |
| 7 import glob | 7 import glob |
| 8 | 8 |
| 9 import pyauto_functional # Must be imported before pyauto | 9 import pyauto_functional # Must be imported before pyauto |
| 10 import pyauto | 10 import pyauto |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 def testPDFRunner(self): | 34 def testPDFRunner(self): |
| 35 """Navigate to pdf files and verify that browser doesn't crash""" | 35 """Navigate to pdf files and verify that browser doesn't crash""" |
| 36 # bail out if not a branded build | 36 # bail out if not a branded build |
| 37 properties = self.GetBrowserInfo()['properties'] | 37 properties = self.GetBrowserInfo()['properties'] |
| 38 if properties['branding'] != 'Google Chrome': | 38 if properties['branding'] != 'Google Chrome': |
| 39 return | 39 return |
| 40 breakpad_folder = properties['DIR_CRASH_DUMPS'] | 40 breakpad_folder = properties['DIR_CRASH_DUMPS'] |
| 41 old_dmp_files = glob.glob(os.path.join(breakpad_folder, '*.dmp')) | 41 old_dmp_files = glob.glob(os.path.join(breakpad_folder, '*.dmp')) |
| 42 pdf_files_path = os.path.join(self.DataDir(), 'pyauto_private', 'pdf') | 42 pdf_files_path = os.path.join(self.DataDir(), 'pyauto_private', 'pdf') |
| 43 pdf_files = glob.glob(os.path.join(pdf_files_path, '*.pdf')) | 43 pdf_files = glob.glob(os.path.join(pdf_files_path, '*.pdf')) |
| 44 # Adding a web pdf file url to the list of pdf files. | |
|
Nirnimesh
2011/01/22 01:42:26
Add pdf files over http://
| |
| 45 # crbug.com/70454 | |
| 46 pdf_files = pdf_files + ['http://www.irs.gov/pub/irs-pdf/fw4.pdf'] | |
|
Nirnimesh
2011/01/22 01:42:26
pdf_files += ['http...']
| |
| 44 for pdf_file in pdf_files: | 47 for pdf_file in pdf_files: |
| 45 # Some pdfs cause known crashes. Exclude them. crbug.com/63549 | 48 # Some pdfs cause known crashes. Exclude them. crbug.com/63549 |
| 46 if os.path.basename(pdf_file) in ('nullip.pdf', 'sample.pdf'): | 49 if os.path.basename(pdf_file) in ('nullip.pdf', 'sample.pdf'): |
| 47 continue | 50 continue |
| 48 url = self.GetFileURLForPath(pdf_file) | 51 url = self.GetFileURLForPath(pdf_file) |
| 49 self.AppendTab(pyauto.GURL(url)) | 52 self.AppendTab(pyauto.GURL(url)) |
| 50 for tab_index in range(1, len(pdf_files) + 1): | 53 for tab_index in range(1, len(pdf_files) + 1): |
| 51 self.ActivateTab(tab_index) | 54 self.ActivateTab(tab_index) |
| 52 self._PerformPDFAction('fitToHeight', tab_index=tab_index) | 55 self._PerformPDFAction('fitToHeight', tab_index=tab_index) |
| 53 self._PerformPDFAction('fitToWidth', tab_index=tab_index) | 56 self._PerformPDFAction('fitToWidth', tab_index=tab_index) |
| 54 # Assert that there is at least 1 browser window. | 57 # Assert that there is at least 1 browser window. |
| 55 self.assertTrue(self.GetBrowserWindowCount(), | 58 self.assertTrue(self.GetBrowserWindowCount(), |
| 56 'Browser crashed, no window is open') | 59 'Browser crashed, no window is open') |
| 57 # Verify there're no crash dump files | 60 # Verify there're no crash dump files |
| 58 for dmp_file in glob.glob(os.path.join(breakpad_folder, '*.dmp')): | 61 for dmp_file in glob.glob(os.path.join(breakpad_folder, '*.dmp')): |
| 59 self.assertTrue(dmp_file in old_dmp_files, | 62 self.assertTrue(dmp_file in old_dmp_files, |
| 60 msg='Crash dump %s found' % dmp_file) | 63 msg='Crash dump %s found' % dmp_file) |
| 61 | 64 |
| 62 | 65 |
| 63 if __name__ == '__main__': | 66 if __name__ == '__main__': |
| 64 pyauto_functional.Main() | 67 pyauto_functional.Main() |
| OLD | NEW |