1 # Copyright (c) 2012 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.
4 from telemetry
.core
import util
5 from telemetry
.page
import page_benchmark
7 class Octane(page_benchmark
.PageBenchmark
):
8 def MeasurePage(self
, _
, tab
, results
):
10 completed && !document.getElementById("progress-bar-container")"""
12 return bool(tab
.EvaluateJavaScript(js_is_done
))
13 util
.WaitFor(_IsDone
, 300, poll_interval
=5)
17 var result_divs = document.querySelectorAll('.p-result');
18 for (var r in result_divs) {
19 if (result_divs[r].id && result_divs[r].id.indexOf('Result-') == 0)
20 var key = result_divs[r].id.replace('Result-', '');
21 results[key] = result_divs[r].innerHTML;
23 var main_banner = document.getElementById("main-banner").innerHTML;
24 var octane_score = main_banner.substr(main_banner.lastIndexOf(':') + 2);
25 results['score'] = octane_score;
26 JSON.stringify(results);
28 result_dict
= eval(tab
.EvaluateJavaScript(js_get_results
))
29 for key
, value
in result_dict
.iteritems():
32 data_type
= 'unimportant'
35 results
.Add(key
, 'score (bigger is better)', value
, data_type
=data_type
)