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

Unified Diff: components/test/data/password_manager/environment.py

Issue 472823002: The password manager python tests now logout from websites by cleaning the cookies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | components/test/data/password_manager/tests.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test/data/password_manager/environment.py
diff --git a/components/test/data/password_manager/environment.py b/components/test/data/password_manager/environment.py
index 1baa316a0efd8a456fe0cab4e3c14019a591cbdd..c508b0221c3a6bdf83482058f2ce65bb3df95f12 100644
--- a/components/test/data/password_manager/environment.py
+++ b/components/test/data/password_manager/environment.py
@@ -172,14 +172,29 @@ class Environment:
self.driver.switch_to_frame("settings")
while True:
try:
- self.driver.execute_script("document.querySelector('"
- "#saved-passwords-list .row-delete-button').click()")
+ self.driver.execute_script(
+ "document.querySelector('#saved-passwords-list .row-delete-button')"
+ ".click()")
time.sleep(1)
except NoSuchElementException:
break
except WebDriverException:
break
+ def ClearAllCookies(self):
+ """Removes all the cookies."""
+ logging.info("\nClearAllCookies\n")
+ self.driver.get("chrome://settings/clearBrowserData")
+ self.driver.switch_to_frame("settings")
+ self.driver.execute_script(
+ "var checkboxes = document.querySelectorAll("
+ " '#clear-data-checkboxes [type=\\\'checkbox\\\']');"
+ "for (var i in checkboxes)"
+ " checkboxes[i].checked = false;"
+ "document.querySelector('#delete-cookies-checkbox').checked = true;"
+ "document.querySelector('#clear-browser-data-commit').click();")
+ time.sleep(2)
+
def OpenTabAndGoToInternals(self, url):
"""If there is no |self.website_window|, opens a new tab and navigates to
|url| in the new tab. Navigates to the passwords internals page in the
« no previous file with comments | « no previous file | components/test/data/password_manager/tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698