Index: chrome/test/functional/autofill.py |
=================================================================== |
--- chrome/test/functional/autofill.py (revision 78751) |
+++ chrome/test/functional/autofill.py (working copy) |
@@ -8,6 +8,7 @@ |
import pickle |
import autofill_dataset_converter |
+import autofill_dataset_generator |
import pyauto_functional # Must be imported before pyauto |
import pyauto |
@@ -104,7 +105,7 @@ |
'COMPANY_NAME': 'Company X', |
'PHONE_HOME_WHOLE_NUMBER': '650-123-4567',} |
url = self.GetHttpURLForDataPath( |
- os.path.join('autofill', 'dup-profiles-test.html')) |
+ os.path.join('autofill', 'duplicate_profiles_test.html')) |
self.NavigateToURL(url) |
for key, value in profile.iteritems(): |
script = ('document.getElementById("%s").value = "%s"; ' |
@@ -131,7 +132,7 @@ |
'COMPANY_NAME': 'Company X', |
'PHONE_HOME_WHOLE_NUMBER': '408-123-4567',} |
url = self.GetHttpURLForDataPath( |
- os.path.join('autofill', 'dup-profiles-test.html')) |
+ os.path.join('autofill', 'duplicate_profiles_test.html')) |
self.NavigateToURL(url) |
for key, value in profile.iteritems(): |
script = ('document.getElementById("%s").value = "%s"; ' |
@@ -147,6 +148,68 @@ |
if 'EMAIL_ADDRESS' in self.GetAutofillProfile()['profiles'][0]: |
raise KeyError('TEST FAIL: Malformed email address is saved in profiles.') |
+ def testComparePhoneNumbers(self): |
+ """Test phone fields parses correctly from a given profile.""" |
+ profile_path = os.path.join(self.DataDir(), 'autofill', |
+ 'phone_pinput_autofill.txt') |
+ profile_expected_path = os.path.join(self.DataDir(), 'autofill', |
+ 'phone_pexpected_autofill.txt') |
+ profiles = self.EvalDataFrom(profile_path) |
+ profiles_expected = self.EvalDataFrom(profile_expected_path) |
+ tab_keypress=0x09 |
+ down_keypress=0x28 |
+ return_keypress=0x0D |
Ilya Sherman
2011/03/18 23:17:11
Are these constants really not defined in the glob
dyu1
2011/03/21 18:42:35
PyAUto was never meant to interact with the browse
|
+ self.FillAutofillProfile(profiles=profiles) |
+ url = self.GetHttpURLForDataPath( |
+ os.path.join('autofill', 'form_phones.html')) |
+ for profile_expected in profiles_expected: |
+ self.NavigateToURL(url) |
+ self.SendWebkitKeyEvent(tab_keypress, tab_index=0, windex=0) |
+ self.SendWebkitKeyEvent(down_keypress, tab_index=0, windex=0) |
+ self.SendWebkitKeyEvent(down_keypress, tab_index=0, windex=0) |
+ self.SendWebkitKeyEvent(return_keypress, tab_index=0, windex=0) |
+ form_values = {} |
+ for key, value in profile_expected.iteritems(): |
+ js_returning_field_value = ( |
+ 'var field_value = document.getElementById("%s").value;' |
+ 'window.domAutomationController.send(field_value);' |
+ ) % key |
+ form_values[key] = self.ExecuteJavascript( |
+ js_returning_field_value, 0, 0) |
+ self.assertEqual( |
+ form_values[key], value, |
+ 'Original profile not equal to expected profile at key: "%s" \ |
+ \nExpected: "%s"\nReturned: "%s"' % (key, value, form_values[key])) |
+ |
+ def FormFillLatencyAfterSubmit(self): |
+ """Test latency time on form submit with lots of stored Autofill profiles. |
+ |
+ This test verifies when a profile is selected from the Autofill dictionary, |
+ that consists of thousands of profiles, the form does not hang after being |
+ submitted. |
+ """ |
+ # HTML file needs to be run from a http:// url. |
+ url = self.GetHttpURLForDataPath( |
+ os.path.join('autofill', 'latency_after_submit_test.html')) |
+ # Run the generator script to generate the dictionary list needed for the |
+ # profiles. |
+ gen = autofill_dataset_generator.DatasetGenerator( |
+ logging_level=logging.ERROR) # Set verbosity to INFO, WARNING, ERROR. |
Ilya Sherman
2011/03/18 23:17:11
nit: I think this comment ("Set verbosity...") is
dyu1
2011/03/21 18:42:35
Removed.
|
+ list_of_dict = gen.GenerateDataset(num_of_records_to_generate=50) |
Ilya Sherman
2011/03/18 23:17:11
Why 50 and not more like 1000?
dyu1
2011/03/21 18:42:35
I plan to change this to 1000 after I pass code re
Ilya Sherman
2011/03/22 01:18:58
Hmm... generally the idea of code review is to rev
dyu1
2011/03/22 02:52:35
I changed it to the value that was being reported
|
+ self.FillAutofillProfile(profiles=list_of_dict) |
+ tab_keypress=0x09 |
+ down_keypress=0x28 |
+ return_keypress=0x0D |
+ self.NavigateToURL(url) |
+ self.SendWebkitKeyEvent(tab_keypress, windex=0, tab_index=0) |
+ self.SendWebkitKeyEvent(down_keypress, windex=0, tab_index=0) |
+ self.SendWebkitKeyEvent(down_keypress, windex=0, tab_index=0) |
+ self.SendWebkitKeyEvent(return_keypress, windex=0, tab_index=0) |
+ # Requires manual intervention to test the performance time after submitted |
+ # the form. |
+ raw_input() |
Ilya Sherman
2011/03/18 23:17:11
Why do we need manual intervention? It would be g
dyu1
2011/03/21 18:42:35
There are no hooks exposed in pyauto to measure ti
|
+ |
+ |
def AutofillCrowdsourcing(self): |
"""Test able to send POST request of web form to Autofill server. |