deps2git: Improve support for WebRTC and its deps.

* Remove old unused WebRTC URLs (stable branch was removed
  about a year ago).
* Make the WebRTC matching more generic, so it can match both
  trunk and deps. This will add support for:
  - deps/third_party/junit 
  - deps/third_party/openmax  
  - deps/third_party/winsdk_samples_v71
  and thus the special case for openmax can be removed.

BUG=419516
TESTED=Passing build with:
scripts/tools/run_recipe.py webrtc/standalone buildername="Linux64 Debug" mastername=client.webrtc slavename=x revision='"7414"' use_mirror=True
when combined with https://codereview.chromium.org/472963003/

Review URL: https://codereview.chromium.org/627493002

git-svn-id: http://src.chromium.org/svn/trunk/tools/deps2git@292399 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
diff --git a/svn_to_git_public.py b/svn_to_git_public.py
index c3a0b3a..58d02ac 100755
--- a/svn_to_git_public.py
+++ b/svn_to_git_public.py
@@ -61,33 +61,11 @@
   if svn_url == '/trunk/deps/cdm':
     return (path, GIT_HOST + 'chromium/cdm.git', GIT_HOST)
 
-  # TODO(niklase) Remove after landing https://codereview.chromium.org/86563002
-  if re.match('^https?://webrtc.googlecode.com/svn/stable/webrtc$', svn_url):
-    return (path, GIT_HOST + 'external/webrtc/stable/webrtc.git', GIT_HOST)
-
-  # TODO(niklase) Remove after landing https://codereview.chromium.org/86563002
-  if re.match('^https?://webrtc.googlecode.com/svn/stable/talk$', svn_url):
-    return (path, GIT_HOST + 'external/webrtc/stable/talk.git', GIT_HOST)
-
-  # TODO(niklase) Remove after landing https://codereview.chromium.org/86563002
-  if re.match('^https?://webrtc.googlecode.com/svn/stable/src$', svn_url):
-    return (path, GIT_HOST + 'external/webrtc/stable/src.git', GIT_HOST)
-
-  # webrtc 'trunk/src' mirror was created without 'trunk' in the name, unlike
-  # the other ones which are matched next.
-  match = re.match('^https?://webrtc.googlecode.com/svn/trunk/src', svn_url)
+  match = re.match('^https?://webrtc.googlecode.com/svn/(deps|trunk)/(.*)',
+                   svn_url)
   if match:
-    return (path, GIT_HOST + 'external/webrtc/src.git', GIT_HOST)
-
-  # webrtc 'trunk' mappings for everything but 'trunk/src'.
-  match = re.match('^https?://webrtc.googlecode.com/svn/trunk/(.*)', svn_url)
-  if match:
-    repo = '%s.git' % match.group(1)
-    return (path, GIT_HOST + 'external/webrtc/trunk/%s' % repo, GIT_HOST)
-
-  if re.match('^https?://webrtc.googlecode.com/svn/deps/third_party/openmax$',
-              svn_url):
-    return (path, GIT_HOST + 'external/webrtc/deps/third_party/openmax.git',
+    repo = '%s.git' % match.group(2)
+    return (path, GIT_HOST + 'external/webrtc/%s/%s' % (match.group(1), repo),
             GIT_HOST)
 
   if svn_url in ('http://selenium.googlecode.com/svn/trunk/py/test',
diff --git a/svn_to_git_public_unittest.py b/svn_to_git_public_unittest.py
new file mode 100755
index 0000000..338ab67
--- /dev/null
+++ b/svn_to_git_public_unittest.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+# Copyright 2014 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 unittest
+
+import svn_to_git_public
+
+
+class SvnUrlToGitUrlTest(unittest.TestCase):
+  def testWebRtcUrls(self):
+    expected = {
+      'deps/third_party/foo': 'external/webrtc/deps/third_party/foo',
+      'trunk': 'external/webrtc',
+      'trunk/bar': 'external/webrtc/trunk/bar',
+    }
+    svn_base_url = 'https://webrtc.googlecode.com/svn'
+
+    path = 'just/some/path'
+    for k, v in expected.iteritems():
+      res = svn_to_git_public.SvnUrlToGitUrl(path, '%s/%s' % (svn_base_url, k))
+      self.assertEqual(res[0], path)
+      self.assertEqual(res[1], '%s%s.git' % (svn_to_git_public.GIT_HOST, v))
+
+if __name__ == '__main__':
+  unittest.main()