| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2009 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 """Docbuilder for extension docs.""" | 6 """Docbuilder for extension docs.""" |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 import os.path | 9 import os.path |
| 10 import shutil | 10 import shutil |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 if (os.path.isfile(input_file)): | 52 if (os.path.isfile(input_file)): |
| 53 original = open(input_file, 'rb').read() | 53 original = open(input_file, 'rb').read() |
| 54 os.remove(input_file) | 54 os.remove(input_file) |
| 55 | 55 |
| 56 shutil.copy(_page_shell_html, input_file) | 56 shutil.copy(_page_shell_html, input_file) |
| 57 | 57 |
| 58 # Run test_shell and capture result | 58 # Run test_shell and capture result |
| 59 p = Popen([test_shell, "--layout-tests", generator_url], shell=True, | 59 p = Popen([test_shell, "--layout-tests", generator_url], shell=True, |
| 60 stdout=PIPE) | 60 stdout=PIPE) |
| 61 | 61 |
| 62 # first output line is url that was processed by test_shell | 62 # first output line is url that was processed by test_shell. |
| 63 firstline = p.stdout.readline() | 63 firstline = p.stdout.readline() |
| 64 | 64 |
| 65 # second output line is the layoutTestShell.dumpText() value. | 65 # the remaining output will be the content of the generated page. |
| 66 result = p.stdout.readline() | 66 result = p.stdout.read() |
| 67 | 67 |
| 68 # Remove page_shell | 68 # Remove page_shell |
| 69 os.remove(input_file) | 69 os.remove(input_file) |
| 70 | 70 |
| 71 if (not result.startswith(_expected_output_preamble)): | 71 if (not result.startswith(_expected_output_preamble)): |
| 72 if (firstline.startswith("#TEST_TIMED_OUT")): | 72 if (firstline.startswith("#TEST_TIMED_OUT")): |
| 73 raise Exception("test_shell returned TEST_TIMED_OUT.\n" + | 73 raise Exception("test_shell returned TEST_TIMED_OUT.\n" + |
| 74 "Their was probably a problem with generating the " + | 74 "Their was probably a problem with generating the " + |
| 75 "page\n" + | 75 "page\n" + |
| 76 "Try copying template/page_shell.html to:\n" + | 76 "Try copying template/page_shell.html to:\n" + |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 # and the os.remove will fail with a "Permission denied". | 170 # and the os.remove will fail with a "Permission denied". |
| 171 time.sleep(1); | 171 time.sleep(1); |
| 172 debug_log = os.path.normpath(_build_dir + "/" + "debug.log"); | 172 debug_log = os.path.normpath(_build_dir + "/" + "debug.log"); |
| 173 if (os.path.isfile(debug_log)): | 173 if (os.path.isfile(debug_log)): |
| 174 os.remove(debug_log) | 174 os.remove(debug_log) |
| 175 | 175 |
| 176 return 0; | 176 return 0; |
| 177 | 177 |
| 178 if __name__ == '__main__': | 178 if __name__ == '__main__': |
| 179 sys.exit(main()) | 179 sys.exit(main()) |
| OLD | NEW |