| 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 logging | 6 import logging |
| 7 import os | 7 import os |
| 8 from StringIO import StringIO | 8 from StringIO import StringIO |
| 9 import unittest | 9 import unittest |
| 10 | 10 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 def testLocales(self): | 63 def testLocales(self): |
| 64 # Use US English, Spanish, and Arabic. | 64 # Use US English, Spanish, and Arabic. |
| 65 for lang in ['en-US', 'es', 'ar']: | 65 for lang in ['en-US', 'es', 'ar']: |
| 66 request = _MockRequest('extensions/samples.html') | 66 request = _MockRequest('extensions/samples.html') |
| 67 request.headers['Accept-Language'] = lang + ';q=0.8' | 67 request.headers['Accept-Language'] = lang + ';q=0.8' |
| 68 response = _MockResponse() | 68 response = _MockResponse() |
| 69 Handler(request, response, local_path='../..').get() | 69 Handler(request, response, local_path='../..').get() |
| 70 self.assertEqual(200, response.status) | 70 self.assertEqual(200, response.status) |
| 71 self.assertTrue(response.out.getvalue()) | 71 self.assertTrue(response.out.getvalue()) |
| 72 | 72 |
| 73 def testWarmupRequest(self): | |
| 74 request = _MockRequest('_ah/warmup') | |
| 75 response = _MockResponse() | |
| 76 Handler(request, response, local_path='../..').get() | |
| 77 self.assertEqual(200, response.status) | |
| 78 # Test that the pages were rendered by checking the size of the output. | |
| 79 # In python 2.6 there is no 'assertGreater' method. | |
| 80 value = response.out.getvalue() | |
| 81 self.assertTrue(len(value) > 100000, | |
| 82 msg='Response is too small, probably empty: %s' % value) | |
| 83 | |
| 84 if __name__ == '__main__': | 73 if __name__ == '__main__': |
| 85 unittest.main() | 74 unittest.main() |
| OLD | NEW |