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. 4 5"""Apple's Speedometer performance benchmark. 6 7Speedometer measures simulated user interactions in web applications. 8 9The current benchmark uses TodoMVC to simulate user actions for adding, 10completing, and removing to-do items. Speedometer repeats the same actions using 11DOM APIs - a core set of web platform APIs used extensively in web applications- 12as well as six popular JavaScript frameworks: Ember.js, Backbone.js, jQuery, 13AngularJS, React, and Flight. Many of these frameworks are used on the most 14popular websites in the world, such as Facebook and Twitter. The performance of 15these types of operations depends on the speed of the DOM APIs, the JavaScript 16engine, CSS style resolution, layout, and other technologies. 17""" 18 19import os 20 21from telemetry import test 22from telemetry.page import page_measurement 23from telemetry.page import page_set 24 25 26class SpeedometerMeasurement(page_measurement.PageMeasurement): 27 28 def MeasurePage(self, _, tab, results): 29 tab.WaitForDocumentReadyStateToBeComplete() 30 tab.ExecuteJavaScript('benchmarkClient.iterationCount = 10; startTest();') 31 tab.WaitForJavaScriptExpression( 32 'benchmarkClient._finishedTestCount == benchmarkClient.testsCount', 600) 33 results.Add( 34 'Total', 'ms', tab.EvaluateJavaScript('benchmarkClient._timeValues')) 35 36 37@test.Disabled('android') # Times out 38class Speedometer(test.Test): 39 test = SpeedometerMeasurement 40 41 def CreatePageSet(self, options): 42 ps = page_set.PageSet( 43 file_path=os.path.abspath(__file__), 44 archive_data_file='../page_sets/data/speedometer.json', 45 make_javascript_deterministic=False) 46 ps.AddPageWithDefaultRunNavigate('http://browserbench.org/Speedometer/') 47 return ps 48