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

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

Issue 11414223: Move the test functions that deal with focus to interactive_ui_tets_utils.h and into the interactiv… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/file_util.h" 8 #include "base/file_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 #if defined(OS_MACOSX) 443 #if defined(OS_MACOSX)
444 #define MAYBE_AutofillViaDownArrow AutofillViaDownArrow 444 #define MAYBE_AutofillViaDownArrow AutofillViaDownArrow
445 #else 445 #else
446 #define MAYBE_AutofillViaDownArrow DISABLED_AutofillViaDownArrow 446 #define MAYBE_AutofillViaDownArrow DISABLED_AutofillViaDownArrow
447 #endif 447 #endif
448 // Test that form filling can be initiated by pressing the down arrow. 448 // Test that form filling can be initiated by pressing the down arrow.
449 IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_AutofillViaDownArrow) { 449 IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_AutofillViaDownArrow) {
450 CreateTestProfile(); 450 CreateTestProfile();
451 451
452 // Load the test page. 452 // Load the test page.
453 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
454 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), 453 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
455 GURL(std::string(kDataURIPrefix) + kTestFormString))); 454 GURL(std::string(kDataURIPrefix) + kTestFormString)));
456 455
457 // Focus a fillable field. 456 // Focus a fillable field.
458 FocusFirstNameField(); 457 FocusFirstNameField();
459 458
460 // Press the down arrow to initiate Autofill and wait for the popup to be 459 // Press the down arrow to initiate Autofill and wait for the popup to be
461 // shown. 460 // shown.
462 SendKeyAndWait( 461 SendKeyAndWait(
463 ui::VKEY_DOWN, chrome::NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS); 462 ui::VKEY_DOWN, chrome::NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 "document.getElementById('state').onchange = function() {" 499 "document.getElementById('state').onchange = function() {"
501 " changed_select_fired = true;" 500 " changed_select_fired = true;"
502 "};" 501 "};"
503 "document.getElementById('country').onchange = function() {" 502 "document.getElementById('country').onchange = function() {"
504 " unchanged_select_fired = true;" 503 " unchanged_select_fired = true;"
505 "};" 504 "};"
506 "document.getElementById('country').value = 'US';" 505 "document.getElementById('country').value = 'US';"
507 "</script>"; 506 "</script>";
508 507
509 // Load the test page. 508 // Load the test page.
510 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
511 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), 509 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
512 GURL(std::string(kDataURIPrefix) + kTestFormString + kOnChangeScript))); 510 GURL(std::string(kDataURIPrefix) + kTestFormString + kOnChangeScript)));
513 511
514 // Invoke Autofill. 512 // Invoke Autofill.
515 FocusFirstNameField(); 513 FocusFirstNameField();
516 514
517 // Start filling the first name field with "M" and wait for the popup to be 515 // Start filling the first name field with "M" and wait for the popup to be
518 // shown. 516 // shown.
519 SendKeyAndWait( 517 SendKeyAndWait(
520 ui::VKEY_M, chrome::NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS); 518 ui::VKEY_M, chrome::NOTIFICATION_AUTOFILL_DID_SHOW_SUGGESTIONS);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 std::string(kDataURIPrefix) + kTestFormString + 573 std::string(kDataURIPrefix) + kTestFormString +
576 "<script>" 574 "<script>"
577 "var mainForm = document.forms[0];" 575 "var mainForm = document.forms[0];"
578 "mainForm.id = 'mainForm';" 576 "mainForm.id = 'mainForm';"
579 "var newForm = document.createElement('form');" 577 "var newForm = document.createElement('form');"
580 "newForm.action = mainForm.action;" 578 "newForm.action = mainForm.action;"
581 "newForm.method = mainForm.method;" 579 "newForm.method = mainForm.method;"
582 "newForm.id = 'newForm';" 580 "newForm.id = 'newForm';"
583 "mainForm.parentNode.insertBefore(newForm, mainForm);" 581 "mainForm.parentNode.insertBefore(newForm, mainForm);"
584 "</script>"; 582 "</script>";
585 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
586 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), GURL(kURL))); 583 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), GURL(kURL)));
587 584
588 // Invoke Autofill. 585 // Invoke Autofill.
589 TryBasicFormFill(); 586 TryBasicFormFill();
590 } 587 }
591 588
592 // Test that we properly autofill forms with repeated fields. 589 // Test that we properly autofill forms with repeated fields.
593 // In the wild, the repeated fields are typically either email fields 590 // In the wild, the repeated fields are typically either email fields
594 // (duplicated for "confirmation"); or variants that are hot-swapped via 591 // (duplicated for "confirmation"); or variants that are hot-swapped via
595 // JavaScript, with only one actually visible at any given time. 592 // JavaScript, with only one actually visible at any given time.
596 // DISABLED: http://crbug.com/150084 593 // DISABLED: http://crbug.com/150084
597 IN_PROC_BROWSER_TEST_F(AutofillTest, DISABLED_AutofillFormWithRepeatedField) { 594 IN_PROC_BROWSER_TEST_F(AutofillTest, DISABLED_AutofillFormWithRepeatedField) {
598 CreateTestProfile(); 595 CreateTestProfile();
599 596
600 // Load the test page. 597 // Load the test page.
601 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
602 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), 598 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
603 GURL(std::string(kDataURIPrefix) + 599 GURL(std::string(kDataURIPrefix) +
604 "<form action=\"http://www.example.com/\" method=\"POST\">" 600 "<form action=\"http://www.example.com/\" method=\"POST\">"
605 "<label for=\"firstname\">First name:</label>" 601 "<label for=\"firstname\">First name:</label>"
606 " <input type=\"text\" id=\"firstname\"" 602 " <input type=\"text\" id=\"firstname\""
607 " onFocus=\"domAutomationController.send(true)\"><br>" 603 " onFocus=\"domAutomationController.send(true)\"><br>"
608 "<label for=\"lastname\">Last name:</label>" 604 "<label for=\"lastname\">Last name:</label>"
609 " <input type=\"text\" id=\"lastname\"><br>" 605 " <input type=\"text\" id=\"lastname\"><br>"
610 "<label for=\"address1\">Address line 1:</label>" 606 "<label for=\"address1\">Address line 1:</label>"
611 " <input type=\"text\" id=\"address1\"><br>" 607 " <input type=\"text\" id=\"address1\"><br>"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 #define MAYBE_AutofillFormWithNonAutofillableField \ 643 #define MAYBE_AutofillFormWithNonAutofillableField \
648 DISABLED_AutofillFormWithNonAutofillableField 644 DISABLED_AutofillFormWithNonAutofillableField
649 #endif 645 #endif
650 646
651 // Test that we properly autofill forms with non-autofillable fields. 647 // Test that we properly autofill forms with non-autofillable fields.
652 IN_PROC_BROWSER_TEST_F(AutofillTest, 648 IN_PROC_BROWSER_TEST_F(AutofillTest,
653 MAYBE_AutofillFormWithNonAutofillableField) { 649 MAYBE_AutofillFormWithNonAutofillableField) {
654 CreateTestProfile(); 650 CreateTestProfile();
655 651
656 // Load the test page. 652 // Load the test page.
657 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
658 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), 653 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
659 GURL(std::string(kDataURIPrefix) + 654 GURL(std::string(kDataURIPrefix) +
660 "<form action=\"http://www.example.com/\" method=\"POST\">" 655 "<form action=\"http://www.example.com/\" method=\"POST\">"
661 "<label for=\"firstname\">First name:</label>" 656 "<label for=\"firstname\">First name:</label>"
662 " <input type=\"text\" id=\"firstname\"" 657 " <input type=\"text\" id=\"firstname\""
663 " onFocus=\"domAutomationController.send(true)\"><br>" 658 " onFocus=\"domAutomationController.send(true)\"><br>"
664 "<label for=\"middlename\">Middle name:</label>" 659 "<label for=\"middlename\">Middle name:</label>"
665 " <input type=\"text\" id=\"middlename\" autocomplete=\"off\" /><br>" 660 " <input type=\"text\" id=\"middlename\" autocomplete=\"off\" /><br>"
666 "<label for=\"lastname\">Last name:</label>" 661 "<label for=\"lastname\">Last name:</label>"
667 " <input type=\"text\" id=\"lastname\"><br>" 662 " <input type=\"text\" id=\"lastname\"><br>"
(...skipping 24 matching lines...) Expand all
692 // Invoke Autofill. 687 // Invoke Autofill.
693 TryBasicFormFill(); 688 TryBasicFormFill();
694 } 689 }
695 690
696 // Test that we can Autofill dynamically generated forms. 691 // Test that we can Autofill dynamically generated forms.
697 // DISABLED: http://crbug.com/150084 692 // DISABLED: http://crbug.com/150084
698 IN_PROC_BROWSER_TEST_F(AutofillTest, DISABLED_DynamicFormFill) { 693 IN_PROC_BROWSER_TEST_F(AutofillTest, DISABLED_DynamicFormFill) {
699 CreateTestProfile(); 694 CreateTestProfile();
700 695
701 // Load the test page. 696 // Load the test page.
702 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
703 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), 697 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
704 GURL(std::string(kDataURIPrefix) + 698 GURL(std::string(kDataURIPrefix) +
705 "<form id=\"form\" action=\"http://www.example.com/\"" 699 "<form id=\"form\" action=\"http://www.example.com/\""
706 " method=\"POST\"></form>" 700 " method=\"POST\"></form>"
707 "<script>" 701 "<script>"
708 "function AddElement(name, label) {" 702 "function AddElement(name, label) {"
709 " var form = document.getElementById('form');" 703 " var form = document.getElementById('form');"
710 "" 704 ""
711 " var label_text = document.createTextNode(label);" 705 " var label_text = document.createTextNode(label);"
712 " var label_element = document.createElement('label');" 706 " var label_element = document.createElement('label');"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 #define MAYBE_AutofillAfterReload AutofillAfterReload 785 #define MAYBE_AutofillAfterReload AutofillAfterReload
792 #else 786 #else
793 #define MAYBE_AutofillAfterReload DISABLED_AutofillAfterReload 787 #define MAYBE_AutofillAfterReload DISABLED_AutofillAfterReload
794 #endif 788 #endif
795 IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_AutofillAfterReload) { 789 IN_PROC_BROWSER_TEST_F(AutofillTest, MAYBE_AutofillAfterReload) {
796 LOG(WARNING) << "Creating test profile."; 790 LOG(WARNING) << "Creating test profile.";
797 CreateTestProfile(); 791 CreateTestProfile();
798 792
799 // Load the test page. 793 // Load the test page.
800 LOG(WARNING) << "Bringing browser window to front."; 794 LOG(WARNING) << "Bringing browser window to front.";
801 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
802 LOG(WARNING) << "Navigating to URL."; 795 LOG(WARNING) << "Navigating to URL.";
803 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), 796 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(),
804 GURL(std::string(kDataURIPrefix) + kTestFormString))); 797 GURL(std::string(kDataURIPrefix) + kTestFormString)));
805 798
806 // Reload the page. 799 // Reload the page.
807 LOG(WARNING) << "Reloading the page."; 800 LOG(WARNING) << "Reloading the page.";
808 WebContents* tab = chrome::GetActiveWebContents(browser()); 801 WebContents* tab = chrome::GetActiveWebContents(browser());
809 tab->GetController().Reload(false); 802 tab->GetController().Reload(false);
810 content::WaitForLoadStop(tab); 803 content::WaitForLoadStop(tab);
811 804
(...skipping 30 matching lines...) Expand all
842 " <input type=\"text\" id=\"z\"><br>" 835 " <input type=\"text\" id=\"z\"><br>"
843 "<label for=\"co\">Country:</label>" 836 "<label for=\"co\">Country:</label>"
844 " <select id=\"co\">" 837 " <select id=\"co\">"
845 " <option value=\"\" selected=\"yes\">--</option>" 838 " <option value=\"\" selected=\"yes\">--</option>"
846 " <option value=\"CA\">Canada</option>" 839 " <option value=\"CA\">Canada</option>"
847 " <option value=\"US\">United States</option>" 840 " <option value=\"US\">United States</option>"
848 " </select><br>" 841 " </select><br>"
849 "<label for=\"ph\">Phone number:</label>" 842 "<label for=\"ph\">Phone number:</label>"
850 " <input type=\"text\" id=\"ph\"><br>" 843 " <input type=\"text\" id=\"ph\"><br>"
851 "</form>"); 844 "</form>");
852 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
853 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), url)); 845 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), url));
854 846
855 // Get translation bar. 847 // Get translation bar.
856 RenderViewHostTester::TestOnMessageReceived( 848 RenderViewHostTester::TestOnMessageReceived(
857 render_view_host(), 849 render_view_host(),
858 ChromeViewHostMsg_TranslateLanguageDetermined(0, "ja", true)); 850 ChromeViewHostMsg_TranslateLanguageDetermined(0, "ja", true));
859 TranslateInfoBarDelegate* infobar = 851 TranslateInfoBarDelegate* infobar =
860 InfoBarService::FromWebContents(chrome::GetActiveWebContents(browser()))-> 852 InfoBarService::FromWebContents(chrome::GetActiveWebContents(browser()))->
861 GetInfoBarDelegateAt(0)->AsTranslateInfoBarDelegate(); 853 GetInfoBarDelegateAt(0)->AsTranslateInfoBarDelegate();
862 854
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 // TODO(isherman): this looks redundant, consider removing. 1594 // TODO(isherman): this looks redundant, consider removing.
1603 // DISABLED: http://crbug.com/150084 1595 // DISABLED: http://crbug.com/150084
1604 IN_PROC_BROWSER_TEST_F(AutofillTest, 1596 IN_PROC_BROWSER_TEST_F(AutofillTest,
1605 DISABLED_MergeAggregatedDuplicatedProfiles) { 1597 DISABLED_MergeAggregatedDuplicatedProfiles) {
1606 int num_of_profiles = 1598 int num_of_profiles =
1607 AggregateProfilesIntoAutofillPrefs("dataset_no_address.txt"); 1599 AggregateProfilesIntoAutofillPrefs("dataset_no_address.txt");
1608 1600
1609 ASSERT_GT(num_of_profiles, 1601 ASSERT_GT(num_of_profiles,
1610 static_cast<int>(personal_data_manager()->profiles().size())); 1602 static_cast<int>(personal_data_manager()->profiles().size()));
1611 } 1603 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browser_keyevents_browsertest.cc » ('j') | chrome/test/gpu/gpu_mapsgl_endurance_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698