OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import tempfile | 5 import tempfile |
6 import unittest | 6 import unittest |
7 | 7 |
8 import md5_check | 8 import md5_check |
9 | 9 |
10 | 10 |
11 class TestMd5Check(unittest.TestCase): | 11 class TestMd5Check(unittest.TestCase): |
12 def __init__(self): | |
13 super(TestMd5Check, self).__init__() | |
14 self.called = False | |
15 | |
16 def testCallAndRecordIfStale(self): | 12 def testCallAndRecordIfStale(self): |
17 input_strings = ['string1', 'string2'] | 13 input_strings = ['string1', 'string2'] |
18 input_file1 = tempfile.NamedTemporaryFile() | 14 input_file1 = tempfile.NamedTemporaryFile() |
19 input_file2 = tempfile.NamedTemporaryFile() | 15 input_file2 = tempfile.NamedTemporaryFile() |
20 file1_contents = 'input file 1' | 16 file1_contents = 'input file 1' |
21 file2_contents = 'input file 2' | 17 file2_contents = 'input file 2' |
22 input_file1.write(file1_contents) | 18 input_file1.write(file1_contents) |
23 input_file1.flush() | 19 input_file1.flush() |
24 input_file2.write(file2_contents) | 20 input_file2.write(file2_contents) |
25 input_file2.flush() | 21 input_file2.flush() |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 60 |
65 input_strings = input_strings[:1] | 61 input_strings = input_strings[:1] |
66 CheckCallAndRecord(True, 'removing a string should trigger call') | 62 CheckCallAndRecord(True, 'removing a string should trigger call') |
67 | 63 |
68 input_strings.append('a brand new string') | 64 input_strings.append('a brand new string') |
69 CheckCallAndRecord(True, 'added input string should trigger call') | 65 CheckCallAndRecord(True, 'added input string should trigger call') |
70 | 66 |
71 | 67 |
72 if __name__ == '__main__': | 68 if __name__ == '__main__': |
73 unittest.main() | 69 unittest.main() |
OLD | NEW |