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.
5 from telemetry
.core
import util
6 from telemetry
.page
import page_benchmark
8 class JsGameBench(page_benchmark
.PageBenchmark
):
9 def MeasurePage(self
, _
, tab
, results
):
10 tab
.ExecuteJavaScript('UI.call({}, "perftest")')
12 js_is_done
= 'document.getElementById("perfscore0") != null'
14 return bool(tab
.EvaluateJavaScript(js_is_done
))
15 util
.WaitFor(_IsDone
, 1200)
17 js_get_results
= 'document.getElementById("perfscore0").innerHTML'
18 result
= int(tab
.EvaluateJavaScript(js_get_results
))
19 results
.Add('Score', 'score (bigger is better)', result
)