| 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 glob | 6 import glob |
| 7 import logging | 7 import logging |
| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 This does not get run automatically. To run: | 97 This does not get run automatically. To run: |
| 98 python themes.py themes.ThemesTest.Runner | 98 python themes.py themes.ThemesTest.Runner |
| 99 | 99 |
| 100 Note: this test requires that a directory of crx files called 'themes' | 100 Note: this test requires that a directory of crx files called 'themes' |
| 101 exists in the data directory. | 101 exists in the data directory. |
| 102 """ | 102 """ |
| 103 themes_dir = os.path.join(self.DataDir(), 'themes') | 103 themes_dir = os.path.join(self.DataDir(), 'themes') |
| 104 urls_file = os.path.join(self.DataDir(), 'urls.txt') | 104 urls_file = os.path.join(self.DataDir(), 'urls.txt') |
| 105 | 105 |
| 106 assert(os.path.exists(themes_dir), | 106 assert os.path.exists(themes_dir), \ |
| 107 'The dir "%s" must exist' % os.path.abspath(themes_dir)) | 107 'The dir "%s" must exist' % os.path.abspath(themes_dir) |
| 108 | 108 |
| 109 group_size = 20 | 109 group_size = 20 |
| 110 num_urls_to_visit = 100 | 110 num_urls_to_visit = 100 |
| 111 | 111 |
| 112 urls = [l.rstrip() for l in | 112 urls = [l.rstrip() for l in |
| 113 open(urls_file).readlines()[:num_urls_to_visit]] | 113 open(urls_file).readlines()[:num_urls_to_visit]] |
| 114 failed_themes = glob.glob(os.path.join(themes_dir, '*.crx')) | 114 failed_themes = glob.glob(os.path.join(themes_dir, '*.crx')) |
| 115 | 115 |
| 116 while failed_themes and group_size: | 116 while failed_themes and group_size: |
| 117 failed_themes = self._ReturnCrashingThemes(failed_themes, group_size, | 117 failed_themes = self._ReturnCrashingThemes(failed_themes, group_size, |
| 118 urls) | 118 urls) |
| 119 group_size = group_size // 2 | 119 group_size = group_size // 2 |
| 120 | 120 |
| 121 self.assertFalse(failed_themes, | 121 self.assertFalse(failed_themes, |
| 122 'Theme(s) in failing group: %s' % failed_themes) | 122 'Theme(s) in failing group: %s' % failed_themes) |
| 123 | 123 |
| 124 | 124 |
| 125 if __name__ == '__main__': | 125 if __name__ == '__main__': |
| 126 pyauto_functional.Main() | 126 pyauto_functional.Main() |
| 127 | 127 |
| OLD | NEW |