diff options
author | dyu@chromium.org <dyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-30 23:29:08 +0000 |
---|---|---|
committer | dyu@chromium.org <dyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-30 23:29:08 +0000 |
commit | 0aede8ad2e5acde78bb65d3bb9953378b8e4409c (patch) | |
tree | 90e616f1ed4a095aa39e6413d64fd89e95fc7905 | |
parent | e32d4972fd0bdb2b0ee702bf7ebfd40eb946e8b4 (diff) | |
download | chromium_src-0aede8ad2e5acde78bb65d3bb9953378b8e4409c.zip chromium_src-0aede8ad2e5acde78bb65d3bb9953378b8e4409c.tar.gz chromium_src-0aede8ad2e5acde78bb65d3bb9953378b8e4409c.tar.bz2 |
Add Autofill test for verifying that credit card info is not stored when autocomplete is off for credit card field.
- autofill.testCCInfoNotStoredWhenAutocompleteOff
- cc_autocomplete_off_test.html
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/6777003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79919 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | chrome/test/data/autofill/cc_autocomplete_off_test.html | 44 | ||||
-rw-r--r-- | chrome/test/functional/autofill.py | 33 |
2 files changed, 77 insertions, 0 deletions
diff --git a/chrome/test/data/autofill/cc_autocomplete_off_test.html b/chrome/test/data/autofill/cc_autocomplete_off_test.html new file mode 100755 index 0000000..85b8458 --- /dev/null +++ b/chrome/test/data/autofill/cc_autocomplete_off_test.html @@ -0,0 +1,44 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> +<!-- Autofill credit card test form where autocomplete is off for the card number field. --> +<html> + <head> + <title>Autofill Credit Card Test Form</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + </head> + <body> + <form action="" id="cc_submit" method="post"> + <table> + <tbody> + <tr> + <td> + <label for="nameoncard">Name on Card</label> + </td> + <td> + <input size="40" id="CREDIT_CARD_NAME"/> + </td> + </tr> + + <tr> + <td> + <label for="card_number">Card Number</label> + </td> + <td> + <input autocomplete="off" size="40" id="CREDIT_CARD_NUMBER" name="card_number"/> + </td> + </tr> + + <tr> + <td> + <label>Expiration Date</label> + </td> + <td> + <input size="2" name="ccmonth" id="CREDIT_CARD_EXP_MONTH"> <input size="4" name="ccyear" id="CREDIT_CARD_EXP_4_DIGIT_YEAR" /> + </td> + </tr> + </tbody> + </table> + <input type="submit" value="Submit"> + </form> + </body> +</html> + diff --git a/chrome/test/functional/autofill.py b/chrome/test/functional/autofill.py index bb5812a..a5bed7d 100644 --- a/chrome/test/functional/autofill.py +++ b/chrome/test/functional/autofill.py @@ -190,6 +190,39 @@ class AutofillTest(pyauto.PyUITest): ('Original profile not equal to expected profile at key: "%s"\n' 'Expected: "%s"\nReturned: "%s"' % (key, value, form_values[key]))) + def testCCInfoNotStoredWhenAutocompleteOff(self): + """Test CC info not offered to be saved when autocomplete=off for CC field. + + If the credit card number field has autocomplete turned off, then the credit + card infobar should not offer to save the credit card info. + """ + credit_card_info = {'CREDIT_CARD_NAME': 'Bob Smith', + 'CREDIT_CARD_NUMBER': '6011111111111117', + 'CREDIT_CARD_EXP_MONTH': '12', + 'CREDIT_CARD_EXP_4_DIGIT_YEAR': '2014'} + + url = self.GetHttpURLForDataPath( + os.path.join('autofill', 'cc_autocomplete_off_test.html')) + self.NavigateToURL(url) + for key, value in credit_card_info.iteritems(): + script = ('document.getElementById("%s").value = "%s"; ' + 'window.domAutomationController.send("done");') % (key, value) + self.ExecuteJavascript(script, 0, 0) + js_code = """ + document.getElementById("cc_submit").submit(); + window.addEventListener("unload", function() { + window.domAutomationController.send("done"); + }); + """ + self.ExecuteJavascript(js_code, 0, 0) + # Wait until form is submitted and page completes loading. + self.WaitUntil( + lambda: self.GetDOMValue('document.readyState'), + expect_retval='complete') + cc_infobar = self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars'] + self.assertEqual(0, len(cc_infobar), + 'Save credit card infobar offered to save CC info.') + def FormFillLatencyAfterSubmit(self): """Test latency time on form submit with lots of stored Autofill profiles. |