OLD | NEW |
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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/ref_counted.h" | 7 #include "base/ref_counted.h" |
8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
9 #include "base/scoped_vector.h" | 9 #include "base/scoped_vector.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 return true; | 273 return true; |
274 } | 274 } |
275 | 275 |
276 protected: | 276 protected: |
277 scoped_ptr<TestAutoFillManager> autofill_manager_; | 277 scoped_ptr<TestAutoFillManager> autofill_manager_; |
278 | 278 |
279 private: | 279 private: |
280 DISALLOW_COPY_AND_ASSIGN(AutoFillManagerTest); | 280 DISALLOW_COPY_AND_ASSIGN(AutoFillManagerTest); |
281 }; | 281 }; |
282 | 282 |
283 TEST_F(AutoFillManagerTest, GetProfileSuggestionsEmptyValue) { | 283 // TODO(georgey): All of these tests crash in official |
| 284 // builds. http://crbug.com/50537 |
| 285 #if defined(GOOGLE_CHROME_BUILD) |
| 286 #define SKIP_BRANDED(test) DISABLED_##test |
| 287 #else |
| 288 #define SKIP_BRANDED(test) test |
| 289 #endif |
| 290 |
| 291 TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetProfileSuggestionsEmptyValue)) { |
284 FormData form; | 292 FormData form; |
285 CreateTestFormData(&form); | 293 CreateTestFormData(&form); |
286 | 294 |
287 // Set up our FormStructures. | 295 // Set up our FormStructures. |
288 std::vector<FormData> forms; | 296 std::vector<FormData> forms; |
289 forms.push_back(form); | 297 forms.push_back(form); |
290 autofill_manager_->FormsSeen(forms); | 298 autofill_manager_->FormsSeen(forms); |
291 | 299 |
292 // The page ID sent to the AutoFillManager from the RenderView, used to send | 300 // The page ID sent to the AutoFillManager from the RenderView, used to send |
293 // an IPC message back to the renderer. | 301 // an IPC message back to the renderer. |
(...skipping 17 matching lines...) Expand all Loading... |
311 ASSERT_EQ(2U, values.size()); | 319 ASSERT_EQ(2U, values.size()); |
312 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); | 320 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); |
313 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); | 321 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); |
314 ASSERT_EQ(2U, labels.size()); | 322 ASSERT_EQ(2U, labels.size()); |
315 // Inferred labels now include full first relevant field, which in this case | 323 // Inferred labels now include full first relevant field, which in this case |
316 // the address #1. | 324 // the address #1. |
317 EXPECT_EQ(ASCIIToUTF16("3734 Elvis Presley Blvd."), labels[0]); | 325 EXPECT_EQ(ASCIIToUTF16("3734 Elvis Presley Blvd."), labels[0]); |
318 EXPECT_EQ(ASCIIToUTF16("123 Apple St."), labels[1]); | 326 EXPECT_EQ(ASCIIToUTF16("123 Apple St."), labels[1]); |
319 } | 327 } |
320 | 328 |
321 TEST_F(AutoFillManagerTest, GetProfileSuggestionsMatchCharacter) { | 329 TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetProfileSuggestionsMatchCharacter)) { |
322 FormData form; | 330 FormData form; |
323 CreateTestFormData(&form); | 331 CreateTestFormData(&form); |
324 | 332 |
325 // Set up our FormStructures. | 333 // Set up our FormStructures. |
326 std::vector<FormData> forms; | 334 std::vector<FormData> forms; |
327 forms.push_back(form); | 335 forms.push_back(form); |
328 autofill_manager_->FormsSeen(forms); | 336 autofill_manager_->FormsSeen(forms); |
329 | 337 |
330 // The page ID sent to the AutoFillManager from the RenderView, used to send | 338 // The page ID sent to the AutoFillManager from the RenderView, used to send |
331 // an IPC message back to the renderer. | 339 // an IPC message back to the renderer. |
(...skipping 13 matching lines...) Expand all Loading... |
345 std::vector<string16> values; | 353 std::vector<string16> values; |
346 std::vector<string16> labels; | 354 std::vector<string16> labels; |
347 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); | 355 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); |
348 EXPECT_EQ(kPageID, page_id); | 356 EXPECT_EQ(kPageID, page_id); |
349 ASSERT_EQ(1U, values.size()); | 357 ASSERT_EQ(1U, values.size()); |
350 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); | 358 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); |
351 ASSERT_EQ(1U, labels.size()); | 359 ASSERT_EQ(1U, labels.size()); |
352 EXPECT_EQ(ASCIIToUTF16("3734 Elvis Presley Blvd."), labels[0]); | 360 EXPECT_EQ(ASCIIToUTF16("3734 Elvis Presley Blvd."), labels[0]); |
353 } | 361 } |
354 | 362 |
355 TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsEmptyValue) { | 363 TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetCreditCardSuggestionsEmptyValue)) { |
356 FormData form; | 364 FormData form; |
357 CreateTestFormDataBilling(&form); | 365 CreateTestFormDataBilling(&form); |
358 | 366 |
359 // Set up our FormStructures. | 367 // Set up our FormStructures. |
360 std::vector<FormData> forms; | 368 std::vector<FormData> forms; |
361 forms.push_back(form); | 369 forms.push_back(form); |
362 autofill_manager_->FormsSeen(forms); | 370 autofill_manager_->FormsSeen(forms); |
363 | 371 |
364 // The page ID sent to the AutoFillManager from the RenderView, used to send | 372 // The page ID sent to the AutoFillManager from the RenderView, used to send |
365 // an IPC message back to the renderer. | 373 // an IPC message back to the renderer. |
(...skipping 23 matching lines...) Expand all Loading... |
389 EXPECT_EQ(ASCIIToUTF16("************8765"), values[5]); | 397 EXPECT_EQ(ASCIIToUTF16("************8765"), values[5]); |
390 ASSERT_EQ(6U, labels.size()); | 398 ASSERT_EQ(6U, labels.size()); |
391 EXPECT_EQ(ASCIIToUTF16("Home; *3456"), labels[0]); | 399 EXPECT_EQ(ASCIIToUTF16("Home; *3456"), labels[0]); |
392 EXPECT_EQ(ASCIIToUTF16("Work; *3456"), labels[1]); | 400 EXPECT_EQ(ASCIIToUTF16("Work; *3456"), labels[1]); |
393 EXPECT_EQ(ASCIIToUTF16("Empty; *3456"), labels[2]); | 401 EXPECT_EQ(ASCIIToUTF16("Empty; *3456"), labels[2]); |
394 EXPECT_EQ(ASCIIToUTF16("Home; *8765"), labels[3]); | 402 EXPECT_EQ(ASCIIToUTF16("Home; *8765"), labels[3]); |
395 EXPECT_EQ(ASCIIToUTF16("Work; *8765"), labels[4]); | 403 EXPECT_EQ(ASCIIToUTF16("Work; *8765"), labels[4]); |
396 EXPECT_EQ(ASCIIToUTF16("Empty; *8765"), labels[5]); | 404 EXPECT_EQ(ASCIIToUTF16("Empty; *8765"), labels[5]); |
397 } | 405 } |
398 | 406 |
399 TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsMatchCharacter) { | 407 TEST_F(AutoFillManagerTest, |
| 408 SKIP_BRANDED(GetCreditCardSuggestionsMatchCharacter)) { |
400 FormData form; | 409 FormData form; |
401 CreateTestFormDataBilling(&form); | 410 CreateTestFormDataBilling(&form); |
402 | 411 |
403 // Set up our FormStructures. | 412 // Set up our FormStructures. |
404 std::vector<FormData> forms; | 413 std::vector<FormData> forms; |
405 forms.push_back(form); | 414 forms.push_back(form); |
406 autofill_manager_->FormsSeen(forms); | 415 autofill_manager_->FormsSeen(forms); |
407 | 416 |
408 // The page ID sent to the AutoFillManager from the RenderView, used to send | 417 // The page ID sent to the AutoFillManager from the RenderView, used to send |
409 // an IPC message back to the renderer. | 418 // an IPC message back to the renderer. |
(...skipping 17 matching lines...) Expand all Loading... |
427 ASSERT_EQ(3U, values.size()); | 436 ASSERT_EQ(3U, values.size()); |
428 EXPECT_EQ(ASCIIToUTF16("************3456"), values[0]); | 437 EXPECT_EQ(ASCIIToUTF16("************3456"), values[0]); |
429 EXPECT_EQ(ASCIIToUTF16("************3456"), values[1]); | 438 EXPECT_EQ(ASCIIToUTF16("************3456"), values[1]); |
430 EXPECT_EQ(ASCIIToUTF16("************3456"), values[2]); | 439 EXPECT_EQ(ASCIIToUTF16("************3456"), values[2]); |
431 ASSERT_EQ(3U, labels.size()); | 440 ASSERT_EQ(3U, labels.size()); |
432 EXPECT_EQ(ASCIIToUTF16("Home; *3456"), labels[0]); | 441 EXPECT_EQ(ASCIIToUTF16("Home; *3456"), labels[0]); |
433 EXPECT_EQ(ASCIIToUTF16("Work; *3456"), labels[1]); | 442 EXPECT_EQ(ASCIIToUTF16("Work; *3456"), labels[1]); |
434 EXPECT_EQ(ASCIIToUTF16("Empty; *3456"), labels[2]); | 443 EXPECT_EQ(ASCIIToUTF16("Empty; *3456"), labels[2]); |
435 } | 444 } |
436 | 445 |
437 TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsNonCCNumber) { | 446 TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetCreditCardSuggestionsNonCCNumber)) { |
438 FormData form; | 447 FormData form; |
439 CreateTestFormDataBilling(&form); | 448 CreateTestFormDataBilling(&form); |
440 | 449 |
441 // Set up our FormStructures. | 450 // Set up our FormStructures. |
442 std::vector<FormData> forms; | 451 std::vector<FormData> forms; |
443 forms.push_back(form); | 452 forms.push_back(form); |
444 autofill_manager_->FormsSeen(forms); | 453 autofill_manager_->FormsSeen(forms); |
445 | 454 |
446 // The page ID sent to the AutoFillManager from the RenderView, used to send | 455 // The page ID sent to the AutoFillManager from the RenderView, used to send |
447 // an IPC message back to the renderer. | 456 // an IPC message back to the renderer. |
(...skipping 23 matching lines...) Expand all Loading... |
471 EXPECT_EQ(ASCIIToUTF16("Buddy Holly"), values[5]); | 480 EXPECT_EQ(ASCIIToUTF16("Buddy Holly"), values[5]); |
472 ASSERT_EQ(6U, labels.size()); | 481 ASSERT_EQ(6U, labels.size()); |
473 EXPECT_EQ(ASCIIToUTF16("Home; *3456"), labels[0]); | 482 EXPECT_EQ(ASCIIToUTF16("Home; *3456"), labels[0]); |
474 EXPECT_EQ(ASCIIToUTF16("Work; *3456"), labels[1]); | 483 EXPECT_EQ(ASCIIToUTF16("Work; *3456"), labels[1]); |
475 EXPECT_EQ(ASCIIToUTF16("Empty; *3456"), labels[2]); | 484 EXPECT_EQ(ASCIIToUTF16("Empty; *3456"), labels[2]); |
476 EXPECT_EQ(ASCIIToUTF16("Home; *8765"), labels[3]); | 485 EXPECT_EQ(ASCIIToUTF16("Home; *8765"), labels[3]); |
477 EXPECT_EQ(ASCIIToUTF16("Work; *8765"), labels[4]); | 486 EXPECT_EQ(ASCIIToUTF16("Work; *8765"), labels[4]); |
478 EXPECT_EQ(ASCIIToUTF16("Empty; *8765"), labels[5]); | 487 EXPECT_EQ(ASCIIToUTF16("Empty; *8765"), labels[5]); |
479 } | 488 } |
480 | 489 |
481 TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsSemicolon) { | 490 TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetCreditCardSuggestionsSemicolon)) { |
482 // |profile| will be owned by the mock PersonalDataManager. | 491 // |profile| will be owned by the mock PersonalDataManager. |
483 AutoFillProfile* profile = new AutoFillProfile; | 492 AutoFillProfile* profile = new AutoFillProfile; |
484 autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", | 493 autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", |
485 "flatlander@gmail.com", "MCA", | 494 "flatlander@gmail.com", "MCA", |
486 "916 16th St.", "Apt. 6", "Lubbock", | 495 "916 16th St.", "Apt. 6", "Lubbock", |
487 "Texas", "79401", "USA", | 496 "Texas", "79401", "USA", |
488 "12345678901", ""); | 497 "12345678901", ""); |
489 autofill_manager_->AddProfile(profile); | 498 autofill_manager_->AddProfile(profile); |
490 | 499 |
491 FormData form; | 500 FormData form; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 EXPECT_EQ(ASCIIToUTF16("Home; *3456"), labels[0]); | 537 EXPECT_EQ(ASCIIToUTF16("Home; *3456"), labels[0]); |
529 EXPECT_EQ(ASCIIToUTF16("Work; *3456"), labels[1]); | 538 EXPECT_EQ(ASCIIToUTF16("Work; *3456"), labels[1]); |
530 EXPECT_EQ(ASCIIToUTF16("Empty; *3456"), labels[2]); | 539 EXPECT_EQ(ASCIIToUTF16("Empty; *3456"), labels[2]); |
531 EXPECT_EQ(ASCIIToUTF16("Home; 8765; *3456"), labels[3]); | 540 EXPECT_EQ(ASCIIToUTF16("Home; 8765; *3456"), labels[3]); |
532 EXPECT_EQ(ASCIIToUTF16("Home; *8765"), labels[4]); | 541 EXPECT_EQ(ASCIIToUTF16("Home; *8765"), labels[4]); |
533 EXPECT_EQ(ASCIIToUTF16("Work; *8765"), labels[5]); | 542 EXPECT_EQ(ASCIIToUTF16("Work; *8765"), labels[5]); |
534 EXPECT_EQ(ASCIIToUTF16("Empty; *8765"), labels[6]); | 543 EXPECT_EQ(ASCIIToUTF16("Empty; *8765"), labels[6]); |
535 EXPECT_EQ(ASCIIToUTF16("Home; 8765; *8765"), labels[7]); | 544 EXPECT_EQ(ASCIIToUTF16("Home; 8765; *8765"), labels[7]); |
536 } | 545 } |
537 | 546 |
538 TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsNonHTTPS) { | 547 TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetCreditCardSuggestionsNonHTTPS)) { |
539 FormData form; | 548 FormData form; |
540 CreateTestFormDataBilling(&form); | 549 CreateTestFormDataBilling(&form); |
541 form.origin = GURL("http://myform.com/form.html"); | 550 form.origin = GURL("http://myform.com/form.html"); |
542 | 551 |
543 // Set up our FormStructures. | 552 // Set up our FormStructures. |
544 std::vector<FormData> forms; | 553 std::vector<FormData> forms; |
545 forms.push_back(form); | 554 forms.push_back(form); |
546 autofill_manager_->FormsSeen(forms); | 555 autofill_manager_->FormsSeen(forms); |
547 | 556 |
548 // The page ID sent to the AutoFillManager from the RenderView, used to send | 557 // The page ID sent to the AutoFillManager from the RenderView, used to send |
549 // an IPC message back to the renderer. | 558 // an IPC message back to the renderer. |
550 const int kPageID = 1; | 559 const int kPageID = 1; |
551 | 560 |
552 webkit_glue::FormField field; | 561 webkit_glue::FormField field; |
553 autofill_unittest::CreateTestFormField( | 562 autofill_unittest::CreateTestFormField( |
554 "Card Number", "cardnumber", "", "text", &field); | 563 "Card Number", "cardnumber", "", "text", &field); |
555 EXPECT_FALSE( | 564 EXPECT_FALSE( |
556 autofill_manager_->GetAutoFillSuggestions(kPageID, false, field)); | 565 autofill_manager_->GetAutoFillSuggestions(kPageID, false, field)); |
557 } | 566 } |
558 | 567 |
559 TEST_F(AutoFillManagerTest, GetCombinedAutoFillAndAutocompleteSuggestions) { | 568 TEST_F(AutoFillManagerTest, |
| 569 SKIP_BRANDED(GetCombinedAutoFillAndAutocompleteSuggestions)) { |
560 FormData form; | 570 FormData form; |
561 CreateTestFormData(&form); | 571 CreateTestFormData(&form); |
562 | 572 |
563 // Set up our FormStructures. | 573 // Set up our FormStructures. |
564 std::vector<FormData> forms; | 574 std::vector<FormData> forms; |
565 forms.push_back(form); | 575 forms.push_back(form); |
566 autofill_manager_->FormsSeen(forms); | 576 autofill_manager_->FormsSeen(forms); |
567 | 577 |
568 // The page ID sent to the AutoFillManager from the RenderView, used to send | 578 // The page ID sent to the AutoFillManager from the RenderView, used to send |
569 // an IPC message back to the renderer. | 579 // an IPC message back to the renderer. |
(...skipping 22 matching lines...) Expand all Loading... |
592 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); | 602 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); |
593 EXPECT_EQ(ASCIIToUTF16("Jay"), values[2]); | 603 EXPECT_EQ(ASCIIToUTF16("Jay"), values[2]); |
594 EXPECT_EQ(ASCIIToUTF16("Jason"), values[3]); | 604 EXPECT_EQ(ASCIIToUTF16("Jason"), values[3]); |
595 ASSERT_EQ(4U, labels.size()); | 605 ASSERT_EQ(4U, labels.size()); |
596 EXPECT_EQ(ASCIIToUTF16("3734 Elvis Presley Blvd."), labels[0]); | 606 EXPECT_EQ(ASCIIToUTF16("3734 Elvis Presley Blvd."), labels[0]); |
597 EXPECT_EQ(ASCIIToUTF16("123 Apple St."), labels[1]); | 607 EXPECT_EQ(ASCIIToUTF16("123 Apple St."), labels[1]); |
598 EXPECT_EQ(string16(), labels[2]); | 608 EXPECT_EQ(string16(), labels[2]); |
599 EXPECT_EQ(string16(), labels[3]); | 609 EXPECT_EQ(string16(), labels[3]); |
600 } | 610 } |
601 | 611 |
602 TEST_F(AutoFillManagerTest, GetFieldSuggestionsFormIsAutoFilled) { | 612 TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetFieldSuggestionsFormIsAutoFilled)) { |
603 FormData form; | 613 FormData form; |
604 CreateTestFormData(&form); | 614 CreateTestFormData(&form); |
605 | 615 |
606 // Set up our FormStructures. | 616 // Set up our FormStructures. |
607 std::vector<FormData> forms; | 617 std::vector<FormData> forms; |
608 forms.push_back(form); | 618 forms.push_back(form); |
609 autofill_manager_->FormsSeen(forms); | 619 autofill_manager_->FormsSeen(forms); |
610 | 620 |
611 // The page ID sent to the AutoFillManager from the RenderView, used to send | 621 // The page ID sent to the AutoFillManager from the RenderView, used to send |
612 // an IPC message back to the renderer. | 622 // an IPC message back to the renderer. |
(...skipping 15 matching lines...) Expand all Loading... |
628 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); | 638 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); |
629 EXPECT_EQ(kPageID, page_id); | 639 EXPECT_EQ(kPageID, page_id); |
630 ASSERT_EQ(2U, values.size()); | 640 ASSERT_EQ(2U, values.size()); |
631 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); | 641 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); |
632 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); | 642 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); |
633 ASSERT_EQ(2U, labels.size()); | 643 ASSERT_EQ(2U, labels.size()); |
634 EXPECT_EQ(string16(), labels[0]); | 644 EXPECT_EQ(string16(), labels[0]); |
635 EXPECT_EQ(string16(), labels[1]); | 645 EXPECT_EQ(string16(), labels[1]); |
636 } | 646 } |
637 | 647 |
638 TEST_F(AutoFillManagerTest, GetFieldSuggestionsForAutocompleteOnly) { | 648 TEST_F(AutoFillManagerTest, |
| 649 SKIP_BRANDED(GetFieldSuggestionsForAutocompleteOnly)) { |
639 FormData form; | 650 FormData form; |
640 CreateTestFormData(&form); | 651 CreateTestFormData(&form); |
641 | 652 |
642 // Set up our FormStructures. | 653 // Set up our FormStructures. |
643 std::vector<FormData> forms; | 654 std::vector<FormData> forms; |
644 forms.push_back(form); | 655 forms.push_back(form); |
645 autofill_manager_->FormsSeen(forms); | 656 autofill_manager_->FormsSeen(forms); |
646 | 657 |
647 // The page ID sent to the AutoFillManager from the RenderView, used to send | 658 // The page ID sent to the AutoFillManager from the RenderView, used to send |
648 // an IPC message back to the renderer. | 659 // an IPC message back to the renderer. |
(...skipping 15 matching lines...) Expand all Loading... |
664 // Test that we sent the right message to the renderer. | 675 // Test that we sent the right message to the renderer. |
665 int page_id = 0; | 676 int page_id = 0; |
666 std::vector<string16> values; | 677 std::vector<string16> values; |
667 std::vector<string16> labels; | 678 std::vector<string16> labels; |
668 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); | 679 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); |
669 EXPECT_EQ(kAlternatePageID, page_id); | 680 EXPECT_EQ(kAlternatePageID, page_id); |
670 ASSERT_EQ(0U, values.size()); | 681 ASSERT_EQ(0U, values.size()); |
671 ASSERT_EQ(0U, labels.size()); | 682 ASSERT_EQ(0U, labels.size()); |
672 } | 683 } |
673 | 684 |
674 TEST_F(AutoFillManagerTest, GetFieldSuggestionsWithDuplicateValues) { | 685 TEST_F(AutoFillManagerTest, |
| 686 SKIP_BRANDED(GetFieldSuggestionsWithDuplicateValues)) { |
675 FormData form; | 687 FormData form; |
676 CreateTestFormData(&form); | 688 CreateTestFormData(&form); |
677 | 689 |
678 // Set up our FormStructures. | 690 // Set up our FormStructures. |
679 std::vector<FormData> forms; | 691 std::vector<FormData> forms; |
680 forms.push_back(form); | 692 forms.push_back(form); |
681 autofill_manager_->FormsSeen(forms); | 693 autofill_manager_->FormsSeen(forms); |
682 | 694 |
683 // |profile| will be owned by the mock PersonalDataManager. | 695 // |profile| will be owned by the mock PersonalDataManager. |
684 AutoFillProfile* profile = new AutoFillProfile; | 696 AutoFillProfile* profile = new AutoFillProfile; |
(...skipping 21 matching lines...) Expand all Loading... |
706 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); | 718 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); |
707 EXPECT_EQ(kPageID, page_id); | 719 EXPECT_EQ(kPageID, page_id); |
708 ASSERT_EQ(2U, values.size()); | 720 ASSERT_EQ(2U, values.size()); |
709 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); | 721 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); |
710 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); | 722 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); |
711 ASSERT_EQ(2U, labels.size()); | 723 ASSERT_EQ(2U, labels.size()); |
712 EXPECT_EQ(string16(), labels[0]); | 724 EXPECT_EQ(string16(), labels[0]); |
713 EXPECT_EQ(string16(), labels[1]); | 725 EXPECT_EQ(string16(), labels[1]); |
714 } | 726 } |
715 | 727 |
716 TEST_F(AutoFillManagerTest, FillCreditCardForm) { | 728 TEST_F(AutoFillManagerTest, SKIP_BRANDED(FillCreditCardForm)) { |
717 FormData form; | 729 FormData form; |
718 CreateTestFormDataBilling(&form); | 730 CreateTestFormDataBilling(&form); |
719 | 731 |
720 // Set up our FormStructures. | 732 // Set up our FormStructures. |
721 std::vector<FormData> forms; | 733 std::vector<FormData> forms; |
722 forms.push_back(form); | 734 forms.push_back(form); |
723 autofill_manager_->FormsSeen(forms); | 735 autofill_manager_->FormsSeen(forms); |
724 | 736 |
725 // The page ID sent to the AutoFillManager from the RenderView, used to send | 737 // The page ID sent to the AutoFillManager from the RenderView, used to send |
726 // an IPC message back to the renderer. | 738 // an IPC message back to the renderer. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 "Card Number", "cardnumber", "1234567890123456", "text", &field); | 795 "Card Number", "cardnumber", "1234567890123456", "text", &field); |
784 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[12])); | 796 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[12])); |
785 autofill_unittest::CreateTestFormField( | 797 autofill_unittest::CreateTestFormField( |
786 "Expiration Date", "ccmonth", "04", "text", &field); | 798 "Expiration Date", "ccmonth", "04", "text", &field); |
787 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[13])); | 799 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[13])); |
788 autofill_unittest::CreateTestFormField( | 800 autofill_unittest::CreateTestFormField( |
789 "", "ccyear", "2012", "text", &field); | 801 "", "ccyear", "2012", "text", &field); |
790 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[14])); | 802 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[14])); |
791 } | 803 } |
792 | 804 |
793 TEST_F(AutoFillManagerTest, FillNonBillingFormSemicolon) { | 805 TEST_F(AutoFillManagerTest, SKIP_BRANDED(FillNonBillingFormSemicolon)) { |
794 // |profile| will be owned by the mock PersonalDataManager. | 806 // |profile| will be owned by the mock PersonalDataManager. |
795 AutoFillProfile* profile = new AutoFillProfile; | 807 AutoFillProfile* profile = new AutoFillProfile; |
796 autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", | 808 autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", |
797 "flatlander@gmail.com", "MCA", | 809 "flatlander@gmail.com", "MCA", |
798 "916 16th St.", "Apt. 6", "Lubbock", | 810 "916 16th St.", "Apt. 6", "Lubbock", |
799 "Texas", "79401", "USA", | 811 "Texas", "79401", "USA", |
800 "12345678901", ""); | 812 "12345678901", ""); |
801 profile->set_unique_id(7); | 813 profile->set_unique_id(7); |
802 autofill_manager_->AddProfile(profile); | 814 autofill_manager_->AddProfile(profile); |
803 | 815 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 "Country", "country", "USA", "text", &field); | 869 "Country", "country", "USA", "text", &field); |
858 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[8])); | 870 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[8])); |
859 autofill_unittest::CreateTestFormField( | 871 autofill_unittest::CreateTestFormField( |
860 "Phone Number", "phonenumber", "12345678901", "text", &field); | 872 "Phone Number", "phonenumber", "12345678901", "text", &field); |
861 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[9])); | 873 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[9])); |
862 autofill_unittest::CreateTestFormField( | 874 autofill_unittest::CreateTestFormField( |
863 "Email", "email", "flatlander@gmail.com", "text", &field); | 875 "Email", "email", "flatlander@gmail.com", "text", &field); |
864 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[10])); | 876 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[10])); |
865 } | 877 } |
866 | 878 |
867 TEST_F(AutoFillManagerTest, FillBillFormSemicolon) { | 879 TEST_F(AutoFillManagerTest, SKIP_BRANDED(FillBillFormSemicolon)) { |
868 // |profile| will be owned by the mock PersonalDataManager. | 880 // |profile| will be owned by the mock PersonalDataManager. |
869 AutoFillProfile* profile = new AutoFillProfile; | 881 AutoFillProfile* profile = new AutoFillProfile; |
870 autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", | 882 autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", |
871 "flatlander@gmail.com", "MCA", | 883 "flatlander@gmail.com", "MCA", |
872 "916 16th St.", "Apt. 6", "Lubbock", | 884 "916 16th St.", "Apt. 6", "Lubbock", |
873 "Texas", "79401", "USA", | 885 "Texas", "79401", "USA", |
874 "12345678901", ""); | 886 "12345678901", ""); |
875 profile->set_unique_id(7); | 887 profile->set_unique_id(7); |
876 autofill_manager_->AddProfile(profile); | 888 autofill_manager_->AddProfile(profile); |
877 | 889 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
941 "Card Number", "cardnumber", "1234567890123456", "text", &field); | 953 "Card Number", "cardnumber", "1234567890123456", "text", &field); |
942 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[12])); | 954 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[12])); |
943 autofill_unittest::CreateTestFormField( | 955 autofill_unittest::CreateTestFormField( |
944 "Expiration Date", "ccmonth", "04", "text", &field); | 956 "Expiration Date", "ccmonth", "04", "text", &field); |
945 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[13])); | 957 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[13])); |
946 autofill_unittest::CreateTestFormField( | 958 autofill_unittest::CreateTestFormField( |
947 "", "ccyear", "2012", "text", &field); | 959 "", "ccyear", "2012", "text", &field); |
948 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[14])); | 960 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[14])); |
949 } | 961 } |
950 | 962 |
951 TEST_F(AutoFillManagerTest, FillPhoneNumber) { | 963 TEST_F(AutoFillManagerTest, SKIP_BRANDED(FillPhoneNumber)) { |
952 FormData form; | 964 FormData form; |
953 | 965 |
954 form.name = ASCIIToUTF16("MyPhoneForm"); | 966 form.name = ASCIIToUTF16("MyPhoneForm"); |
955 form.method = ASCIIToUTF16("POST"); | 967 form.method = ASCIIToUTF16("POST"); |
956 form.origin = GURL("http://myform.com/phone_form.html"); | 968 form.origin = GURL("http://myform.com/phone_form.html"); |
957 form.action = GURL("http://myform.com/phone_submit.html"); | 969 form.action = GURL("http://myform.com/phone_submit.html"); |
958 form.user_submitted = true; | 970 form.user_submitted = true; |
959 | 971 |
960 webkit_glue::FormField field; | 972 webkit_glue::FormField field; |
961 | 973 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 } else { | 1026 } else { |
1015 // The only size that is parsed and split, right now is 7: | 1027 // The only size that is parsed and split, right now is 7: |
1016 EXPECT_EQ(ASCIIToUTF16("123"), results.fields[2].value()); | 1028 EXPECT_EQ(ASCIIToUTF16("123"), results.fields[2].value()); |
1017 EXPECT_EQ(ASCIIToUTF16("4567"), results.fields[3].value()); | 1029 EXPECT_EQ(ASCIIToUTF16("4567"), results.fields[3].value()); |
1018 } | 1030 } |
1019 } | 1031 } |
1020 | 1032 |
1021 work_profile->SetInfo(phone_type, saved_phone); | 1033 work_profile->SetInfo(phone_type, saved_phone); |
1022 } | 1034 } |
1023 | 1035 |
1024 TEST_F(AutoFillManagerTest, FormChangesRemoveField) { | 1036 TEST_F(AutoFillManagerTest, SKIP_BRANDED(FormChangesRemoveField)) { |
1025 FormData form; | 1037 FormData form; |
1026 form.name = ASCIIToUTF16("MyForm"); | 1038 form.name = ASCIIToUTF16("MyForm"); |
1027 form.method = ASCIIToUTF16("POST"); | 1039 form.method = ASCIIToUTF16("POST"); |
1028 form.origin = GURL("http://myform.com/form.html"); | 1040 form.origin = GURL("http://myform.com/form.html"); |
1029 form.action = GURL("http://myform.com/submit.html"); | 1041 form.action = GURL("http://myform.com/submit.html"); |
1030 form.user_submitted = true; | 1042 form.user_submitted = true; |
1031 | 1043 |
1032 webkit_glue::FormField field; | 1044 webkit_glue::FormField field; |
1033 autofill_unittest::CreateTestFormField( | 1045 autofill_unittest::CreateTestFormField( |
1034 "First Name", "firstname", "", "text", &field); | 1046 "First Name", "firstname", "", "text", &field); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 "Middle Name", "middlename", "Aaron", "text", &field); | 1093 "Middle Name", "middlename", "Aaron", "text", &field); |
1082 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[1])); | 1094 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[1])); |
1083 autofill_unittest::CreateTestFormField( | 1095 autofill_unittest::CreateTestFormField( |
1084 "Last Name", "lastname", "Presley", "text", &field); | 1096 "Last Name", "lastname", "Presley", "text", &field); |
1085 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[2])); | 1097 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[2])); |
1086 autofill_unittest::CreateTestFormField( | 1098 autofill_unittest::CreateTestFormField( |
1087 "Email", "email", "theking@gmail.com", "text", &field); | 1099 "Email", "email", "theking@gmail.com", "text", &field); |
1088 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[3])); | 1100 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[3])); |
1089 } | 1101 } |
1090 | 1102 |
1091 TEST_F(AutoFillManagerTest, FormChangesAddField) { | 1103 TEST_F(AutoFillManagerTest, SKIP_BRANDED(FormChangesAddField)) { |
1092 FormData form; | 1104 FormData form; |
1093 form.name = ASCIIToUTF16("MyForm"); | 1105 form.name = ASCIIToUTF16("MyForm"); |
1094 form.method = ASCIIToUTF16("POST"); | 1106 form.method = ASCIIToUTF16("POST"); |
1095 form.origin = GURL("http://myform.com/form.html"); | 1107 form.origin = GURL("http://myform.com/form.html"); |
1096 form.action = GURL("http://myform.com/submit.html"); | 1108 form.action = GURL("http://myform.com/submit.html"); |
1097 form.user_submitted = true; | 1109 form.user_submitted = true; |
1098 | 1110 |
1099 webkit_glue::FormField field; | 1111 webkit_glue::FormField field; |
1100 autofill_unittest::CreateTestFormField( | 1112 autofill_unittest::CreateTestFormField( |
1101 "First Name", "firstname", "", "text", &field); | 1113 "First Name", "firstname", "", "text", &field); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 "Last Name", "lastname", "Presley", "text", &field); | 1163 "Last Name", "lastname", "Presley", "text", &field); |
1152 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[2])); | 1164 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[2])); |
1153 autofill_unittest::CreateTestFormField( | 1165 autofill_unittest::CreateTestFormField( |
1154 "Phone Number", "phonenumber", "", "text", &field); | 1166 "Phone Number", "phonenumber", "", "text", &field); |
1155 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[3])); | 1167 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[3])); |
1156 autofill_unittest::CreateTestFormField( | 1168 autofill_unittest::CreateTestFormField( |
1157 "Email", "email", "theking@gmail.com", "text", &field); | 1169 "Email", "email", "theking@gmail.com", "text", &field); |
1158 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[4])); | 1170 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[4])); |
1159 } | 1171 } |
1160 | 1172 |
1161 TEST_F(AutoFillManagerTest, HiddenFields) { | 1173 TEST_F(AutoFillManagerTest, SKIP_BRANDED(HiddenFields)) { |
1162 FormData form; | 1174 FormData form; |
1163 form.name = ASCIIToUTF16("MyForm"); | 1175 form.name = ASCIIToUTF16("MyForm"); |
1164 form.method = ASCIIToUTF16("POST"); | 1176 form.method = ASCIIToUTF16("POST"); |
1165 form.origin = GURL("http://myform.com/form.html"); | 1177 form.origin = GURL("http://myform.com/form.html"); |
1166 form.action = GURL("http://myform.com/submit.html"); | 1178 form.action = GURL("http://myform.com/submit.html"); |
1167 form.user_submitted = true; | 1179 form.user_submitted = true; |
1168 | 1180 |
1169 webkit_glue::FormField field; | 1181 webkit_glue::FormField field; |
1170 autofill_unittest::CreateTestFormField( | 1182 autofill_unittest::CreateTestFormField( |
1171 "E-mail", "one", "one", "hidden", &field); | 1183 "E-mail", "one", "one", "hidden", &field); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 #else | 1217 #else |
1206 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( | 1218 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( |
1207 prefs::kAutoFillAuxiliaryProfilesEnabled)); | 1219 prefs::kAutoFillAuxiliaryProfilesEnabled)); |
1208 profile()->GetPrefs()->SetBoolean( | 1220 profile()->GetPrefs()->SetBoolean( |
1209 prefs::kAutoFillAuxiliaryProfilesEnabled, true); | 1221 prefs::kAutoFillAuxiliaryProfilesEnabled, true); |
1210 profile()->GetPrefs()->ClearPref(prefs::kAutoFillAuxiliaryProfilesEnabled); | 1222 profile()->GetPrefs()->ClearPref(prefs::kAutoFillAuxiliaryProfilesEnabled); |
1211 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( | 1223 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( |
1212 prefs::kAutoFillAuxiliaryProfilesEnabled)); | 1224 prefs::kAutoFillAuxiliaryProfilesEnabled)); |
1213 #endif | 1225 #endif |
1214 } | 1226 } |
OLD | NEW |