| Index: tests/watchlists_unittest.py
|
| ===================================================================
|
| --- tests/watchlists_unittest.py (revision 18705)
|
| +++ tests/watchlists_unittest.py (working copy)
|
| @@ -5,6 +5,7 @@
|
|
|
| """Unit tests for watchlists.py."""
|
|
|
| +import os
|
| import unittest
|
| import super_mox
|
| import watchlists
|
| @@ -127,6 +128,32 @@
|
| wl = watchlists.Watchlists('/a/path')
|
| self.assertEqual(wl.GetWatchersForPaths(['file_views_mac']), watchers)
|
|
|
| + def testWinPathWatchers(self):
|
| + """Test watchers for a windows path (containing backward slashes)."""
|
| + watchers = ['abc@def.com', 'x1@xyz.org']
|
| + contents = \
|
| + """{
|
| + 'WATCHLIST_DEFINITIONS': {
|
| + 'browser': {
|
| + 'filepath': 'chrome/browser/.*',
|
| + },
|
| + },
|
| + 'WATCHLISTS': {
|
| + 'browser': %s,
|
| + },
|
| + } """ % watchers
|
| + saved_sep = os.sep
|
| + os.sep = '\\' # to pose as win32
|
| + watchlists.Watchlists._HasWatchlistsFile().AndReturn(True)
|
| + watchlists.Watchlists._ContentsOfWatchlistsFile().AndReturn(contents)
|
| + self.mox.ReplayAll()
|
|
|
| + wl = watchlists.Watchlists(r'a\path')
|
| + returned_watchers = wl.GetWatchersForPaths(
|
| + [r'chrome\browser\renderer_host\render_widget_host.h'])
|
| + os.sep = saved_sep # revert back os.sep before asserts
|
| + self.assertEqual(returned_watchers, watchers)
|
| +
|
| +
|
| if __name__ == '__main__':
|
| unittest.main()
|
|
|