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