OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """The testing Environment class.""" | 5 """The testing Environment class.""" |
6 | 6 |
7 import logging | 7 import logging |
8 import shutil | 8 import shutil |
9 import sys | 9 import sys |
10 import time | 10 import time |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 error = "" | 366 error = "" |
367 try: | 367 try: |
368 websitetest.was_run = True | 368 websitetest.was_run = True |
369 websitetest.WrongLoginTest() | 369 websitetest.WrongLoginTest() |
370 websitetest.SuccessfulLoginTest() | 370 websitetest.SuccessfulLoginTest() |
371 self.ClearCache(False) | 371 self.ClearCache(False) |
372 websitetest.SuccessfulLoginWithAutofilledPasswordTest() | 372 websitetest.SuccessfulLoginWithAutofilledPasswordTest() |
373 self.ClearCache(True) | 373 self.ClearCache(True) |
374 websitetest.SuccessfulLoginTest() | 374 websitetest.SuccessfulLoginTest() |
375 self.ClearCache(True) | 375 self.ClearCache(True) |
376 except Exception: | 376 except Exception as e: |
377 successful = False | 377 successful = False |
378 error = traceback.format_exc() | |
379 self.tests_results.append(TestResult(websitetest.name, "normal", | 378 self.tests_results.append(TestResult(websitetest.name, "normal", |
380 successful, escape(error))) | 379 successful, e.message)) |
381 | 380 |
382 | 381 |
383 def PromptTestList(self, websitetests): | 382 def PromptTestList(self, websitetests): |
384 """Runs the prompt tests on the websites in |websitetests|. | 383 """Runs the prompt tests on the websites in |websitetests|. |
385 | 384 |
386 Args: | 385 Args: |
387 websitetests: A list of WebsiteTests that are going to be tested. | 386 websitetests: A list of WebsiteTests that are going to be tested. |
388 | 387 |
389 Raises: | 388 Raises: |
390 Exception: An exception is raised if the tests fail. | 389 Exception: An exception is raised if the tests fail. |
391 """ | 390 """ |
392 self.ClearCache(True) | 391 self.ClearCache(True) |
393 | 392 |
394 for websitetest in websitetests: | 393 for websitetest in websitetests: |
395 successful = True | 394 successful = True |
396 error = "" | 395 error = "" |
397 try: | 396 try: |
398 websitetest.was_run = True | 397 websitetest.was_run = True |
399 websitetest.PromptTest() | 398 websitetest.PromptTest() |
400 except Exception: | 399 except Exception as e: |
401 successful = False | 400 successful = False |
402 error = traceback.format_exc() | |
403 self.tests_results.append(TestResult(websitetest.name, "prompt", | 401 self.tests_results.append(TestResult(websitetest.name, "prompt", |
404 successful, escape(error))) | 402 successful, e.message)) |
405 | 403 |
406 def Quit(self): | 404 def Quit(self): |
407 """Closes the tests.""" | 405 """Closes the tests.""" |
408 # Close the webdriver. | 406 # Close the webdriver. |
409 self.driver.quit() | 407 self.driver.quit() |
OLD | NEW |