| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 # Run build_server so that files needed by tests are copied to the local | 6 # Run build_server so that files needed by tests are copied to the local |
| 7 # third_party directory. | 7 # third_party directory. |
| 8 import build_server | 8 import build_server |
| 9 build_server.main() | 9 build_server.main() |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 start_time = time.time() | 67 start_time = time.time() |
| 68 try: | 68 try: |
| 69 for path, content in public_files.iteritems(): | 69 for path, content in public_files.iteritems(): |
| 70 def check_result(response): | 70 def check_result(response): |
| 71 self.assertEqual(200, response.status, | 71 self.assertEqual(200, response.status, |
| 72 'Got %s when rendering %s' % (response.status, path)) | 72 'Got %s when rendering %s' % (response.status, path)) |
| 73 # This is reaaaaally rough since usually these will be tiny templates | 73 # This is reaaaaally rough since usually these will be tiny templates |
| 74 # that render large files. At least it'll catch zero-length responses. | 74 # that render large files. At least it'll catch zero-length responses. |
| 75 self.assertTrue(len(response.content) >= len(content), | 75 self.assertTrue(len(response.content) >= len(content), |
| 76 'Content was "%s" when rendering %s' % (response.content, path)) | 76 'Content was "%s" when rendering %s' % (response.content, path)) |
| 77 check_result(Handler(Request.ForTest(path)).Get()) | 77 check_result(LocalRenderer.Render(path)) |
| 78 # Samples are internationalized, test some locales. | 78 # Samples are internationalized, test some locales. |
| 79 if path.endswith('/samples.html'): | 79 if path.endswith('/samples.html'): |
| 80 for lang in ['en-US', 'es', 'ar']: | 80 for lang in ['en-US', 'es', 'ar']: |
| 81 check_result(Handler(Request.ForTest( | 81 check_result(Handler(Request.ForTest( |
| 82 path, | 82 path, |
| 83 headers={'Accept-Language': '%s;q=0.8' % lang})).Get()) | 83 headers={'Accept-Language': '%s;q=0.8' % lang})).Get()) |
| 84 finally: | 84 finally: |
| 85 print('Took %s seconds' % (time.time() - start_time)) | 85 print('Took %s seconds' % (time.time() - start_time)) |
| 86 | 86 |
| 87 # TODO(kalman): Move this test elsewhere, it's not an integration test. | 87 # TODO(kalman): Move this test elsewhere, it's not an integration test. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 108 | 108 |
| 109 if __name__ == '__main__': | 109 if __name__ == '__main__': |
| 110 parser = optparse.OptionParser() | 110 parser = optparse.OptionParser() |
| 111 parser.add_option('-a', '--all', action='store_true', default=False) | 111 parser.add_option('-a', '--all', action='store_true', default=False) |
| 112 (opts, args) = parser.parse_args() | 112 (opts, args) = parser.parse_args() |
| 113 if not opts.all: | 113 if not opts.all: |
| 114 _EXPLICIT_TEST_FILES = args | 114 _EXPLICIT_TEST_FILES = args |
| 115 # Kill sys.argv because we have our own flags. | 115 # Kill sys.argv because we have our own flags. |
| 116 sys.argv = [sys.argv[0]] | 116 sys.argv = [sys.argv[0]] |
| 117 unittest.main() | 117 unittest.main() |
| OLD | NEW |