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 # Run build_server so that files needed by tests are copied to the local | 6 # Run build_server so that files needed by tests are copied to the local |
7 # third_party directory. | 7 # third_party directory. |
8 import build_server | 8 import build_server |
9 build_server.main() | 9 build_server.main() |
10 | 10 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 self.assertEqual(200, response.status) | 249 self.assertEqual(200, response.status) |
250 self.assertTrue(response.content != '') | 250 self.assertTrue(response.content != '') |
251 finally: | 251 finally: |
252 print('Took %s seconds' % (time.time() - start_time)) | 252 print('Took %s seconds' % (time.time() - start_time)) |
253 | 253 |
254 # TODO(jshumway): Check page for broken links (currently prohibited by the | 254 # TODO(jshumway): Check page for broken links (currently prohibited by the |
255 # time it takes to render the pages). | 255 # time it takes to render the pages). |
256 | 256 |
257 @DisableLogging('warning') | 257 @DisableLogging('warning') |
258 def testFileNotFound(self): | 258 def testFileNotFound(self): |
259 response = Handler(Request.ForTest('/extensions/notfound')).Get() | 259 response = LocalRenderer.Render('/extensions/notfound') |
260 self.assertEqual(404, response.status) | 260 self.assertEqual(404, response.status) |
261 | 261 |
262 def testSiteVerificationFile(self): | 262 def testSiteVerificationFile(self): |
263 response = Handler(Request.ForTest('/' + SITE_VERIFICATION_FILE)).Get() | 263 response = LocalRenderer.Render('/' + SITE_VERIFICATION_FILE) |
264 self.assertEqual(200, response.status) | 264 self.assertEqual(200, response.status) |
265 | 265 |
266 if __name__ == '__main__': | 266 if __name__ == '__main__': |
267 parser = optparse.OptionParser() | 267 parser = optparse.OptionParser() |
268 parser.add_option('-a', '--all', action='store_true', default=False, | 268 parser.add_option('-a', '--all', action='store_true', default=False, |
269 help='Render all pages, not just the one specified') | 269 help='Render all pages, not just the one specified') |
270 parser.add_option('-r', '--rebase', action='store_true', default=False, | 270 parser.add_option('-r', '--rebase', action='store_true', default=False, |
271 help='Rewrites the known_broken_links.json file with ' | 271 help='Rewrites the known_broken_links.json file with ' |
272 'the current set of broken links') | 272 'the current set of broken links') |
273 parser.add_option('-v', '--verbose', action='store_true', default=False, | 273 parser.add_option('-v', '--verbose', action='store_true', default=False, |
274 help='Show verbose output like currently broken links') | 274 help='Show verbose output like currently broken links') |
275 (opts, args) = parser.parse_args() | 275 (opts, args) = parser.parse_args() |
276 if not opts.all: | 276 if not opts.all: |
277 _EXPLICIT_TEST_FILES = args | 277 _EXPLICIT_TEST_FILES = args |
278 _REBASE = opts.rebase | 278 _REBASE = opts.rebase |
279 _VERBOSE = opts.verbose | 279 _VERBOSE = opts.verbose |
280 # Kill sys.argv because we have our own flags. | 280 # Kill sys.argv because we have our own flags. |
281 sys.argv = [sys.argv[0]] | 281 sys.argv = [sys.argv[0]] |
282 unittest.main() | 282 unittest.main() |
OLD | NEW |