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

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

Issue 491653002: Docserver: Use GitilesFileSystem instead of SubversionFileSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from extensions_paths import PUBLIC_TEMPLATES 5 from extensions_paths import PUBLIC_TEMPLATES
6 from instance_servlet import ( 6 from instance_servlet import (
7 InstanceServlet, InstanceServletRenderServletDelegate) 7 InstanceServlet, InstanceServletRenderServletDelegate)
8 from link_error_detector import LinkErrorDetector, StringifyBrokenLinks 8 from link_error_detector import LinkErrorDetector, StringifyBrokenLinks
9 from servlet import Request, Response, Servlet 9 from servlet import Request, Response, Servlet
10 10
11 11
12 class BrokenLinkTester(object): 12 class BrokenLinkTester(object):
13 '''Run link error detector tests. 13 '''Run link error detector tests.
14 ''' 14 '''
15 def __init__(self, server_instance, renderer): 15 def __init__(self, server_instance, renderer):
16 self.link_error_detector = LinkErrorDetector( 16 self.link_error_detector = LinkErrorDetector(
17 server_instance.host_file_system_provider.GetTrunk(), 17 server_instance.host_file_system_provider.GetMaster(),
18 renderer, 18 renderer,
19 PUBLIC_TEMPLATES, 19 PUBLIC_TEMPLATES,
20 root_pages=('extensions/index.html', 'apps/about_apps.html')) 20 root_pages=('extensions/index.html', 'apps/about_apps.html'))
21 21
22 def TestBrokenLinks(self): 22 def TestBrokenLinks(self):
23 broken_links = self.link_error_detector.GetBrokenLinks() 23 broken_links = self.link_error_detector.GetBrokenLinks()
24 return ( 24 return (
25 len(broken_links), 25 len(broken_links),
26 'Warning: Found %d broken links:\n%s' % ( 26 'Warning: Found %d broken links:\n%s' % (
27 len(broken_links), StringifyBrokenLinks(broken_links))) 27 len(broken_links), StringifyBrokenLinks(broken_links)))
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 else: 64 else:
65 link_errors, link_content = link_tester.TestBrokenLinks() 65 link_errors, link_content = link_tester.TestBrokenLinks()
66 orphaned_errors, orphaned_content = link_tester.TestOrphanedPages() 66 orphaned_errors, orphaned_content = link_tester.TestOrphanedPages()
67 errors = link_errors + orphaned_errors 67 errors = link_errors + orphaned_errors
68 content = "%s\n%s" % (link_content, orphaned_content) 68 content = "%s\n%s" % (link_content, orphaned_content)
69 69
70 if errors: 70 if errors:
71 return Response.InternalError(content=content) 71 return Response.InternalError(content=content)
72 72
73 return Response.Ok(content="%s test passed." % self._request.path) 73 return Response.Ok(content="%s test passed." % self._request.path)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698