Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
|
Alexei Svitkine (slow)
2014/02/20 22:50:55
Nit: 2014
yao
2014/02/24 19:16:23
Done.
| |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
|
Ilya Sherman
2014/02/22 07:07:37
nit: Please leave a blank line after this one.
yao
2014/02/24 19:16:23
Done.
| |
| 4 from telemetry import test | 4 """Holds the constants for pretty printing histograms.xml.""" |
|
Ilya Sherman
2014/02/22 07:07:37
Ditto.
yao
2014/02/24 19:16:23
Done.
| |
| 5 import os | |
| 6 import sys | |
| 5 | 7 |
| 6 from measurements import rasterize_and_record | 8 # Import the metrics/common module for pretty print xml. |
| 9 sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common')) | |
| 10 import pretty_print_xml | |
| 11 | |
| 12 # Desired order for tag attributes; attributes listed here will appear first, | |
| 13 # and in the same order as in these lists. | |
| 14 # { tag_name: [attribute_name, ...] } | |
| 15 ATTRIBUTE_ORDER = { | |
| 16 'enum': ['name', 'type'], | |
| 17 'histogram': ['name', 'enum', 'units'], | |
| 18 'int': ['value', 'label'], | |
| 19 'fieldtrial': ['name', 'separator', 'ordering'], | |
| 20 'group': ['name', 'label'], | |
| 21 'affected-histogram': ['name'], | |
| 22 'with-group': ['name'], | |
| 23 } | |
| 24 | |
| 25 # Tag names for top-level nodes whose children we don't want to indent. | |
| 26 TAGS_THAT_DONT_INDENT = [ | |
| 27 'histogram-configuration', | |
| 28 'histograms', | |
| 29 'fieldtrials', | |
| 30 'enums' | |
| 31 ] | |
| 32 | |
| 33 # Extra vertical spacing rules for special tag names. | |
| 34 # {tag_name: (newlines_after_open, newlines_before_close, newlines_after_close)} | |
| 35 TAGS_THAT_HAVE_EXTRA_NEWLINE = { | |
| 36 'histogram-configuration': (2, 1, 1), | |
| 37 'histograms': (2, 1, 1), | |
| 38 'fieldtrials': (2, 1, 1), | |
| 39 'enums': (2, 1, 1), | |
| 40 'histogram': (1, 1, 1), | |
| 41 'enum': (1, 1, 1), | |
| 42 'fieldtrial': (1, 1, 1), | |
| 43 } | |
| 44 | |
| 45 # Tags that we allow to be squished into a single line for brevity. | |
| 46 TAGS_THAT_ALLOW_SINGLE_LINE = [ | |
| 47 'summary', | |
| 48 'int', | |
| 49 ] | |
| 7 | 50 |
| 8 | 51 |
| 9 class RasterizeAndRecordTop25(test.Test): | 52 def GetPrintStyle(): |
| 10 """Measures rasterize and record performance on the top 25 web pages. | 53 """Returns an XmlStyle object for pretty printing histograms.""" |
| 11 | 54 return pretty_print_xml.XmlStyle(ATTRIBUTE_ORDER, |
| 12 http://www.chromium.org/developers/design-documents/rendering-benchmarks""" | 55 TAGS_THAT_HAVE_EXTRA_NEWLINE, |
| 13 test = rasterize_and_record.RasterizeAndRecord | 56 TAGS_THAT_DONT_INDENT, |
| 14 page_set = 'page_sets/top_25.json' | 57 TAGS_THAT_ALLOW_SINGLE_LINE) |
| 15 | |
| 16 | |
| 17 class RasterizeAndRecordKeyMobileSites(test.Test): | |
| 18 """Measures rasterize and record performance on the key mobile sites. | |
| 19 | |
| 20 http://www.chromium.org/developers/design-documents/rendering-benchmarks""" | |
| 21 test = rasterize_and_record.RasterizeAndRecord | |
| 22 page_set = 'page_sets/key_mobile_sites.json' | |
| 23 | |
| 24 | |
| 25 class RasterizeAndRecordSilk(test.Test): | |
| 26 """Measures rasterize and record performance on the silk sites. | |
| 27 | |
| 28 http://www.chromium.org/developers/design-documents/rendering-benchmarks""" | |
| 29 test = rasterize_and_record.RasterizeAndRecord | |
| 30 page_set = 'page_sets/key_silk_cases.json' | |
| OLD | NEW |