OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 """Tests for mb.py.""" | 6 """Tests for mb.py.""" |
7 | 7 |
8 import json | 8 import json |
9 import StringIO | 9 import StringIO |
10 import sys | 10 import sys |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 def Exists(self, path): | 32 def Exists(self, path): |
33 return self.files.get(path) is not None | 33 return self.files.get(path) is not None |
34 | 34 |
35 def MaybeMakeDirectory(self, path): | 35 def MaybeMakeDirectory(self, path): |
36 pass | 36 pass |
37 | 37 |
38 def ReadFile(self, path): | 38 def ReadFile(self, path): |
39 return self.files[path] | 39 return self.files[path] |
40 | 40 |
41 def WriteFile(self, path, contents): | 41 def WriteFile(self, path, contents, verbosity=1): |
42 self.files[path] = contents | 42 self.files[path] = contents |
43 | 43 |
44 def Call(self, cmd, env=None): | 44 def Call(self, cmd, env=None): |
45 if env: | 45 if env: |
46 self.cross_compile = env.get('GYP_CROSSCOMPILE') | 46 self.cross_compile = env.get('GYP_CROSSCOMPILE') |
47 self.calls.append(cmd) | 47 self.calls.append(cmd) |
48 if self.cmds: | 48 if self.cmds: |
49 return self.cmds.pop(0) | 49 return self.cmds.pop(0) |
50 return 0, '', '' | 50 return 0, '', '' |
51 | 51 |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 finally: | 275 finally: |
276 sys.stdout = orig_stdout | 276 sys.stdout = orig_stdout |
277 | 277 |
278 | 278 |
279 def test_validate(self): | 279 def test_validate(self): |
280 self.check(['validate'], ret=0) | 280 self.check(['validate'], ret=0) |
281 | 281 |
282 | 282 |
283 if __name__ == '__main__': | 283 if __name__ == '__main__': |
284 unittest.main() | 284 unittest.main() |
OLD | NEW |