1 # Copyright 2014 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.
5 from telemetry
.page
import page
as page_module
6 from telemetry
import story
9 class BlockOncePage(page_module
.Page
):
11 def __init__(self
, url
, page_set
):
12 super(BlockOncePage
, self
).__init
__(url
=url
, page_set
=page_set
)
14 def RunNavigateSteps(self
, action_runner
):
15 super(BlockOncePage
, self
).RunNavigateSteps(action_runner
)
16 # Test block-once on a POST request.
17 # Ensure that a subsequent request uses the data reduction proxy.
18 action_runner
.ExecuteJavaScript('''
20 var request = new XMLHttpRequest();
22 "http://chromeproxy-test.appspot.com/default?respBody=T0s=&respStatus=200&flywheelAction=block-once");
23 request.onload = function() {
24 var viaProxyRequest = new XMLHttpRequest();
25 viaProxyRequest.open("GET",
26 "http://check.googlezip.net/image.png");
27 viaProxyRequest.send();
34 class BlockOnceStorySet(story
.StorySet
):
36 """ Chrome proxy test sites """
39 super(BlockOnceStorySet
, self
).__init
__()
41 # Test block-once for a GET request.
43 'http://check.googlezip.net/blocksingle/',
47 self
.AddStory(BlockOncePage(url
, self
))