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

Unified Diff: grit/tool/build_unittest.py

Issue 766263004: Test for r183. gcl didn't land it, for some reason. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 6 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/tool/build_unittest.py
===================================================================
--- grit/tool/build_unittest.py (revision 183)
+++ grit/tool/build_unittest.py (working copy)
@@ -245,6 +245,34 @@
non_whitelisted_ids,
)
+ def testWriteOnlyNew(self):
+ output_dir = tempfile.mkdtemp()
+ builder = build.RcBuilder()
+ class DummyOpts(object):
+ def __init__(self):
+ self.input = util.PathFromRoot('grit/testdata/substitute.grd')
+ self.verbose = False
+ self.extra_verbose = False
+ UNCHANGED = 10
+ header = os.path.join(output_dir, 'resource.h')
+ builder.Run(DummyOpts(), ['-o', output_dir])
+ self.failUnless(os.path.exists(header))
+ first_mtime = os.stat(header).st_mtime
+
+ os.utime(header, (UNCHANGED, UNCHANGED))
+ builder.Run(DummyOpts(), ['-o', output_dir, '--write-only-new', '0'])
+ self.failUnless(os.path.exists(header))
+ second_mtime = os.stat(header).st_mtime
+
+ os.utime(header, (UNCHANGED, UNCHANGED))
+ builder.Run(DummyOpts(), ['-o', output_dir, '--write-only-new', '1'])
+ self.failUnless(os.path.exists(header))
+ third_mtime = os.stat(header).st_mtime
+
+ self.assertTrue(abs(second_mtime - UNCHANGED) > 5)
+ self.assertTrue(abs(third_mtime - UNCHANGED) < 5)
+
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698