Chromium Code Reviews| Index: tools/chrome_proxy/integration_tests/chrome_proxy_pagesets/video.py |
| diff --git a/tools/chrome_proxy/integration_tests/chrome_proxy_pagesets/video.py b/tools/chrome_proxy/integration_tests/chrome_proxy_pagesets/video.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c7ce214b50a0428d863bb12b22de26997077e1c3 |
| --- /dev/null |
| +++ b/tools/chrome_proxy/integration_tests/chrome_proxy_pagesets/video.py |
| @@ -0,0 +1,65 @@ |
| +# Copyright 2015 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +from telemetry.page import page as page_module |
| +from telemetry.page import page_set as page_set_module |
| + |
| + |
| +class VideoPage(page_module.Page): |
| + """A test page containing a video. |
| + |
| + Attributes: |
| + use_chrome_proxy: If true, fetches use the data reduction proxy. |
| + Otherwise, fetches are sent directly to the origin. |
| + """ |
| + |
| + def __init__(self, url, page_set, use_chrome_proxy): |
| + super(VideoPage, self).__init__(url=url, page_set=page_set) |
| + self.use_chrome_proxy = use_chrome_proxy |
| + |
| + |
| +class VideoPageSet(page_set_module.PageSet): |
| + """ Chrome proxy video tests. |
| + |
| + Attributes: |
| + mode: One of the following values: |
| + 'direct', to fetch all pages directly from the origin, |
| + 'proxied', to fetch all pages using the data reduction proxy, or |
| + 'compare', to fetch both 'direct' and 'proxied' and compare the results. |
| + """ |
| + def __init__(self, mode): |
| + super(VideoPageSet, self).__init__() |
| + |
| + urls_list = [ |
| + 'http://aws1.mdw.la/fwvideo/simple.html', |
| + ] |
| + |
| + 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.
|
| + if mode == 'direct': |
| + self.AddUserStory(VideoPage(url, self, False)) |
| + elif mode == 'proxied': |
| + self.AddUserStory(VideoPage(url, self, True)) |
| + elif mode == 'compare': |
| + self.AddUserStory(VideoPage(url, self, False)) |
| + self.AddUserStory(VideoPage(url, self, True)) |
| + else: |
| + raise Exception('unknown mode %s' % mode) |
| + |
| + |
| +class VideoDirectPageSet(VideoPageSet): |
| + """ Chrome proxy video tests: direct fetch. """ |
| + def __init__(self): |
| + super(VideoDirectPageSet, self).__init__('direct') |
| + |
| + |
| +class VideoProxiedPageSet(VideoPageSet): |
| + """ Chrome proxy video tests: proxied fetch. """ |
| + def __init__(self): |
| + super(VideoProxiedPageSet, self).__init__('proxied') |
| + |
| + |
| +class VideoComparePageSet(VideoPageSet): |
| + """ Chrome proxy video tests: compare direct and proxied fetches. """ |
| + def __init__(self): |
| + super(VideoComparePageSet, self).__init__('compare') |