OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import logging | 5 import logging |
6 import os | 6 import os |
7 import unittest | 7 import unittest |
8 | 8 |
| 9 from telemetry.core import discover |
9 from telemetry.internal.browser import browser_credentials | 10 from telemetry.internal.browser import browser_credentials |
10 from telemetry import page | 11 from telemetry import page |
11 from telemetry import story as story_module | 12 from telemetry import story as story_module |
12 from telemetry.util import classes_util | |
13 from telemetry.wpr import archive_info | 13 from telemetry.wpr import archive_info |
14 | 14 |
15 | 15 |
16 class StorySetSmokeTest(unittest.TestCase): | 16 class StorySetSmokeTest(unittest.TestCase): |
17 | 17 |
18 def setUp(self): | 18 def setUp(self): |
19 # Make sure the added failure message is appended to the default failure | 19 # Make sure the added failure message is appended to the default failure |
20 # message. | 20 # message. |
21 self.longMessage = True | 21 self.longMessage = True |
22 | 22 |
23 def GetAllStorySetClasses(self, story_sets_dir, top_level_dir): | 23 def GetAllStorySetClasses(self, story_sets_dir, top_level_dir): |
24 # We can't test page sets that aren't directly constructable since we | 24 # We can't test page sets that aren't directly constructable since we |
25 # don't know what arguments to put for the constructor. | 25 # don't know what arguments to put for the constructor. |
26 return classes_util.DiscoverClasses(story_sets_dir, top_level_dir, | 26 return discover.DiscoverClasses(story_sets_dir, top_level_dir, |
27 story_module.StorySet, | 27 story_module.StorySet, |
28 directly_constructable=True) | 28 directly_constructable=True).values() |
29 | 29 |
30 def CheckArchive(self, story_set): | 30 def CheckArchive(self, story_set): |
31 """Verify that all URLs of pages in story_set have an associated archive.""" | 31 """Verify that all URLs of pages in story_set have an associated archive.""" |
32 # TODO: Eventually these should be fatal. | 32 # TODO: Eventually these should be fatal. |
33 if not story_set.archive_data_file: | 33 if not story_set.archive_data_file: |
34 logging.warning('Skipping %s: no archive data file', story_set.file_path) | 34 logging.warning('Skipping %s: no archive data file', story_set.file_path) |
35 return | 35 return |
36 | 36 |
37 logging.info('Testing %s', story_set.file_path) | 37 logging.info('Testing %s', story_set.file_path) |
38 | 38 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 method to run smoke test. | 134 method to run smoke test. |
135 """ | 135 """ |
136 story_sets = self.GetAllStorySetClasses(story_sets_dir, top_level_dir) | 136 story_sets = self.GetAllStorySetClasses(story_sets_dir, top_level_dir) |
137 for story_set_class in story_sets: | 137 for story_set_class in story_sets: |
138 story_set = story_set_class() | 138 story_set = story_set_class() |
139 logging.info('Testing %s', story_set.file_path) | 139 logging.info('Testing %s', story_set.file_path) |
140 self.CheckArchive(story_set) | 140 self.CheckArchive(story_set) |
141 self.CheckCredentials(story_set) | 141 self.CheckCredentials(story_set) |
142 self.CheckAttributes(story_set) | 142 self.CheckAttributes(story_set) |
143 self.CheckSharedStates(story_set) | 143 self.CheckSharedStates(story_set) |
OLD | NEW |