OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 from telemetry.page import page as page_module | 5 from telemetry.page import page as page_module |
6 from telemetry.page import page_set as page_set_module | 6 from telemetry import story |
7 | 7 |
8 | 8 |
9 class VideoPage(page_module.Page): | 9 class VideoPage(page_module.Page): |
10 """A test page containing a video. | 10 """A test page containing a video. |
11 | 11 |
12 Attributes: | 12 Attributes: |
13 use_chrome_proxy: If true, fetches use the data reduction proxy. | 13 use_chrome_proxy: If true, fetches use the data reduction proxy. |
14 Otherwise, fetches are sent directly to the origin. | 14 Otherwise, fetches are sent directly to the origin. |
15 """ | 15 """ |
16 | 16 |
17 def __init__(self, url, page_set, use_chrome_proxy): | 17 def __init__(self, url, page_set, use_chrome_proxy): |
18 super(VideoPage, self).__init__(url=url, page_set=page_set) | 18 super(VideoPage, self).__init__(url=url, page_set=page_set) |
19 self.use_chrome_proxy = use_chrome_proxy | 19 self.use_chrome_proxy = use_chrome_proxy |
20 | 20 |
21 | 21 |
22 class VideoPageSet(page_set_module.PageSet): | 22 class VideoStorySet(story.StorySet): |
23 """Base class for Chrome proxy video tests.""" | 23 """Base class for Chrome proxy video tests.""" |
24 | 24 |
25 def __init__(self, mode): | 25 def __init__(self, mode): |
26 super(VideoPageSet, self).__init__() | 26 super(VideoStorySet, self).__init__() |
27 urls_list = [ | 27 urls_list = [ |
28 'http://check.googlezip.net/cacheable/video/buck_bunny_tiny.html', | 28 'http://check.googlezip.net/cacheable/video/buck_bunny_tiny.html', |
29 ] | 29 ] |
30 for url in urls_list: | 30 for url in urls_list: |
31 self._AddUserStoryForURL(url) | 31 self._AddStoryForURL(url) |
32 | 32 |
33 def _AddUserStoryForURL(self, url): | 33 def _AddStoryForURL(self, url): |
34 raise NotImplementedError | 34 raise NotImplementedError |
35 | 35 |
36 | 36 |
37 class VideoDirectPageSet(VideoPageSet): | 37 class VideoDirectStorySet(VideoStorySet): |
38 """Chrome proxy video tests: direct fetch.""" | 38 """Chrome proxy video tests: direct fetch.""" |
39 def __init__(self): | 39 def __init__(self): |
40 super(VideoDirectPageSet, self).__init__('direct') | 40 super(VideoDirectStorySet, self).__init__('direct') |
41 | 41 |
42 def _AddUserStoryForURL(self, url): | 42 def _AddStoryForURL(self, url): |
43 self.AddUserStory(VideoPage(url, self, False)) | 43 self.AddStory(VideoPage(url, self, False)) |
44 | 44 |
45 | 45 |
46 class VideoProxiedPageSet(VideoPageSet): | 46 class VideoProxiedStorySet(VideoStorySet): |
47 """Chrome proxy video tests: proxied fetch.""" | 47 """Chrome proxy video tests: proxied fetch.""" |
48 def __init__(self): | 48 def __init__(self): |
49 super(VideoProxiedPageSet, self).__init__('proxied') | 49 super(VideoProxiedStorySet, self).__init__('proxied') |
50 | 50 |
51 def _AddUserStoryForURL(self, url): | 51 def _AddStoryForURL(self, url): |
52 self.AddUserStory(VideoPage(url, self, True)) | 52 self.AddStory(VideoPage(url, self, True)) |
53 | 53 |
54 | 54 |
55 class VideoComparePageSet(VideoPageSet): | 55 class VideoCompareStorySet(VideoStorySet): |
56 """Chrome proxy video tests: compare direct and proxied fetches.""" | 56 """Chrome proxy video tests: compare direct and proxied fetches.""" |
57 def __init__(self): | 57 def __init__(self): |
58 super(VideoComparePageSet, self).__init__('compare') | 58 super(VideoCompareStorySet, self).__init__('compare') |
59 | 59 |
60 def _AddUserStoryForURL(self, url): | 60 def _AddStoryForURL(self, url): |
61 self.AddUserStory(VideoPage(url, self, False)) | 61 self.AddStory(VideoPage(url, self, False)) |
62 self.AddUserStory(VideoPage(url, self, True)) | 62 self.AddStory(VideoPage(url, self, True)) |
OLD | NEW |