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

Unified Diff: chrome/common/extensions/docs/server2/integration_test.py

Issue 17816005: Doc server broken link detection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch rewrite Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/integration_test.py
diff --git a/chrome/common/extensions/docs/server2/integration_test.py b/chrome/common/extensions/docs/server2/integration_test.py
index acd4d44c1e6ce18283581712f6e556148c4f00c7..b36e852e4faff95b33d9581897a7e516882c02d8 100755
--- a/chrome/common/extensions/docs/server2/integration_test.py
+++ b/chrome/common/extensions/docs/server2/integration_test.py
@@ -8,13 +8,14 @@
import build_server
build_server.main()
-import logging
import optparse
import os
import sys
import time
import unittest
+from link_error_detector import LinkErrorDetector, pprint_broken_links
+from local_file_system import LocalFileSystem
from local_renderer import LocalRenderer
from fake_fetchers import ConfigureFakeFetchers
from handler import Handler
@@ -61,6 +62,32 @@ class IntegrationTest(unittest.TestCase):
finally:
print('Took %s seconds' % (time.time() - start_time))
+ print "checking for broken links..."
not at google - send to devlin 2013/07/09 00:17:32 print(..) not print ..., print without () is depre
jshumway 2013/07/17 00:49:55 Done.
+ def renderer(path):
+ return Handler(Request.ForTest(path)).Get()
+
+ start_time = time.time()
+ link_error_detector = LinkErrorDetector(
+ LocalFileSystem(os.path.join(sys.path[0], os.pardir, os.pardir)),
+ renderer,
not at google - send to devlin 2013/07/09 00:17:32 maybe make this a lambda?
jshumway 2013/07/17 00:49:55 Done.
+ 'templates/public',
+ ('extensions/index.html', 'apps/about_apps.html'))
+
+ broken_links = link_error_detector.GetBrokenLinks()
+ if broken_links:
+ pprint_broken_links(broken_links)
+
+ print 'finding %d broken links took %s seconds' % (
not at google - send to devlin 2013/07/09 00:17:32 likewise, and here Took %s seconds.
jshumway 2013/07/17 00:49:55 Done.
+ len(broken_links), time.time() - start_time)
+
+ print 'searching for orphan pages...'
not at google - send to devlin 2013/07/09 00:17:32 likewise here and below.
jshumway 2013/07/17 00:49:55 Done.
+ start_time = time.time()
+ orphans = link_error_detector.GetOrphanPages()
+ for page in orphans:
+ print page
not at google - send to devlin 2013/07/09 00:17:32 I think we can do a better job of being informativ
jshumway 2013/07/17 00:49:55 Done.
+ print 'finding %d orphan pages took %s seconds' % (
+ len(orphans), time.time() - start_time)
+
public_files = _GetPublicFiles()
print('Rendering %s public files...' % len(public_files.keys()))

Powered by Google App Engine
This is Rietveld 408576698