Chromium Code Reviews| 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 |
| 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 |
| + 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'])): |
|
Nirnimesh
2011/02/07 22:20:02
Why not:
for profile in self.GetAutoFillProfile()[
dyu1
2011/02/07 23:06:59
The second for loop wont work as profile will be a
Nirnimesh
2011/02/07 23:26:19
for profile in self.GetAutoFillProfile()['profiles
|
| + self.NavigateToURL(url, 0, 0) |
|
Nirnimesh
2011/02/07 22:20:02
remove 0, 0
dyu1
2011/02/07 23:06:59
Done.
|
| + 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'] |
|
Nirnimesh
2011/02/07 22:20:02
Remove
dyu1
2011/02/07 23:06:59
Done.
|
| + import pickle |
| + # Write profile dictionary to a file. |
|
Nirnimesh
2011/02/07 22:20:02
Why?
dyu1
2011/02/07 23:06:59
Retrieve a data dump to compare against original d
|
| + profile_dict = self.GetAutoFillProfile()['profiles'] |
| + output = open('merged-profile.txt', 'wb') |
| + pickle.dump(profile_dict, output) |
| + output.close() |
|
Nirnimesh
2011/02/07 22:20:02
What's the objective of this test? Where do you te
dyu1
2011/02/07 23:06:59
Final test is a manual test to make sure the profi
|
| + |
| if __name__ == '__main__': |
| pyauto_functional.Main() |