Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: chrome/common/extensions/docs/server2/patch_servlet_test.py

Issue 12521030: Extension docs: Include sidenav in 404 pages (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 empty_dir_file_system import EmptyDirFileSystem 8 from empty_dir_file_system import EmptyDirFileSystem
9 from fake_fetchers import ConfigureFakeFetchers 9 from fake_fetchers import ConfigureFakeFetchers
10 from local_file_system import LocalFileSystem 10 from local_file_system import LocalFileSystem
(...skipping 28 matching lines...) Expand all
39 def _RenderWithoutPatch(self, path): 39 def _RenderWithoutPatch(self, path):
40 return RenderServlet(Request.ForTest(path, host=_ALLOWED_HOST), 40 return RenderServlet(Request.ForTest(path, host=_ALLOWED_HOST),
41 _RenderServletDelegate()).Get() 41 _RenderServletDelegate()).Get()
42 42
43 def _RenderAndCheck(self, path, issue, expected_equal): 43 def _RenderAndCheck(self, path, issue, expected_equal):
44 patched_response = self._RenderWithPatch(path, issue) 44 patched_response = self._RenderWithPatch(path, issue)
45 unpatched_response = self._RenderWithoutPatch(path) 45 unpatched_response = self._RenderWithoutPatch(path)
46 patched_response.headers.pop('cache-control', None) 46 patched_response.headers.pop('cache-control', None)
47 unpatched_response.headers.pop('cache-control', None) 47 unpatched_response.headers.pop('cache-control', None)
48 patched_content = patched_response.content.ToString().replace( 48 patched_content = patched_response.content.ToString().replace(
49 '/_patch/%s/static/' % issue, '/static/') 49 '/_patch/%s/' % issue, '/')
50 unpatched_content = unpatched_response.content.ToString() 50 unpatched_content = unpatched_response.content.ToString()
51 51
52 self.assertEqual(patched_response.status, unpatched_response.status) 52 self.assertEqual(patched_response.status, unpatched_response.status)
53 self.assertEqual(patched_response.headers, unpatched_response.headers) 53 self.assertEqual(patched_response.headers, unpatched_response.headers)
54 if expected_equal: 54 if expected_equal:
55 self.assertEqual(patched_content, unpatched_content) 55 self.assertEqual(patched_content, unpatched_content)
56 else: 56 else:
57 self.assertNotEqual(patched_content, unpatched_content) 57 self.assertNotEqual(patched_content, unpatched_content)
58 58
59 def _RenderAndAssertEqual(self, path, issue): 59 def _RenderAndAssertEqual(self, path, issue):
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 '%s/_patch/12345' % _ALLOWED_HOST)) 117 '%s/_patch/12345' % _ALLOWED_HOST))
118 self.assertTrue(*is_redirect('http://developers.google.com', '12345', 118 self.assertTrue(*is_redirect('http://developers.google.com', '12345',
119 '%s/_patch/12345' % _ALLOWED_HOST)) 119 '%s/_patch/12345' % _ALLOWED_HOST))
120 self.assertFalse(*is_redirect('http://chrome-apps-doc.appspot.com', '12345', 120 self.assertFalse(*is_redirect('http://chrome-apps-doc.appspot.com', '12345',
121 None)) 121 None))
122 self.assertFalse(*is_redirect('http://some-other-app.appspot.com', '12345', 122 self.assertFalse(*is_redirect('http://some-other-app.appspot.com', '12345',
123 None)) 123 None))
124 124
125 if __name__ == '__main__': 125 if __name__ == '__main__':
126 unittest.main() 126 unittest.main()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/patch_servlet.py ('k') | chrome/common/extensions/docs/server2/render_servlet.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698