Chromium Code Reviews| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 # Add the handler to the root logger. | 80 # Add the handler to the root logger. |
| 81 logging.getLogger('').addHandler(console) | 81 logging.getLogger('').addHandler(console) |
| 82 | 82 |
| 83 elif log_to_console: | 83 elif log_to_console: |
| 84 logging.basicConfig(level=numeric_level) | 84 logging.basicConfig(level=numeric_level) |
| 85 | 85 |
| 86 # Cleaning the chrome testing profile folder. | 86 # Cleaning the chrome testing profile folder. |
| 87 try: | 87 try: |
| 88 shutil.rmtree(profile_path) | 88 shutil.rmtree(profile_path) |
| 89 except Exception, e: | 89 except Exception, e: |
| 90 # The tests execution can continue, but this make them less stable. | 90 pass |
|
melandory
2015/02/06 08:37:46
I disagree with removing of this log message: it's
dvadym
2015/02/06 11:02:26
Now each test run has own temporary profile direct
| |
| 91 logging.error("Error: Could not wipe the chrome profile directory (%s). \ | |
| 92 This affects the stability of the tests. Continuing to run tests." | |
| 93 % e) | |
| 94 # If |chrome_path| is not defined, this means that we are in the dashboard | 91 # If |chrome_path| is not defined, this means that we are in the dashboard |
| 95 # website, and we just need to get the list of all websites. In this case, | 92 # website, and we just need to get the list of all websites. In this case, |
| 96 # we don't need to initilize the webdriver. | 93 # we don't need to initilize the webdriver. |
| 97 if chrome_path: | 94 if chrome_path: |
| 98 options = Options() | 95 options = Options() |
| 99 self.enable_automatic_password_saving = enable_automatic_password_saving | 96 self.enable_automatic_password_saving = enable_automatic_password_saving |
| 100 if enable_automatic_password_saving: | 97 if enable_automatic_password_saving: |
| 101 options.add_argument("enable-automatic-password-saving") | 98 options.add_argument("enable-automatic-password-saving") |
| 102 # Chrome path. | 99 # Chrome path. |
| 103 options.binary_location = chrome_path | 100 options.binary_location = chrome_path |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 except Exception as e: | 415 except Exception as e: |
| 419 successful = False | 416 successful = False |
| 420 error = e.message | 417 error = e.message |
| 421 self.tests_results.append(TestResult(websitetest.name, "prompt", | 418 self.tests_results.append(TestResult(websitetest.name, "prompt", |
| 422 successful, error)) | 419 successful, error)) |
| 423 | 420 |
| 424 def Quit(self): | 421 def Quit(self): |
| 425 """Closes the tests.""" | 422 """Closes the tests.""" |
| 426 # Close the webdriver. | 423 # Close the webdriver. |
| 427 self.driver.quit() | 424 self.driver.quit() |
| OLD | NEW |