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

Side by Side Diff: components/test/data/password_manager/automated_tests/environment.py

Issue 891283002: [Password manager tests] Enable "Offer to save password" via webriver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 negation = "" 182 negation = ""
183 if clear_passwords: 183 if clear_passwords:
184 negation = "!" 184 negation = "!"
185 script += ( 185 script += (
186 "if (%sdocument.querySelector('#delete-passwords-checkbox').checked)" 186 "if (%sdocument.querySelector('#delete-passwords-checkbox').checked)"
187 " document.querySelector('#delete-passwords-checkbox').click();" 187 " document.querySelector('#delete-passwords-checkbox').click();"
188 % negation) 188 % negation)
189 script += "document.querySelector('#clear-browser-data-commit').click();" 189 script += "document.querySelector('#clear-browser-data-commit').click();"
190 self.driver.execute_script(script) 190 self.driver.execute_script(script)
191 time.sleep(2) 191 time.sleep(2)
192 # Every time we do something we cache let's enable password saving.
vabr (Chromium) 2015/02/02 09:25:29 possible typo: we cache -> to the cache ?
melandory 2015/02/02 09:35:53 Done.
193 # TODO(melandory): We should check why it's off on a first place.
vabr (Chromium) 2015/02/02 09:25:29 nit: on the first place -> in the first place Also
melandory 2015/02/02 09:35:53 Done.
194 # TODO(melandory): Investigate, maybe there is no need to enable it that
195 # often
vabr (Chromium) 2015/02/02 09:25:29 nit: Missing a full stop at the end of the sentenc
melandory 2015/02/02 09:35:53 Done.
196 self.EnablePasswordsSaving()
197
198 def EnablePasswordsSaving(self):
199 logging.info("\nEnablePasswordSaving\n")
200 self.driver.get("chrome://settings")
201 self.driver.switch_to_frame("settings")
202 script = "document.getElementById('advanced-settings-expander').click();"
203 script += (
204 "if (!document.querySelector('#password-manager-enabled').checked)"
205 "{ document.querySelector('#password-manager-enabled').click();}")
206 self.driver.execute_script(script)
207 time.sleep(2)
192 208
193 def OpenTabAndGoToInternals(self, url): 209 def OpenTabAndGoToInternals(self, url):
194 """If there is no |self.website_window|, opens a new tab and navigates to 210 """If there is no |self.website_window|, opens a new tab and navigates to
195 |url| in the new tab. Navigates to the passwords internals page in the 211 |url| in the new tab. Navigates to the passwords internals page in the
196 first tab. Raises an exception otherwise. 212 first tab. Raises an exception otherwise.
197 213
198 Args: 214 Args:
199 url: Url to go to in the new tab. 215 url: Url to go to in the new tab.
200 216
201 Raises: 217 Raises:
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 websitetest.PromptTest() 414 websitetest.PromptTest()
399 except Exception as e: 415 except Exception as e:
400 successful = False 416 successful = False
401 self.tests_results.append(TestResult(websitetest.name, "prompt", 417 self.tests_results.append(TestResult(websitetest.name, "prompt",
402 successful, e.message)) 418 successful, e.message))
403 419
404 def Quit(self): 420 def Quit(self):
405 """Closes the tests.""" 421 """Closes the tests."""
406 # Close the webdriver. 422 # Close the webdriver.
407 self.driver.quit() 423 self.driver.quit()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698