OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/python |
| 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 |
| 4 # found in the LICENSE file. |
| 5 |
| 6 import os |
| 7 import glob |
| 8 |
| 9 import pyauto_functional # Must be imported before pyauto |
| 10 import pyauto |
| 11 |
| 12 |
| 13 class PDFsTest(pyauto.PyUITest): |
| 14 """PDF related tests |
| 15 |
| 16 This test runs only on Google Chrome build, not on Chromium. |
| 17 """ |
| 18 |
| 19 def testPDFRunner(self): |
| 20 """Navigate to pdf files and verify that browser doesn't crash""" |
| 21 # bail out if not a branded build |
| 22 properties = self.GetBrowserInfo()['properties'] |
| 23 if properties['branding'] != 'Google Chrome': |
| 24 return |
| 25 pdf_files_path = os.path.join(self.DataDir(), 'pyauto_private', 'pdf') |
| 26 pdf_files = glob.glob(os.path.join(pdf_files_path, '*.pdf')) |
| 27 for pdf_file in pdf_files: |
| 28 url = self.GetFileURLForPath(os.path.join(pdf_files_path, pdf_file)) |
| 29 self.AppendTab(pyauto.GURL(url)) |
| 30 # Assert that there is at least 1 browser window. |
| 31 self.assertTrue(self.GetBrowserWindowCount(), |
| 32 'Browser crashed, no window is open') |
| 33 |
| 34 if __name__ == '__main__': |
| 35 pyauto_functional.Main() |
OLD | NEW |