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

Side by Side Diff: chrome/browser/autofill/personal_data_manager_unittest.cc

Issue 6368067: Autofill should filter malformed emails addresses when form is submitted (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome
Patch Set: Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 536
537 AutoFillProfile expected; 537 AutoFillProfile expected;
538 autofill_test::SetProfileInfo(&expected, NULL, "George", NULL, 538 autofill_test::SetProfileInfo(&expected, NULL, "George", NULL,
539 "Washington", "theprez@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, 539 "Washington", "theprez@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL,
540 NULL, NULL, NULL); 540 NULL, NULL, NULL);
541 const std::vector<AutoFillProfile*>& results = personal_data_->profiles(); 541 const std::vector<AutoFillProfile*>& results = personal_data_->profiles();
542 ASSERT_EQ(1U, results.size()); 542 ASSERT_EQ(1U, results.size());
543 EXPECT_EQ(0, expected.Compare(*results[0])); 543 EXPECT_EQ(0, expected.Compare(*results[0]));
544 } 544 }
545 545
546 TEST_F(PersonalDataManagerTest, ImportFormDataBadEmail) {
Ilya Sherman 2011/02/03 04:24:20 nit: This test needs to updated for your other CL,
dhollowa 2011/02/03 16:23:02 Yes, merged.
547 FormData form;
548 webkit_glue::FormField field;
549 autofill_test::CreateTestFormField(
550 "First name:", "first_name", "George", "text", &field);
551 form.fields.push_back(field);
552 autofill_test::CreateTestFormField(
553 "Last name:", "last_name", "Washington", "text", &field);
554 form.fields.push_back(field);
555 autofill_test::CreateTestFormField(
556 "Company:", "company", "Government", "text", &field);
557 form.fields.push_back(field);
558 autofill_test::CreateTestFormField(
559 "Email:", "email", "bogus", "text", &field);
560 form.fields.push_back(field);
561 FormStructure form_structure(form);
562 std::vector<const FormStructure*> forms;
563 forms.push_back(&form_structure);
564 EXPECT_TRUE(personal_data_->ImportFormData(forms));
565
566 // Wait for the refresh.
567 EXPECT_CALL(personal_data_observer_,
568 OnPersonalDataLoaded()).WillOnce(QuitUIMessageLoop());
569
570 MessageLoop::current()->Run();
571
572 AutoFillProfile expected;
573 autofill_test::SetProfileInfo(&expected, NULL, "George", NULL,
574 "Washington", NULL, "Government", NULL, NULL, NULL, NULL, NULL,
575 NULL, NULL, NULL);
576 const std::vector<AutoFillProfile*>& results = personal_data_->profiles();
577 ASSERT_EQ(1U, results.size());
578 EXPECT_EQ(0, expected.Compare(*results[0]));
579 }
580
546 TEST_F(PersonalDataManagerTest, ImportFormDataNotEnoughFilledFields) { 581 TEST_F(PersonalDataManagerTest, ImportFormDataNotEnoughFilledFields) {
547 FormData form; 582 FormData form;
548 webkit_glue::FormField field; 583 webkit_glue::FormField field;
549 autofill_test::CreateTestFormField( 584 autofill_test::CreateTestFormField(
550 "First name:", "first_name", "George", "text", &field); 585 "First name:", "first_name", "George", "text", &field);
551 form.fields.push_back(field); 586 form.fields.push_back(field);
552 autofill_test::CreateTestFormField( 587 autofill_test::CreateTestFormField(
553 "Last name:", "last_name", "Washington", "text", &field); 588 "Last name:", "last_name", "Washington", "text", &field);
554 form.fields.push_back(field); 589 form.fields.push_back(field);
555 autofill_test::CreateTestFormField( 590 autofill_test::CreateTestFormField(
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 1415
1381 // Expect that the newer information is saved. In this case the year is 1416 // Expect that the newer information is saved. In this case the year is
1382 // added to the existing credit card. 1417 // added to the existing credit card.
1383 CreditCard expected2; 1418 CreditCard expected2;
1384 autofill_test::SetCreditCardInfo(&expected2, 1419 autofill_test::SetCreditCardInfo(&expected2,
1385 "L1", "Biggie Smalls", "4111111111111111", "01", "2011"); 1420 "L1", "Biggie Smalls", "4111111111111111", "01", "2011");
1386 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards(); 1421 const std::vector<CreditCard*>& results2 = personal_data_->credit_cards();
1387 ASSERT_EQ(1U, results2.size()); 1422 ASSERT_EQ(1U, results2.size());
1388 EXPECT_EQ(0, expected2.Compare(*results2[0])); 1423 EXPECT_EQ(0, expected2.Compare(*results2[0]));
1389 } 1424 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698