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

Unified Diff: tools/metrics/actions/extract_actions_test.py

Issue 848453002: Improve script to find user actions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
Index: tools/metrics/actions/extract_actions_test.py
diff --git a/tools/metrics/actions/extract_actions_test.py b/tools/metrics/actions/extract_actions_test.py
index a5cfd387717a1b2498ebdc099c991e5e0d8611be..e52cc51b24b9ac7739ab44979b695d3a746c87c6 100755
--- a/tools/metrics/actions/extract_actions_test.py
+++ b/tools/metrics/actions/extract_actions_test.py
@@ -114,7 +114,6 @@ COMMENT_EXPECTED_XML = (
'</actions>\n'
)
-
class ActionXmlTest(unittest.TestCase):
def _GetProcessedAction(self, owner, description, obsolete, new_actions=[],
@@ -194,6 +193,15 @@ class ActionXmlTest(unittest.TestCase):
comment=COMMENT)
self.assertEqual(COMMENT_EXPECTED_XML, xml_result)
+ def testUserMetricsActionSpanningTwoLines(self):
+ code = 'base::UserMetricsAction(\n"Foo.Bar"));'
+ names, _ = extract_actions.FindActionNames(code, 0)
+ self.assertEqual(['Foo.Bar'], names)
+
+ def testTernaryUserMetricsAction(self):
+ code = 'base::UserMetricsAction(foo ? "Foo.Bar" : "Bar.Foo"));'
Ilya Sherman 2015/01/09 22:25:44 I'm not convinced that we want to support this. I
Alexei Svitkine (slow) 2015/01/12 19:58:24 We could do that. The disadvantage is we'll need t
+ names, _ = extract_actions.FindActionNames(code, 0)
+ self.assertEqual(['Foo.Bar', 'Bar.Foo'], names)
if __name__ == '__main__':
unittest.main()
« tools/metrics/actions/extract_actions.py ('K') | « tools/metrics/actions/extract_actions.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698