Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2327)

Unified Diff: chrome/test/functional/autofill.py

Issue 6685077: Two sets of Autofill tests.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/functional/autofill.py
===================================================================
--- chrome/test/functional/autofill.py (revision 78965)
+++ chrome/test/functional/autofill.py (working copy)
@@ -1,5 +1,5 @@
#!/usr/bin/python
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -8,11 +8,15 @@
import pickle
import autofill_dataset_converter
+import autofill_dataset_generator
import pyauto_functional # Must be imported before pyauto
import pyauto
+TAB_KEYPRESS = 0x09 # Tab keyboard key press.
+DOWN_KEYPRESS = 0x28 # Down arrow keyboard key press.
+RETURN_KEYPRESS = 0x0D # Return keyboard key press.
-class AutofillTest(pyauto.PyUITest):
+class AutoFillTest(pyauto.PyUITest):
Ilya Sherman 2011/03/22 04:08:58 nit: This should be "AutofillTest" -- see http://c
dyu1 2011/03/24 19:46:51 Done.
"""Tests that autofill works correctly"""
def Debug(self):
@@ -104,7 +108,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 +135,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 +151,70 @@
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."""
dennis_jeffrey 2011/03/22 23:28:53 "fields parses" --> "fields parse"
dyu1 2011/03/24 19:46:51 Done.
+ 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)
+ self.FillAutofillProfile(profiles=profiles)
+ url = self.GetHttpURLForDataPath(
+ os.path.join('autofill', 'form_phones.html'))
+ for profile_expected in profiles_expected:
+ self.NavigateToURL(url)
+ # Tab keyboard key press.
+ self.SendWebkitKeyEvent(TAB_KEYPRESS, tab_index=0, windex=0)
+ # Down arrow keyboard key press.
+ self.SendWebkitKeyEvent(DOWN_KEYPRESS, tab_index=0, windex=0)
+ # Down arrow keyboard key press.
+ self.SendWebkitKeyEvent(DOWN_KEYPRESS, tab_index=0, windex=0)
+ # Return keyboard key press.
dennis_jeffrey 2011/03/22 23:28:53 Sorry I wasn't clear before: when I asked for comm
dyu1 2011/03/24 19:46:51 I added the high level steps in the description.
+ 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"\n'
+ 'Expected: "%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.
dennis_jeffrey 2011/03/22 23:28:53 Should probably also mention here that this test i
dyu1 2011/03/24 19:46:51 Done.
+ """
+ # 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)
+ list_of_dict = gen.GenerateDataset(num_of_dict_to_generate=1501)
dennis_jeffrey 2011/03/22 23:28:53 1501 is a bit of a weird number! Just curious if
dyu1 2011/03/24 19:46:51 Wanted more than 1500 profiles based on the bug. B
dennis_jeffrey 2011/03/25 16:56:14 What?!?! That's like an ice cream shop advertisin
+ self.FillAutofillProfile(profiles=list_of_dict)
+ self.NavigateToURL(url)
+ # Tab keyboard key press.
+ self.SendWebkitKeyEvent(TAB_KEYPRESS, windex=0, tab_index=0)
+ # Down arrow keyboard key press.
+ self.SendWebkitKeyEvent(DOWN_KEYPRESS, windex=0, tab_index=0)
+ # Down arrow keyboard key press.
+ self.SendWebkitKeyEvent(DOWN_KEYPRESS, windex=0, tab_index=0)
+ # Return keyboard key press.
dennis_jeffrey 2011/03/22 23:28:53 Similar comment as the one above at line 173.
dyu1 2011/03/24 19:46:51 Done.
+ self.SendWebkitKeyEvent(RETURN_KEYPRESS, windex=0, tab_index=0)
+ # Requires manual intervention to test the performance time after submitting
+ # the form.
+ raw_input()
+
+
def AutofillCrowdsourcing(self):
"""Test able to send POST request of web form to Autofill server.

Powered by Google App Engine
This is Rietveld 408576698