| 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 import unittest | 6 import unittest |
| 7 | 7 |
| 8 from extensions_paths import EXAMPLES, PUBLIC_TEMPLATES, STATIC_DOCS | 8 from extensions_paths import EXAMPLES, PUBLIC_TEMPLATES, STATIC_DOCS |
| 9 from local_file_system import LocalFileSystem | 9 from local_file_system import LocalFileSystem |
| 10 from render_servlet import RenderServlet | 10 from render_servlet import RenderServlet |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 def _Render(self, path, headers=None, host=None): | 22 def _Render(self, path, headers=None, host=None): |
| 23 return RenderServlet(Request.ForTest(path, headers=headers, host=host), | 23 return RenderServlet(Request.ForTest(path, headers=headers, host=host), |
| 24 _RenderServletDelegate()).Get() | 24 _RenderServletDelegate()).Get() |
| 25 | 25 |
| 26 def testExtensionAppRedirect(self): | 26 def testExtensionAppRedirect(self): |
| 27 self.assertEqual( | 27 self.assertEqual( |
| 28 Response.Redirect('/apps/storage', permanent=False), | 28 Response.Redirect('/apps/storage', permanent=False), |
| 29 self._Render('storage')) | 29 self._Render('storage')) |
| 30 | 30 |
| 31 def testChannelRedirect(self): | 31 def testChannelRedirect(self): |
| 32 for channel in ('stable', 'beta', 'dev', 'trunk'): | 32 for channel in ('stable', 'beta', 'dev', 'master'): |
| 33 self.assertEqual( | 33 self.assertEqual( |
| 34 Response.Redirect('/extensions/storage', permanent=True), | 34 Response.Redirect('/extensions/storage', permanent=True), |
| 35 self._Render('%s/extensions/storage' % channel)) | 35 self._Render('%s/extensions/storage' % channel)) |
| 36 | 36 |
| 37 def testOldHostsRedirect(self): | 37 def testOldHostsRedirect(self): |
| 38 self.assertEqual( | 38 self.assertEqual( |
| 39 Response.Redirect('https://developer.chrome.com/extensions', | 39 Response.Redirect('https://developer.chrome.com/extensions', |
| 40 permanent=False), | 40 permanent=False), |
| 41 self._Render('/chrome/extensions', host='http://code.google.com')) | 41 self._Render('/chrome/extensions', host='http://code.google.com')) |
| 42 self.assertEqual( | 42 self.assertEqual( |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 self.assertEqual(content_type, response.headers.get('Content-Type')) | 146 self.assertEqual(content_type, response.headers.get('Content-Type')) |
| 147 self.assertEqual(etag, response.headers.get('ETag')) | 147 self.assertEqual(etag, response.headers.get('ETag')) |
| 148 | 148 |
| 149 # Test with a static path and a dynamic path. | 149 # Test with a static path and a dynamic path. |
| 150 test_path('static/css/out/site.css', 'text/css; charset=utf-8') | 150 test_path('static/css/out/site.css', 'text/css; charset=utf-8') |
| 151 test_path('extensions/storage', 'text/html; charset=utf-8') | 151 test_path('extensions/storage', 'text/html; charset=utf-8') |
| 152 | 152 |
| 153 | 153 |
| 154 if __name__ == '__main__': | 154 if __name__ == '__main__': |
| 155 unittest.main() | 155 unittest.main() |
| OLD | NEW |