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.
6 from telemetry
import benchmark
7 from telemetry
.page
import page_test
8 from telemetry
.value
import scalar
11 class _ServiceWorkerMeasurement(page_test
.PageTest
):
12 def CustomizeBrowserOptions(self
, options
):
13 options
.AppendExtraBrowserArgs([
14 '--enable-experimental-web-platform-features'
17 def ValidateAndMeasurePage(self
, _
, tab
, results
):
18 tab
.WaitForJavaScriptExpression('window.done', 40)
19 json
= tab
.EvaluateJavaScript('window.results')
20 for key
, value
in json
.iteritems():
21 results
.AddValue(scalar
.ScalarValue(
22 results
.current_page
, key
, value
['units'], value
['value']))
26 class ServiceWorkerPerfTest(benchmark
.Benchmark
):
27 test
= _ServiceWorkerMeasurement
28 page_set
= page_sets
.ServiceWorkerPageSet