| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 if count > self.message_count[log_message]: | 269 if count > self.message_count[log_message]: |
| 270 self.message_count[log_message] = count | 270 self.message_count[log_message] = count |
| 271 return True | 271 return True |
| 272 elif timeout > 0: | 272 elif timeout > 0: |
| 273 time.sleep(1) | 273 time.sleep(1) |
| 274 return self._DidMessageAppearUntilTimeout(log_message, timeout - 1) | 274 return self._DidMessageAppearUntilTimeout(log_message, timeout - 1) |
| 275 else: | 275 else: |
| 276 return False | 276 return False |
| 277 | 277 |
| 278 def CheckForNewMessage(self, log_message, message_should_show_up, | 278 def CheckForNewMessage(self, log_message, message_should_show_up, |
| 279 error_message, timeout=3): | 279 error_message, timeout=15): |
| 280 """Detects whether the save password prompt is shown. | 280 """Detects whether the save password prompt is shown. |
| 281 | 281 |
| 282 Args: | 282 Args: |
| 283 log_message: Log message to look for in the password internals. The | 283 log_message: Log message to look for in the password internals. The |
| 284 only valid values are the constants MESSAGE_* defined at the | 284 only valid values are the constants MESSAGE_* defined at the |
| 285 beginning of this file. | 285 beginning of this file. |
| 286 message_should_show_up: Whether or not the message is expected to be | 286 message_should_show_up: Whether or not the message is expected to be |
| 287 shown. | 287 shown. |
| 288 error_message: Error message for the exception. | 288 error_message: Error message for the exception. |
| 289 timeout: There is some delay between the login and the password | 289 timeout: There is some delay between the login and the password |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 except Exception as e: | 415 except Exception as e: |
| 416 successful = False | 416 successful = False |
| 417 error = e.message | 417 error = e.message |
| 418 self.tests_results.append(TestResult(websitetest.name, "prompt", | 418 self.tests_results.append(TestResult(websitetest.name, "prompt", |
| 419 successful, error)) | 419 successful, error)) |
| 420 | 420 |
| 421 def Quit(self): | 421 def Quit(self): |
| 422 """Closes the tests.""" | 422 """Closes the tests.""" |
| 423 # Close the webdriver. | 423 # Close the webdriver. |
| 424 self.driver.quit() | 424 self.driver.quit() |
| OLD | NEW |