Index: chrome/test/functional/autofill.py |
=================================================================== |
--- chrome/test/functional/autofill.py (revision 74022) |
+++ chrome/test/functional/autofill.py (working copy) |
@@ -93,9 +93,9 @@ |
self.assertEqual([expected_credit_card], |
self.GetAutoFillProfile()['credit_cards']) |
- def testAutofillCrowdSourcing(self): |
- """Test able to send POST request of web form to crowd source server. |
- Require a loop of 1000 submits as the source server only collects 1% of |
+ def testAutofillCrowdsourcing(self): |
+ """Test able to send POST request of web form to toolbar server. |
+ Require a loop of 1000 submits as the toolbar server only collects 1% of |
Ilya Sherman
2011/02/07 21:39:04
nit: "Autofill server" is probably more appropriat
dyu1
2011/02/07 23:06:58
Done.
|
the data posted.""" |
# HTML file needs to be run from a specific http:// url to be able to verify |
# the results a few days later by visiting the same url. |
@@ -124,6 +124,35 @@ |
'window.domAutomationController.send("done")', |
0, 0) |
+ def testMergeDuplicateProfilesInAutofill(self): |
+ """Test Autofill ability to merge duplicate profiles and throw away junk |
+ profiles. The goal is to submit a couple hundre profiles and see the merge |
Ilya Sherman
2011/02/07 21:39:04
nit: "hundred"
dyu1
2011/02/07 23:06:58
Done.
|
+ outcome.""" |
+ # HTML file needs to be run from a http:// url. |
+ url = self.GetHttpURLForDataPath( |
+ os.path.join('autofill', 'dup-profiles-test.html')) |
+ # Add and set Autofill profiles. |
+ file_path = os.path.join(self.DataDir(), 'autofill', |
+ 'dataset_duplicate-profiles.txt') |
+ profiles = self.EvalDataFrom(file_path) |
+ self.FillAutoFillProfile(profiles=profiles) |
+ for i in range(len(self.GetAutoFillProfile()['profiles'])): |
+ self.NavigateToURL(url, 0, 0) |
+ for key, value in self.GetAutoFillProfile()['profiles'][i].iteritems(): |
+ script = 'document.getElementById("%s").value = "%s"; ' \ |
+ 'window.domAutomationController.send("done")' % (key, value) |
+ self.ExecuteJavascript(script, 0, 0) |
+ self.ExecuteJavascript('document.getElementById("merge_dup").submit();' |
+ 'window.domAutomationController.send("done")', |
+ 0, 0) |
+ print self.GetAutoFillProfile()['profiles'] |
+ import pickle |
Ilya Sherman
2011/02/07 21:39:04
nit: Are inline imports ok? I really don't know t
dyu1
2011/02/07 23:06:58
Done.
|
+ # Write profile dictionary to a file. |
+ profile_dict = self.GetAutoFillProfile()['profiles'] |
+ output = open('merged-profile.txt', 'wb') |
+ pickle.dump(profile_dict, output) |
+ output.close() |
+ |
if __name__ == '__main__': |
pyauto_functional.Main() |