| 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 class PassThroughPage(page_module.Page): | 8 class PassThroughPage(page_module.Page): |
| 9 """ | 9 """ |
| 10 A test page for the chrome proxy pass-through tests. | 10 A test page for the chrome proxy pass-through tests. |
| 11 """ | 11 """ |
| 12 | 12 |
| 13 def __init__(self, url, page_set): | 13 def __init__(self, url, page_set): |
| 14 super(PassThroughPage, self).__init__(url=url, page_set=page_set) | 14 super(PassThroughPage, self).__init__(url=url, page_set=page_set) |
| 15 | 15 |
| 16 def RunNavigateSteps(self, action_runner): | 16 def RunNavigateSteps(self, action_runner): |
| 17 super(PassThroughPage, self).RunNavigateSteps(action_runner) | 17 super(PassThroughPage, self).RunNavigateSteps(action_runner) |
| 18 action_runner.ExecuteJavaScript(''' | 18 action_runner.ExecuteJavaScript(''' |
| 19 (function() { | 19 (function() { |
| 20 var request = new XMLHttpRequest(); | 20 var request = new XMLHttpRequest(); |
| 21 request.open("GET", "%s"); | 21 request.open("GET", "%s"); |
| 22 request.setRequestHeader("Chrome-Proxy", "pass-through"); | 22 request.setRequestHeader("Chrome-Proxy", "pass-through"); |
| 23 request.send(null); | 23 request.send(null); |
| 24 })();''' % (self.url)) | 24 })();''' % (self.url)) |
| 25 action_runner.Wait(1) | 25 action_runner.Wait(1) |
| 26 | 26 |
| 27 | 27 |
| 28 class PassThroughPageSet(page_set_module.PageSet): | 28 class PassThroughStorySet(story.StorySet): |
| 29 """ Chrome proxy test sites """ | 29 """ Chrome proxy test sites """ |
| 30 | 30 |
| 31 def __init__(self): | 31 def __init__(self): |
| 32 super(PassThroughPageSet, self).__init__() | 32 super(PassThroughStorySet, self).__init__() |
| 33 | 33 |
| 34 urls_list = [ | 34 urls_list = [ |
| 35 'http://check.googlezip.net/image.png', | 35 'http://check.googlezip.net/image.png', |
| 36 ] | 36 ] |
| 37 | 37 |
| 38 for url in urls_list: | 38 for url in urls_list: |
| 39 self.AddUserStory(PassThroughPage(url, self)) | 39 self.AddStory(PassThroughPage(url, self)) |
| OLD | NEW |