diff options
author | Takano.Naoki@gmail.com <Takano.Naoki@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-01 02:30:59 +0000 |
---|---|---|
committer | Takano.Naoki@gmail.com <Takano.Naoki@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-01 02:30:59 +0000 |
commit | a2383318bdcb1a7651a9e47720e03d9349781d77 (patch) | |
tree | 96b8a12b56d41a5208592837c9cddfabb6515a79 | |
parent | 32a17f358d058c6116362f32be6c58c77059ed3e (diff) | |
download | chromium_src-a2383318bdcb1a7651a9e47720e03d9349781d77.zip chromium_src-a2383318bdcb1a7651a9e47720e03d9349781d77.tar.gz chromium_src-a2383318bdcb1a7651a9e47720e03d9349781d77.tar.bz2 |
Add "ccfullname" for credit card holder name matching pattern.
"CCFullName" matches general name pattern, so Added "ccfullname" for credit card holder name matching pattern.
BUG=64569
TEST=CreditCardFieldTest.ParseCreditCardHolderNameWithCCFullName or run 15_crbug_64569.html
Review URL: http://codereview.chromium.org/7218070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91261 0039d316-1c4b-4281-b951-d872f2087c98
5 files changed, 396 insertions, 1 deletions
diff --git a/chrome/browser/autofill/autofill_resources.grd b/chrome/browser/autofill/autofill_resources.grd index 66eca35..b731457 100644 --- a/chrome/browser/autofill/autofill_resources.grd +++ b/chrome/browser/autofill/autofill_resources.grd @@ -64,7 +64,7 @@ e.?mail<!-- ja-JP -->|メールアドレス<!-- ru -->|Электронной.?Почты<!-- zh-CN -->|邮件|邮箱<!-- zh-TW -->|電郵地址<!-- ko-KR -->|(이메일|전자.?우편|[Ee]-?mail)(.?주소)? </message> <message name="IDS_AUTOFILL_NAME_ON_CARD_RE"> - card.?holder|name.?on.?card|ccname|owner<!-- de-DE -->|karteninhaber<!-- es -->|nombre.*tarjeta<!-- fr-FR -->|nom.*carte<!-- it-IT -->|nome.*cart<!-- ja-JP -->|名前<!-- ru -->|Имя.*карты<!-- zh-CN -->|信用卡开户名|开户名|持卡人姓名<!-- zh-TW -->|持卡人姓名 + card.?holder|name.?on.?card|ccname|ccfullname|owner<!-- de-DE -->|karteninhaber<!-- es -->|nombre.*tarjeta<!-- fr-FR -->|nom.*carte<!-- it-IT -->|nome.*cart<!-- ja-JP -->|名前<!-- ru -->|Имя.*карты<!-- zh-CN -->|信用卡开户名|开户名|持卡人姓名<!-- zh-TW -->|持卡人姓名 </message> <message name="IDS_AUTOFILL_NAME_ON_CARD_CONTEXTUAL_RE"> name diff --git a/chrome/browser/autofill/credit_card_field.h b/chrome/browser/autofill/credit_card_field.h index 94ae178..596a84f 100644 --- a/chrome/browser/autofill/credit_card_field.h +++ b/chrome/browser/autofill/credit_card_field.h @@ -32,6 +32,8 @@ class CreditCardField : public FormField { FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseFullCreditCardEcml); FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseExpMonthYear); FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, ParseExpMonthYear2); + FRIEND_TEST_ALL_PREFIXES(CreditCardFieldTest, + ParseCreditCardHolderNameWithCCFullName); CreditCardField(); diff --git a/chrome/browser/autofill/credit_card_field_unittest.cc b/chrome/browser/autofill/credit_card_field_unittest.cc index 626a39c..c65a5bc 100644 --- a/chrome/browser/autofill/credit_card_field_unittest.cc +++ b/chrome/browser/autofill/credit_card_field_unittest.cc @@ -400,3 +400,21 @@ TEST_F(CreditCardFieldTest, ParseExpMonthYear2) { EXPECT_EQ(CREDIT_CARD_EXP_4_DIGIT_YEAR, field_type_map_[ASCIIToUTF16("year")]); } + +TEST_F(CreditCardFieldTest, ParseCreditCardHolderNameWithCCFullName) { + list_.push_back( + new AutofillField(webkit_glue::FormField(ASCIIToUTF16("Name"), + ASCIIToUTF16("ccfullname"), + string16(), + ASCIIToUTF16("text"), + 0, + false), + ASCIIToUTF16("name1"))); + AutofillScanner scanner(list_.get()); + field_.reset(Parse(&scanner, false)); + ASSERT_NE(static_cast<CreditCardField*>(NULL), field_.get()); + ASSERT_TRUE(field_->ClassifyField(&field_type_map_)); + ASSERT_TRUE( + field_type_map_.find(ASCIIToUTF16("name1")) != field_type_map_.end()); + EXPECT_EQ(CREDIT_CARD_NAME, field_type_map_[ASCIIToUTF16("name1")]); +} diff --git a/chrome/test/data/autofill/heuristics/input/15_crbug_64569.html b/chrome/test/data/autofill/heuristics/input/15_crbug_64569.html new file mode 100644 index 0000000..fadec1a --- /dev/null +++ b/chrome/test/data/autofill/heuristics/input/15_crbug_64569.html @@ -0,0 +1,363 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"> +<!-- saved from url=(0049)https://www.threadless.com/cart/step/billing-info --> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml" version="XHTML+RDFa 1.0" class="wf-kulturistaweb1kulturistaweb2-n4-active wf-kulturistaweb1kulturistaweb2-i4-active wf-futurapt1futurapt2-n7-active wf-futurapt1futurapt2-n8-active wf-ronniacondensed1ronniacondensed2-n7-active wf-active"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + --> + + <form method="post" id="checkoutForm" action="./three.com_files/three.com.html" name="cartform"> + <div class="section radio"> + <h2>Payment Type</h2> + <div class="col"> + <p> + <input id="cc" type="radio" name="payment_group" value="cc" onclick="togglePayment()" checked=""> + <label><img src="./three.com_files/creditCards.gif" width="172" height="23" alt="Mastercard, Visa, American Express, Discover"></label> + </p> + <p> + <input id="paypal" type="radio" name="payment_group" value="paypal" onclick="togglePayment()"> + <label><img src="./three.com_files/payPal.gif" width="37" height="23" alt="Paypal"></label> + </p> + </div> + <div class="col"> + <p>We accept Visa, Mastercard, Discover, American Express, and PayPal.</p> + </div> + </div> + + <div id="billing_inner_container"> + <div class="section"> + <h2>Enter your credit card information</h2> + <div id="card_info" class="col"> + <p> + <label>Your name</label> + <span class="guide"> + (as it appears on the card) + </span> + <input id="" name="ccFullName" maxlength="255" type="text" class="long"> + </p> + + <p> + <label>Credit card number</label> + <span class="guide"> + (no dashes or spaces) + </span> + <input id="" name="ccNumber" maxlength="16" type="text" autocomplete="off" class="long"> + </p> + + <p class="pair"> + <label>Expiration date</label> + <select name="ccExpMonth"> + <option value="1" selected="">01 - January </option><option value="2">02 - February </option><option value="3">03 - March </option><option value="4">04 - April </option><option value="5">05 - May </option><option value="6">06 - June </option><option value="7">07 - July </option><option value="8">08 - August </option><option value="9">09 - September </option><option value="10">10 - October </option><option value="11">11 - November </option><option value="12">12 - December </option></select> + <select name="ccExpYear"> + <option value="2011">2011</option><option value="2012">2012</option><option value="2013">2013</option><option value="2014">2014</option><option value="2015">2015</option><option value="2016">2016</option><option value="2017">2017</option><option value="2018">2018</option><option value="2019">2019</option><option value="2020">2020</option><option value="2021">2021 </option></select> + </p> + + <div class="card_security"> + <p> + <label>Security code</label> + <input id="" name="ccSecurity" type="text" maxlength="4" autocomplete="off" class="short"> + </p> + + <div class="card_guide"> + <h3>Where do I find it?</h3> + <h4>Visa & Mastercard:</h4> + <p><img src="./three.com_files/cc_code_1.gif" width="80" height="43"><span>3-digit code</span></p> + <h4>American Express:</h4> + <p><img src="./three.com_files/cc_code_2.gif" width="80" height="43"><span>4-digit code</span></p> + </div><!-- END .card_guide --> + </div><!-- END #card_security --> + </div><!-- END #card_info --> + </div><!-- END .section --> + + + <div class="section"> + <h2>Enter your credit card billing address</h2> + <div id="billing_address" class="col"> + <p class="checkbox"> + <input type="checkbox" name="sameinfo" onclick="toggleInfo();"><label>Same as shipping address?</label> + </p> + + <p class="mini_col"> + <label>First name</label> + <input type="text" class="medium" maxlength="60" id="" name="addrFirstName" value=""> + </p> + + <p class="mini_col"> + <label>Last name</label> + <input type="text" class="medium" maxlength="60" id="" name="addrLastName" value=""> + </p> + + <p> + <label>Address</label> + <span class="guide"> + <em>(street address, PO box, company name)</em> + </span> + <input type="text" class="long" maxlength="50" id="" name="addrStreet1" value=""> + </p> + + <p> + <label>Address 2</label> + <span class="guide"> + <em>(apt, suite, building, floor, etc)</em> + </span> + <input type="text" class="long" id="" maxlength="50" name="addrStreet2" value=""> + </p> + + <p> + <label>City</label> + <input type="text" class="long" id="" maxlength="50" name="addrCity" size="20" value=""> + </p> + + <p class="mini_col one"> + <label>State</label> + <select name="addrState"><option value=" ">None</option> +<option value="AL">Alabama</option> +<option value="AK">Alaska</option> +<option value="AZ">Arizona</option> +<option value="AR">Arkansas</option> +<option value="CA">California</option> +<option value="CO">Colorado</option> +<option value="CT">Connecticut</option> +<option value="DC">District of Columbia</option> +<option value="DE">Delaware</option> +<option value="FL">Florida</option> +<option value="GA">Georgia</option> +<option value="HI">Hawaii</option> +<option value="ID">Idaho</option> +<option value="IL">Illinois</option> +<option value="IN">Indiana</option> +<option value="IA">Iowa</option> +<option value="KS">Kansas</option> +<option value="KY">Kentucky</option> +<option value="LA">Louisiana</option> +<option value="ME">Maine</option> +<option value="MD">Maryland</option> +<option value="MA">Massachusetts</option> +<option value="MI">Michigan</option> +<option value="MN">Minnesota</option> +<option value="MS">Mississippi</option> +<option value="MO">Missouri</option> +<option value="MT">Montana</option> +<option value="NE">Nebraska</option> +<option value="NV">Nevada</option> +<option value="NH">New Hampshire</option> +<option value="NJ">New Jersey</option> +<option value="NM">New Mexico</option> +<option value="NY">New York</option> +<option value="NC">North Carolina</option> +<option value="ND">North Dakota</option> +<option value="OH">Ohio</option> +<option value="OK">Oklahoma</option> +<option value="OR">Oregon</option> +<option value="PA">Pennsylvania</option> +<option value="RI">Rhode Island</option> +<option value="SC">South Carolina</option> +<option value="SD">South Dakota</option> +<option value="TN">Tennessee</option> +<option value="TX">Texas</option> +<option value="UT">Utah</option> +<option value="VT">Vermont</option> +<option value="VA">Virginia</option> +<option value="WA">Washington</option> +<option value="WV">West Virginia</option> +<option value="DC">Washington D.C.</option> +<option value="WI">Wisconsin</option> +<option value="WY">Wyoming</option> +<option value="AB">Alberta</option> +<option value="BC">British Columbia</option> +<option value="MB">Manitoba</option> +<option value="NB">New Brunswick</option> +<option value="NL">Newfoundland/Labrador</option> +<option value="NT">Northwest Territories</option> +<option value="NS">Nova Scotia</option> +<option value="NU">Nunavut</option> +<option value="ON">Ontario</option> +<option value="PE">Prince Edward Island</option> +<option value="QC">Quebec</option> +<option value="SK">Saskatchewan</option> +<option value="YT">Yukon Territories</option> +<option value="PR">PR</option> +<option value="VI">VI</option> +<option value="GU">GU</option> +<option value="FM">FM</option> +<option value="AE">AE</option> +<option value="AA">AA</option> +<option value="AP">AP</option> +<option value="MP">MP</option> +<option value="ACT">ACT</option> +<option value="JBT">JBT</option> +<option value="NSW">NSW</option> +<option value="NT">NT</option> +<option value="QLD">QLD</option> +<option value="SA">SA</option> +<option value="TAS">TAS</option> +<option value="VIC">VIC</option> +<option value="WA">WA</option> +</select> </p> + + <p class="mini_col two"> + <label>Postal code</label> + <input type="text" class="short" maxlength="50" id="" name="addrZip" size="10" value=""> + </p> + + <p> + <label>Country</label> + Algeria </p> + </div><!-- END #billing_address --> + + <div id="billing_faqs" class="col"> + <h3>Can shipping and billing addresses be different?</h3> + <p>As long as the billing and shipping addresses are in the same country, you can use different billing and shipping addresses.</p> + <h3>When will my credit card be charged?</h3> + <p>Your card will be charged when you click the PLACE YOUR ORDER button in the next step.</p> + <h3>How do you secure my online privacy?</h3> + <p>Threadless is a certified licensee of the TRUSTe® Privacy Seal Program. The privacy statement and practices of http://www.threadless.com have been reviewed by TRUSTe for compliance with our strict program requirements.</p> + <p> + <a href="http://www.truste.org/ivalidate.php?url=www.threadless.com&sealid=101"><img src="./three.com_files/truste_cart.gif" width="154" height="42"></a> + </p> + </div><!-- END #billing_faqs --> + </div><!-- END .section --> + </div><!-- END #billing_inner_container --> + <p class="cart_step_button"> + <input type="hidden" name="verify" value="1"> + <a class="cc_link" href="javascript:$j('#checkoutForm').submit();">Last step, verify then place your order!</a> + <a class="paypal_link" href="javascript:$j('#checkoutForm').submit();">Continue to PayPal</a> + </p> + </form><!-- END form --> + </div><!-- END billing_container --> + + </div><!-- END .main_left_4 m_r_20 --> +<!-- </div>where is this opening div ? --> +<div class="main_left_2"> + +<div id="cart_right_top"></div> + +<div class="step_image"> + <div><img src="./three.com_files/1_off.gif" width="80" height"33"=""></div> + <div><a href="https://www.threadless.com/cart/step/shipping-info">Edit</a></div> +</div> +<div class="step_image"> + <div><img src="./three.com_files/2_on.gif" width="80" height"33"=""></div> + <div>Now</div> +</div> +<div class="step_image"> + <div><img src="./three.com_files/3_off.gif" width="80" height"33"=""></div> + <div>Next</div> +</div> + +<br> + +<div class="cart_right"> + + <div class="m_b_10 cart_header_faq"> In your cart <a href="https://www.threadless.com/cart"><img src="./three.com_files/btn_edit.gif" align="absmiddle"></a></div> + + <div class="f_14"><a href="https://www.threadless.com/product/3016/Hugs_Keep_Us_Alive">Hugs Keep Us Alive!</a></div> + <div class="m_b_10 grey">(1) Large Silver Guys Tee</div> + + + <br> + <div class="b_t_dotted m_b_20"></div> + + <div class="m_b_10 cart_header_faq"> Order summary</div> + + <div class="grey m_b_5">Item(s) cost: <span class="arial">$20.00</span></div> + <div class="grey m_b_5">Shipping cost: <span class="arial">$9.00</span></div> + <div class="grey m_b_5">Tax: <span class="arial">$0.00</span></div> + <div class="b_t_dotted m_b_5"></div> + <div class="f_14 m_b_5">Subtotal: <span class="arial">$29.00</span></div> + + <div class="b_t_dotted m_b_10"></div> + + + <div class="cart_header_faq m_b_10"> + Total cost: <span class="arial">$29.00</span> + </div> + <div class="grey">The total cost is the amount that will be charged to you.</div> + + </div> </div> + +<div class="clear_both"></div> +<div class="clear_both"></div> +</div> + + + </div><!-- END .contentMain --> + +<!-- included by footer.tpl and bot.tpl --> +<div class="footer_container"> + <footer> + <section class="we_like_you"> + <div class="like_graphic"> + <iframe src="./three.com_files/likebox.html" scrolling="no" frameborder="0" style="border:none; height:55px; margin: -10px 0 0 -10px; overflow:hidden; width:222px;" allowtransparency="true"></iframe> + </div> + <h5 class="like_coupon"><a title="Like us on facebook!" href="http://www.facebook.com/threadless" target="_blank">We like you! You should like us on Facebook for exclusive offers and awesome awesomeness!</a></h5> + </section> + <section class="shop"> + <h3><a href="https://www.threadless.com/shop">Shop</a></h3> + <ul> + <li><a href="https://www.threadless.com/catalog/type,guys">Guys</a></li> + <li><a href="https://www.threadless.com/catalog/type,girly">Girly</a></li> + <li><a href="https://www.threadless.com/catalog/type,babies">Babies</a></li> + <li><a href="https://www.threadless.com/catalog/type,kids">Kids</a></li> + <li><a href="https://www.threadless.com/shop/otherstuff">Other Stuff</a></li> + <li><a href="https://www.threadless.com/shop/displayart">Display Art</a></li> + <li><a href="https://www.threadless.com/catalog/soldout,true">Bring 'em Back</a></li> + <li><a href="https://www.threadless.com/12club">12 Month Tee Club</a></li> + <li><a href="https://www.threadless.com/product/41/GiftCertificates">Gift Certificates</a></li> + <li><a href="https://www.threadless.com/partners">Partners</a></li> + <li><a href="http://www.society6.com/shop/collection/threadless?curator=skaw&utm_source=threadless&utm_medium=text&utm_content=footer&utm_campaign=collection" class="window" target="_blank">Threadless Collection</a></li> + <li><a href="https://www.threadless.com/shop/clearance" class="ups">Clearance</a></li> + </ul> + </section><!-- END .shop --> + + <section class="participate"> + <h3><a href="https://www.threadless.com/submissions">Participate</a></h3> + <ul> + <li><a href="https://www.threadless.com/submissions">Score Designs </a></li> + <li><a href="https://www.threadless.com/submit">Submit Designs</a></li> + <li><a href="https://www.threadless.com/slogans">Score & Submit Slogans</a></li> + <li><a href="https://www.threadless.com/loves">Design Challenges</a></li> + <li><a href="https://www.threadless.com/gallery">Tee-riffic Photos </a></li> + <li><a href="https://www.threadless.com/bt/year,2010">The Bestee Awards</a></li> + <li><a href="https://www.threadless.com/live">Threadless Live</a></li> + </ul> + </section><!-- END .participate --> + + <section class="community"> + <h3><a href="https://www.threadless.com/blogs">Community</a></h3> + <ul> + <li><a href="https://www.threadless.com/blogs">Forum</a></li> + <li><a href="https://www.threadless.com/tv">Tee-V</a></li> + <li><a href="https://www.threadless.com/artists">Artist Programs</a></li> + <li><a href="https://www.threadless.com/interviews">Designer Interviews</a></li> + <li><a href="https://www.threadless.com/sightings">Threadspotting</a></li> + <li><a href="https://www.threadless.com/streetteam">Street Team</a></li> + <li><a href="http://www.meetup.com/Threadless/" class="window" target="_blank">Meetups</a></li> + + </ul> + </section><!-- END .community --> + + <section class="info"> + <h3><a href="https://www.threadless.com/news">Info</a></h3> + <ul> + <li><a href="https://www.threadless.com/news">ThreadStaff Blog</a></li> + <li><a href="https://www.threadless.com/help">Help</a></li> + <li><a href="https://www.threadless.com/retail">Retail Stores</a></li> + <li><a href="https://www.threadless.com/wholesale/">Wholesale</a></li> + <li><a href="https://www.threadless.com/jobs">Jobs</a></li> + <li><a href="https://www.threadless.com/contact">Contact Us</a></li> + </ul> + </section><!-- END .info --> + + <section class="contact vcard"> + <h3>Newsletter</h3> + <span class="fn org">Threadless</span> + <form action="https://www.threadless.com/newsletter" method="post" class="newsletter_signup_form"> + <fieldset> + <label for="newsletter_signup_email" class="hide">Enter your email address</label> + <input for="newsletter_signup_email_footer" name="email" type="email" placeholder="Enter your email address"> + <input id="newsletter_signup_email_footer_submit" name="submit" type="submit" value="Join"> + <!--<input id="newsletter_signup_email_footer_submit" name="submit" type="image" class="submit" value="Join us" src="https://www.threadless.com//imgs/clear.gif" />--> + </fieldset> + <div style="display: none"> + <img src="./three.com_files/loading.gif" alt="Loading..." title=""> Submitting… + </div> +</form> +</body></html> diff --git a/chrome/test/data/autofill/heuristics/output/15_crbug_64569.out b/chrome/test/data/autofill/heuristics/output/15_crbug_64569.out new file mode 100644 index 0000000..156dd04 --- /dev/null +++ b/chrome/test/data/autofill/heuristics/output/15_crbug_64569.out @@ -0,0 +1,12 @@ +CREDIT_CARD_NAME +CREDIT_CARD_NUMBER +CREDIT_CARD_EXP_MONTH +CREDIT_CARD_EXP_4_DIGIT_YEAR +UNKNOWN_TYPE +NAME_FIRST +NAME_LAST +COMPANY_NAME +ADDRESS_HOME_LINE1 +ADDRESS_HOME_CITY +ADDRESS_HOME_STATE +ADDRESS_HOME_ZIP |