Chromium Code Reviews| Index: grit/tool/build_unittest.py |
| =================================================================== |
| --- grit/tool/build_unittest.py (revision 182) |
| +++ grit/tool/build_unittest.py (working copy) |
| @@ -245,6 +245,35 @@ |
| 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(second_mtime - first_mtime) < 5) |
|
newt (away)
2014/12/04 22:45:22
What's the purpose of this line? It seems only to
Nico
2014/12/04 22:47:49
Yeah, I guess it's not very different from the lin
|
| + self.assertTrue(abs(third_mtime - UNCHANGED) < 5) |
| + |
| + |
| if __name__ == '__main__': |
| unittest.main() |