def test_jar_paths(self): app_name = buildconfig.substs.get('MOZ_APP_NAME') omnijar_name = buildconfig.substs.get('OMNIJAR_NAME') paths = [ ('jar:file:///home/worker/workspace/build/application/' + app_name + '/' + omnijar_name + '!/components/MainProcessSingleton.js', 'path1'), ('jar:file:///home/worker/workspace/build/application/' + app_name + '/browser/' + omnijar_name + '!/components/nsSessionStartup.js', 'path2'), ('jar:file:///home/worker/workspace/build/application/' + app_name + '/browser/features/[email protected]!/bootstrap.js', 'path3'), ('jar:file:///home/worker/workspace/build/application/' + app_name + '/browser/features/[email protected]!/bootstrap.js', 'path4'), ('jar:file:///tmp/tmpMdo5gV.mozrunner/extensions/[email protected]!/bootstrap.js', 'path5'), ] url_finder = lcov_rewriter.UrlFinder('', '', []) for path, expected in paths: self.assertEqual(url_finder.rewrite_url(path)[0], expected)
def test_chrome_resource_paths(self): paths = [ # Path with default url prefix ('resource://gre/modules/osfile/osfile_async_worker.js', ('toolkit/components/osfile/modules/osfile_async_worker.js', None)), # Path with url prefix that is in chrome map ('resource://activity-stream/lib/PrefsFeed.jsm', ('browser/components/newtab/lib/PrefsFeed.jsm', None)), # Path which is in url overrides ('chrome://global/content/netError.xhtml', ('browser/base/content/aboutNetError.xhtml', None)), # Path which ends with > eval ('resource://gre/modules/osfile/osfile_async_worker.js line 3 > eval', None), # Path which ends with > Function ('resource://gre/modules/osfile/osfile_async_worker.js line 3 > Function', None), # Path which contains "->" ('resource://gre/modules/addons/XPIProvider.jsm -> resource://gre/modules/osfile/osfile_async_worker.js', # noqa ('toolkit/components/osfile/modules/osfile_async_worker.js', None)), # Path with pp_info ('resource://gre/modules/AppConstants.jsm', ('toolkit/modules/AppConstants.jsm', { '101,102': [ 'toolkit/modules/AppConstants.jsm', 135 ], })), # Path with query ('resource://activity-stream/lib/PrefsFeed.jsm?q=0.9098419174803978', ('browser/components/newtab/lib/PrefsFeed.jsm', None)), ] url_finder = lcov_rewriter.UrlFinder(self._chrome_map_file, '', 'dist/bin/', []) for path, expected in paths: self.assertEqual(url_finder.rewrite_url(path), expected)
def test_wrong_scheme_paths(self): paths = [ "http://www.mozilla.org/aFile.js", "https://www.mozilla.org/aFile.js", "data:something", "about:newtab", "javascript:something", ] url_finder = lcov_rewriter.UrlFinder(self._chrome_map_file, "", "", []) for path in paths: self.assertIsNone(url_finder.rewrite_url(path))
def test_chrome_resource_paths(self): paths = [ # Path with default url prefix ( "resource://gre/modules/osfile/osfile_async_worker.js", ("toolkit/components/osfile/modules/osfile_async_worker.js", None), ), # Path with url prefix that is in chrome map ( "resource://activity-stream/lib/PrefsFeed.jsm", ("browser/components/newtab/lib/PrefsFeed.jsm", None), ), # Path which is in url overrides ( "chrome://global/content/netError.xhtml", ("browser/base/content/certerror/aboutNetError.xhtml", None), ), # Path which ends with > eval ( "resource://gre/modules/osfile/osfile_async_worker.js line 3 > eval", None, ), # Path which ends with > Function ( "resource://gre/modules/osfile/osfile_async_worker.js line 3 > Function", None, ), # Path which contains "->" ( "resource://gre/modules/addons/XPIProvider.jsm -> resource://gre/modules/osfile/osfile_async_worker.js", # noqa ("toolkit/components/osfile/modules/osfile_async_worker.js", None), ), # Path with pp_info ( "resource://gre/modules/AppConstants.jsm", ( "toolkit/modules/AppConstants.jsm", { "101,102": ["toolkit/modules/AppConstants.jsm", 135], }, ), ), # Path with query ( "resource://activity-stream/lib/PrefsFeed.jsm?q=0.9098419174803978", ("browser/components/newtab/lib/PrefsFeed.jsm", None), ), ] url_finder = lcov_rewriter.UrlFinder(self._chrome_map_file, "", "dist/bin/", []) for path, expected in paths: self.assertEqual(url_finder.rewrite_url(path), expected)
def test_jar_paths(self): app_name = BUILDCONFIG['MOZ_APP_NAME'] omnijar_name = BUILDCONFIG['OMNIJAR_NAME'] paths = [ ('jar:file:///home/worker/workspace/build/application/' + app_name + '/' + omnijar_name + '!/components/MainProcessSingleton.js', 'path1'), ('jar:file:///home/worker/workspace/build/application/' + app_name + '/browser/features/[email protected]!/bootstrap.js', 'path4'), ] url_finder = lcov_rewriter.UrlFinder(self._chrome_map_file, '', '', []) for path, expected in paths: self.assertEqual(url_finder.rewrite_url(path)[0], expected)
def test_wrong_scheme_paths(self): app_name = buildconfig.substs.get('MOZ_APP_NAME') omnijar_name = buildconfig.substs.get('OMNIJAR_NAME') paths = [ 'http://www.mozilla.org/aFile.js', 'https://www.mozilla.org/aFile.js', 'data:something', 'about:newtab', 'javascript:something', ] url_finder = lcov_rewriter.UrlFinder(self._chrome_map_file, '', '', []) for path in paths: self.assertIsNone(url_finder.rewrite_url(path))