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

Unified Diff: media/tools/layout_tests/bug.py

Issue 7693018: Intial checkin of layout test analyzer. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Modified based on CR comments. Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/tools/layout_tests/anno/anno.csv ('k') | media/tools/layout_tests/graph/graph.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/tools/layout_tests/bug.py
diff --git a/media/tools/layout_tests/bug.py b/media/tools/layout_tests/bug.py
new file mode 100644
index 0000000000000000000000000000000000000000..d198b2943b1486f8a292ead8e6c1d371ca470249
--- /dev/null
+++ b/media/tools/layout_tests/bug.py
@@ -0,0 +1,60 @@
+#!/usr/bin/python
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import re
+
+
+class Bug:
+ """A class representing a bug.
+
+ TODO(imasaki): add more functionalities here if bug-tracker API is available.
+ For example, you can get the name of a bug owner.
+ """
+ CHROME_BUG_URL = 'http://crbug.com/'
+ WEBKIT_BUG_URL = 'http://webkit.org/b/'
+ # Type enum for the bug.
+ WEBKIT = 0
+ CHROMIUM = 1
+ OTHERS = 2
+
+ def __init__(self, bug_modifier):
+ """Initialize the object using raw bug text (such as BUGWK2322).
+
+ The bug modifier used in the test expectation file.
+
+ Args:
+ bug_modifier: a string representing a bug modifier. According to
+ http://trac.webkit.org/wiki/TestExpectations#Modifiers,
+ currently, BUGWK12345, BUGCR12345, BUGV8_12345, BUGDPRANKE are
+ possible.
+ """
+ self.bug_txt = bug_modifier
+ pattern_for_webkit_bug = r'BUGWK(\d+)'
+ match = re.search(pattern_for_webkit_bug, bug_modifier)
+ if match:
+ self.type = self.WEBKIT
+ self.url = self.WEBKIT_BUG_URL + match.group(1)
+ return
+ pattern_for_chrome_bug = r'BUGCR(\d+)'
+ match = re.search(pattern_for_chrome_bug, bug_modifier)
+ if match:
+ self.type = self.CHROMIUM
+ self.url = self.CHROME_BUG_URL + match.group(1)
+ return
+ pattern_for_other_bug = r'BUG(\S+)'
+ match = re.search(pattern_for_other_bug, bug_modifier)
+ if match:
+ self.type = self.OTHERS
+ self.url = 'mailto:%s@chromium.org' % match.group(1).lower()
+ return
+ self.url = ''
+
+ def __str__(self):
+ """Get a string representation of a bug object.
+
+ Returns:
+ a string for HTML link representation of a bug.
+ """
+ return '<a href="%s">%s</a>' % (self.url, self.bug_txt)
« no previous file with comments | « media/tools/layout_tests/anno/anno.csv ('k') | media/tools/layout_tests/graph/graph.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698