Add telemetry page set for tough ad cases
[chromium-blink-merge.git] / tools / perf / page_sets / tough_ad_cases.py
bloba691515b1c26420f868ed7ff1370a8293b7d89c7
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.
5 from telemetry.page import page as page_module
6 from telemetry.page import page_set as page_set_module
9 class SwiffyPage(page_module.Page):
11 def __init__(self, url, page_set):
12 super(SwiffyPage, self).__init__(url=url, page_set=page_set)
14 def RunNavigateSteps(self, action_runner):
15 super(SwiffyPage, self).RunNavigateSteps(action_runner)
16 # Swiffy overwrites toString() to return a constant string, so "undo" that
17 # here so that we don't think it has stomped over console.time.
18 action_runner.EvaluateJavaScript(
19 'Function.prototype.toString = function() { return "[native code]"; }')
20 # Make sure we have a reasonable viewport for mobile.
21 viewport_js = (
22 'var meta = document.createElement("meta");'
23 'meta.name = "viewport";'
24 'meta.content = "width=device-width";'
25 'document.getElementsByTagName("head")[0].appendChild(meta);')
26 action_runner.EvaluateJavaScript(viewport_js)
28 def RunPageInteractions(self, action_runner):
29 with action_runner.CreateInteraction('ToughAd'):
30 action_runner.Wait(10)
33 class ToughAdCasesPageSet(page_set_module.PageSet):
34 """Pages for measuring performance with advertising content."""
36 def __init__(self):
37 super(ToughAdCasesPageSet, self).__init__(
38 archive_data_file='data/tough_ad_cases.json',
39 bucket=page_set_module.INTERNAL_BUCKET)
41 base_url = 'http://localhost:8000'
43 # See go/swiffy-chrome-samples for how to add new pages here or how to
44 # update the existing ones.
45 swiffy_pages = [
46 'CICAgICQ15a9NxDIARjIASgBMghBC1XuTk8ezw.swiffy72.html',
47 'shapes-CK7ptO3F8bi2KxDQAhiYAigBMgij6QBQtD2gyA.swiffy72.html',
48 'CNP2xe_LmqPEKBCsAhj6ASgBMggnyMqth81h8Q.swiffy72.html',
49 'clip-paths-CICAgMDO7Ye9-gEQ2AUYWigBMgjZxDii6aoK9w.swiffy72.html',
50 'filters-CNLa0t2T47qJ_wEQoAEY2AQoATIIFaIdc7VMBr4.swiffy72.html',
51 'shapes-CICAgMDO7cfIzwEQ1AMYPCgBMghqY8tqyRCArQ.swiffy72.html',
52 'CICAgIDQ2Pb-MxCsAhj6ASgBMgi5DLoSO0gPbQ.swiffy72.html',
53 'CICAgKCN39CopQEQoAEY2AQoATIID59gK5hjjIg.swiffy72.html',
54 'CICAgKCNj4HgyAEQeBjYBCgBMgjQpPkOjyWNdw.1.swiffy72.html',
55 'clip-paths-CILZhLqO_-27bxB4GNgEKAEyCC46kMLBXnMT.swiffy72.html',
56 'CICAgMDOrcnRGRB4GNgEKAEyCP_ZBSfwUFsj.swiffy72.html',
58 for page_name in swiffy_pages:
59 url = base_url + '/' + page_name
60 self.AddUserStory(SwiffyPage(url, self))