Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(711)

Side by Side Diff: media/tools/layout_tests/trend_graph.py

Issue 9476021: Updating Layout test analyzer to add control to show issue detail or not. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
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.
4 4
5 """A module for manipulating trend graph with analyzer result history.""" 5 """A module for manipulating trend graph with analyzer result history."""
6 6
7 import os 7 import os
8 import sys
9 8
10 import layouttest_analyzer_helpers 9 import layouttest_analyzer_helpers
11 10
12 DEFAULT_TREND_GRAPH_PATH = os.path.join('graph', 'graph.html') 11 DEFAULT_TREND_GRAPH_PATH = os.path.join('graph', 'graph.html')
13 12
14 # The following is necesasry to decide the point to insert. 13 # The following is necesasry to decide the point to insert.
15 LINE_INSERT_POINT_FOR_NUMBERS = r'// insert 1' 14 LINE_INSERT_POINT_FOR_NUMBERS = r'// insert 1'
16 LINE_INSERT_POINT_FOR_PASSING_RATE = r'// insert 2' 15 LINE_INSERT_POINT_FOR_PASSING_RATE = r'// insert 2'
17 16
18 17
19 class TrendGraph(object): 18 class TrendGraph:
dennis_jeffrey 2012/02/29 17:50:32 curious: why did you remove the "(object)" from he
imasaki1 2012/03/02 19:12:07 Mistake. I bring it back
20 """A class to manage trend graph which is using Google Visualization APIs. 19 """A class to manage trend graph which is using Google Visualization APIs.
21 20
22 Google Visualization API (http://code.google.com/apis/chart/interactive/docs/ 21 Google Visualization API (http://code.google.com/apis/chart/interactive/docs/
23 gallery/annotatedtimeline.html) is used to present the historical analyzer 22 gallery/annotatedtimeline.html) is used to present the historical analyzer
24 result. Currently, data is directly written to JavaScript file using file 23 result. Currently, data is directly written to JavaScript file using file
25 in-place replacement for simplicity. 24 in-place replacement for simplicity.
26 25
27 TODO(imasaki): use GoogleSpreadsheet to store the analyzer result. 26 TODO(imasaki): use GoogleSpreadsheet to store the analyzer result.
28 """ 27 """
29 28
(...skipping 15 matching lines...) Expand all
45 'passingrate' as its keys and (number, tile, text) string tuples 44 'passingrate' as its keys and (number, tile, text) string tuples
46 as values for graph annotation. 45 as values for graph annotation.
47 """ 46 """
48 joined_str = '' 47 joined_str = ''
49 # For a date format in GViz, month is shifted (e.g., '2008,2,1' means 48 # For a date format in GViz, month is shifted (e.g., '2008,2,1' means
50 # March 1, 2008). So, the input parameter |datetime_string| (before this 49 # March 1, 2008). So, the input parameter |datetime_string| (before this
51 # conversion) must be shifted in order to show the date properly on GViz. 50 # conversion) must be shifted in order to show the date properly on GViz.
52 # After the below conversion, for example, in the case of the year 2008, 51 # After the below conversion, for example, in the case of the year 2008,
53 # |datetime_string| ranges from '2008,0,1,0,0,00' to '2008,11,31,23,59,99'. 52 # |datetime_string| ranges from '2008,0,1,0,0,00' to '2008,11,31,23,59,99'.
54 str_list = datetime_string.split(',') 53 str_list = datetime_string.split(',')
55 str_list[1] = str(int(str_list[1])-1) # month 54 str_list[1] = str(int(str_list[1])-1) # Month
56 datetime_string = ','.join(str_list) 55 datetime_string = ','.join(str_list)
57 for key in ['whole', 'skip', 'nonskip']: 56 for key in ['whole', 'skip', 'nonskip']:
58 joined_str += str(len(data_map[key][0])) + ',' 57 joined_str += str(len(data_map[key][0])) + ','
59 joined_str += ','.join(data_map[key][1:]) + ',' 58 joined_str += ','.join(data_map[key][1:]) + ','
60 new_line_for_numbers = ' [new Date(%s),%s],\n' % (datetime_string, 59 new_line_for_numbers = ' [new Date(%s),%s],\n' % (datetime_string,
61 joined_str) 60 joined_str)
62 new_line_for_numbers += ' %s\n' % ( 61 new_line_for_numbers += ' %s\n' % (
63 LINE_INSERT_POINT_FOR_NUMBERS) 62 LINE_INSERT_POINT_FOR_NUMBERS)
64 layouttest_analyzer_helpers.ReplaceLineInFile( 63 layouttest_analyzer_helpers.ReplaceLineInFile(
65 self._location, LINE_INSERT_POINT_FOR_NUMBERS, 64 self._location, LINE_INSERT_POINT_FOR_NUMBERS,
66 new_line_for_numbers) 65 new_line_for_numbers)
67 66
68 joined_str = '%s,%s,%s' % ( 67 joined_str = '%s,%s,%s' % (
69 str(data_map['passingrate'][0]), data_map['nonskip'][1], 68 str(data_map['passingrate'][0]), data_map['nonskip'][1],
70 data_map['nonskip'][2]) 69 data_map['nonskip'][2])
71 new_line_for_passingrate = ' [new Date(%s),%s],\n' % ( 70 new_line_for_passingrate = ' [new Date(%s),%s],\n' % (
72 datetime_string, joined_str) 71 datetime_string, joined_str)
73 new_line_for_passingrate += ' %s\n' % ( 72 new_line_for_passingrate += ' %s\n' % (
74 LINE_INSERT_POINT_FOR_PASSING_RATE) 73 LINE_INSERT_POINT_FOR_PASSING_RATE)
75 layouttest_analyzer_helpers.ReplaceLineInFile( 74 layouttest_analyzer_helpers.ReplaceLineInFile(
76 self._location, LINE_INSERT_POINT_FOR_PASSING_RATE, 75 self._location, LINE_INSERT_POINT_FOR_PASSING_RATE,
77 new_line_for_passingrate) 76 new_line_for_passingrate)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698