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

Unified Diff: tests/watchlists_unittest.py

Issue 132022: Fix watchlists for windows, for files with backslash (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 11 years, 6 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 | « no previous file | watchlists.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « no previous file | watchlists.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698