OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import cStringIO | 6 import cStringIO |
7 import hashlib | 7 import hashlib |
8 import json | 8 import json |
9 import logging | 9 import logging |
10 import os | 10 import os |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 [sys.executable, os.path.join(ROOT_DIR, 'isolate.py'), '--help'], | 216 [sys.executable, os.path.join(ROOT_DIR, 'isolate.py'), '--help'], |
217 stdout=subprocess.PIPE, | 217 stdout=subprocess.PIPE, |
218 stderr=subprocess.STDOUT, | 218 stderr=subprocess.STDOUT, |
219 cwd=ROOT_DIR) | 219 cwd=ROOT_DIR) |
220 out = p.communicate()[0].splitlines() | 220 out = p.communicate()[0].splitlines() |
221 self.assertEquals(0, p.returncode) | 221 self.assertEquals(0, p.returncode) |
222 out = out[out.index('') + 1:] | 222 out = out[out.index('') + 1:] |
223 out = out[:out.index('')] | 223 out = out[:out.index('')] |
224 modes = [re.match(r'^ (\w+) .+', l) for l in out] | 224 modes = [re.match(r'^ (\w+) .+', l) for l in out] |
225 modes = tuple(m.group(1) for m in modes if m) | 225 modes = tuple(m.group(1) for m in modes if m) |
226 self.assertEquals(EXPECTED_MODES, modes) | 226 # noop doesn't do anything so no point in testing it. |
| 227 self.assertEquals(sorted(EXPECTED_MODES + ('noop',)), sorted(modes)) |
227 | 228 |
228 def test_modes(self): | 229 def test_modes(self): |
229 # This is a bit redundant but make sure all combinations are tested. | 230 # This is a bit redundant but make sure all combinations are tested. |
230 files = sorted( | 231 files = sorted( |
231 i[:-len('.isolate')] | 232 i[:-len('.isolate')] |
232 for i in os.listdir(os.path.join(ROOT_DIR, 'data', 'isolate')) | 233 for i in os.listdir(os.path.join(ROOT_DIR, 'data', 'isolate')) |
233 if i.endswith('.isolate') | 234 if i.endswith('.isolate') |
234 ) | 235 ) |
235 self.assertEquals(sorted(RELATIVE_CWD), files) | 236 self.assertEquals(sorted(RELATIVE_CWD), files) |
236 self.assertEquals(sorted(DEPENDENCIES), files) | 237 self.assertEquals(sorted(DEPENDENCIES), files) |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 ], | 526 ], |
526 } | 527 } |
527 self.assertEquals(self._to_string(expected), out) | 528 self.assertEquals(self._to_string(expected), out) |
528 | 529 |
529 | 530 |
530 | 531 |
531 if __name__ == '__main__': | 532 if __name__ == '__main__': |
532 VERBOSE = '-v' in sys.argv | 533 VERBOSE = '-v' in sys.argv |
533 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) | 534 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) |
534 unittest.main() | 535 unittest.main() |
OLD | NEW |