1# Copyright 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 5"""Runs Facebook's JSGameBench benchmark. 6 7As of May 14, 2014, JSGameBench is no longer maintained. See README.md: 8https://github.com/facebookarchive/jsgamebench 9 10The benchmark is kept here for historical purposes but is disabled on the bots. 11""" 12 13import os 14 15from telemetry import benchmark 16from telemetry.page import page_set 17from telemetry.page import page_test 18from telemetry.value import scalar 19 20 21class _JsgamebenchMeasurement(page_test.PageTest): 22 def __init__(self): 23 super(_JsgamebenchMeasurement, self).__init__() 24 25 def ValidateAndMeasurePage(self, page, tab, results): 26 tab.ExecuteJavaScript('UI.call({}, "perftest")') 27 tab.WaitForJavaScriptExpression( 28 'document.getElementById("perfscore0") != null', 1800) 29 30 js_get_results = 'document.getElementById("perfscore0").innerHTML' 31 result = int(tab.EvaluateJavaScript(js_get_results)) 32 results.AddValue(scalar.ScalarValue( 33 results.current_page, 'Score', 'score (bigger is better)', result)) 34 35 36@benchmark.Disabled 37class Jsgamebench(benchmark.Benchmark): 38 """Counts how many animating sprites can move around on the screen at once.""" 39 test = _JsgamebenchMeasurement 40 41 def CreatePageSet(self, options): 42 ps = page_set.PageSet( 43 archive_data_file='../page_sets/data/jsgamebench.json', 44 file_path=os.path.dirname(__file__)) 45 ps.AddPageWithDefaultRunNavigate('http://localhost/') 46 return ps 47