OLD | NEW |
---|---|
(Empty) | |
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 | |
3 # found in the LICENSE file. | |
4 | |
5 from telemetry.page import page as page_module | |
6 from telemetry.page import page_set as page_set_module | |
7 | |
8 | |
9 class VideoPage(page_module.Page): | |
10 """A test page containing a video. | |
11 | |
12 Attributes: | |
13 use_chrome_proxy: If true, fetches use the data reduction proxy. | |
14 Otherwise, fetches are sent directly to the origin. | |
15 """ | |
16 | |
17 def __init__(self, url, page_set, use_chrome_proxy): | |
18 super(VideoPage, self).__init__(url=url, page_set=page_set) | |
19 self.use_chrome_proxy = use_chrome_proxy | |
20 | |
21 | |
22 class VideoPageSet(page_set_module.PageSet): | |
23 """ Chrome proxy video tests. | |
24 | |
25 Attributes: | |
26 mode: One of the following values: | |
27 'direct', to fetch all pages directly from the origin, | |
28 'proxied', to fetch all pages using the data reduction proxy, or | |
29 'compare', to fetch both 'direct' and 'proxied' and compare the results. | |
30 """ | |
31 def __init__(self, mode): | |
32 super(VideoPageSet, self).__init__() | |
33 | |
34 urls_list = [ | |
35 'http://aws1.mdw.la/fwvideo/simple.html', | |
36 ] | |
37 | |
38 for url in urls_list: | |
sclittle
2015/04/10 23:01:50
Could you just have VideoDirectPageSet, etc. call
Tom Bergan
2015/04/10 23:41:05
Done.
| |
39 if mode == 'direct': | |
40 self.AddUserStory(VideoPage(url, self, False)) | |
41 elif mode == 'proxied': | |
42 self.AddUserStory(VideoPage(url, self, True)) | |
43 elif mode == 'compare': | |
44 self.AddUserStory(VideoPage(url, self, False)) | |
45 self.AddUserStory(VideoPage(url, self, True)) | |
46 else: | |
47 raise Exception('unknown mode %s' % mode) | |
48 | |
49 | |
50 class VideoDirectPageSet(VideoPageSet): | |
51 """ Chrome proxy video tests: direct fetch. """ | |
52 def __init__(self): | |
53 super(VideoDirectPageSet, self).__init__('direct') | |
54 | |
55 | |
56 class VideoProxiedPageSet(VideoPageSet): | |
57 """ Chrome proxy video tests: proxied fetch. """ | |
58 def __init__(self): | |
59 super(VideoProxiedPageSet, self).__init__('proxied') | |
60 | |
61 | |
62 class VideoComparePageSet(VideoPageSet): | |
63 """ Chrome proxy video tests: compare direct and proxied fetches. """ | |
64 def __init__(self): | |
65 super(VideoComparePageSet, self).__init__('compare') | |
OLD | NEW |