OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env 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 '''Unittests for update.py. | 6 '''Unittests for update.py. |
7 | 7 |
8 They set up a temporary directory that is used to mock a bucket, the directory | 8 They set up a temporary directory that is used to mock a bucket, the directory |
9 containing the configuration files and the android sdk directory. | 9 containing the configuration files and the android sdk directory. |
10 | 10 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 _MakeDirs(self.paths.bucket) | 294 _MakeDirs(self.paths.bucket) |
295 | 295 |
296 # is not configured via argument. | 296 # is not configured via argument. |
297 update.SHA1_DIRECTORY = self.paths.config_dir | 297 update.SHA1_DIRECTORY = self.paths.config_dir |
298 | 298 |
299 os.environ['CHROME_HEADLESS'] = '1' if bot_env else '' | 299 os.environ['CHROME_HEADLESS'] = '1' if bot_env else '' |
300 | 300 |
301 if config_version: | 301 if config_version: |
302 _MakeDirs(os.path.dirname(self.paths.config_file)) | 302 _MakeDirs(os.path.dirname(self.paths.config_file)) |
303 with open(self.paths.config_file, 'w') as stream: | 303 with open(self.paths.config_file, 'w') as stream: |
304 stream.write('{"version_number":%d}\n' % config_version) | 304 stream.write(('{"version_number":%d,' |
| 305 '"version_xml_path": "res/values/version.xml"}' |
| 306 '\n') % config_version) |
305 | 307 |
306 if existing_license: | 308 if existing_license: |
307 _MakeDirs(self.paths.gms_root) | 309 _MakeDirs(self.paths.gms_root) |
308 with open(self.paths.gms_root_license, 'w') as stream: | 310 with open(self.paths.gms_root_license, 'w') as stream: |
309 stream.write(existing_license) | 311 stream.write(existing_license) |
310 | 312 |
311 if existing_zip_sha1: | 313 if existing_zip_sha1: |
312 _MakeDirs(self.paths.gms_root) | 314 _MakeDirs(self.paths.gms_root) |
313 with open(self.paths.gms_root_sha1, 'w') as stream: | 315 with open(self.paths.gms_root_sha1, 'w') as stream: |
314 stream.write(existing_zip_sha1) | 316 stream.write(existing_zip_sha1) |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 try: | 407 try: |
406 original_raw_input = __builtins__.raw_input | 408 original_raw_input = __builtins__.raw_input |
407 __builtins__.raw_input = lambda _: typed_string | 409 __builtins__.raw_input = lambda _: typed_string |
408 yield | 410 yield |
409 finally: | 411 finally: |
410 __builtins__.raw_input = original_raw_input | 412 __builtins__.raw_input = original_raw_input |
411 | 413 |
412 | 414 |
413 if __name__ == '__main__': | 415 if __name__ == '__main__': |
414 unittest.main() | 416 unittest.main() |
OLD | NEW |