| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import logging | 6 import logging |
| 7 import os | 7 import os |
| 8 import pickle | 8 import pickle |
| 9 import re | 9 import re |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 file_path = os.path.join(self.DataDir(), 'autofill', 'functional', | 66 file_path = os.path.join(self.DataDir(), 'autofill', 'functional', |
| 67 'crazy_creditcards.txt') | 67 'crazy_creditcards.txt') |
| 68 test_data = self.EvalDataFrom(file_path) | 68 test_data = self.EvalDataFrom(file_path) |
| 69 credit_cards_input = test_data['input'] | 69 credit_cards_input = test_data['input'] |
| 70 self.FillAutofillProfile(credit_cards=credit_cards_input) | 70 self.FillAutofillProfile(credit_cards=credit_cards_input) |
| 71 | 71 |
| 72 self.assertEqual(test_data['expected'], | 72 self.assertEqual(test_data['expected'], |
| 73 self.GetAutofillProfile()['credit_cards'], | 73 self.GetAutofillProfile()['credit_cards'], |
| 74 msg='Autofill credit card data does not match.') | 74 msg='Autofill credit card data does not match.') |
| 75 | 75 |
| 76 def testSegmentNumbersNotSupportedInDOMUI(self): |
| 77 """Test segmented phone/fax numbers no longer supported in DOM UI. |
| 78 |
| 79 Phone and fax |COUNTRY_CODE| and |CITY_CODE| are only supported when |
| 80 aggregating a web form and no longer processed in parts through the DOM UI |
| 81 (when adding profiles through prefs settings). |
| 82 """ |
| 83 profile_input = [{'NAME_FIRST': 'John', |
| 84 'NAME_LAST': 'Doe', |
| 85 'ADDRESS_HOME_LINE1': '123 H St.', |
| 86 'ADDRESS_HOME_CITY': 'San Jose', |
| 87 'ADDRESS_HOME_STATE': 'CA', |
| 88 'ADDRESS_HOME_ZIP': '95110', |
| 89 'ADDRESS_HOME_COUNTRY': 'China', |
| 90 'PHONE_HOME_COUNTRY_CODE': '86', |
| 91 'PHONE_HOME_CITY_CODE': '108', |
| 92 'PHONE_HOME_NUMBER': '8828000', |
| 93 'PHONE_FAX_COUNTRY_CODE': '86', |
| 94 'PHONE_FAX_CITY_CODE': '108', |
| 95 'PHONE_FAX_NUMBER': '8828000'}] |
| 96 |
| 97 profile_expected = [{'NAME_FIRST': 'John', |
| 98 'NAME_LATE': 'Doe', |
| 99 'ADDRESS_HOME_LINE1': '123 H St.', |
| 100 'ADDRESS_HOME_CITY': 'San Jose', |
| 101 'ADDRESS_HOME_STATE': 'CA', |
| 102 'ADDRESS_HOME_ZIP': '95110', |
| 103 'ADDRESS_HOME_COUNTRY': 'China'}] |
| 104 |
| 105 self.FillAutofillProfile(profiles=profile_input) |
| 106 self.assertEqual(profile_expected, self.GetAutofillProfile()['profiles'], |
| 107 msg='Segmented phone/fax numbers supported in DOM UI.') |
| 108 |
| 76 def testGetProfilesEmpty(self): | 109 def testGetProfilesEmpty(self): |
| 77 """Test getting profiles when none have been filled.""" | 110 """Test getting profiles when none have been filled.""" |
| 78 profile = self.GetAutofillProfile() | 111 profile = self.GetAutofillProfile() |
| 79 self.assertEqual([], profile['profiles']) | 112 self.assertEqual([], profile['profiles']) |
| 80 self.assertEqual([], profile['credit_cards']) | 113 self.assertEqual([], profile['credit_cards']) |
| 81 | 114 |
| 82 def testAutofillInvalid(self): | 115 def testAutofillInvalid(self): |
| 83 """Test filling in invalid values for profiles are saved as-is. | 116 """Test filling in invalid values for profiles are saved as-is. |
| 84 | 117 |
| 85 Phone/Fax information entered into the prefs UI is not validated or rejected | 118 Phone/Fax information entered into the prefs UI is not validated or rejected |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 'window.domAutomationController.send("done");') % (key, value) | 658 'window.domAutomationController.send("done");') % (key, value) |
| 626 self.ExecuteJavascript(script, 0, 0) | 659 self.ExecuteJavascript(script, 0, 0) |
| 627 self.ExecuteJavascript('document.getElementById("testform").submit();' | 660 self.ExecuteJavascript('document.getElementById("testform").submit();' |
| 628 'window.domAutomationController.send("done");', | 661 'window.domAutomationController.send("done");', |
| 629 0, 0) | 662 0, 0) |
| 630 return len(list_of_dict) | 663 return len(list_of_dict) |
| 631 | 664 |
| 632 | 665 |
| 633 if __name__ == '__main__': | 666 if __name__ == '__main__': |
| 634 pyauto_functional.Main() | 667 pyauto_functional.Main() |
| OLD | NEW |