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

Side by Side Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 242613006: [Autofill] Enable Autofill for dynamically created forms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test fix Created 6 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 16 matching lines...) Expand all
27 #include "components/autofill/core/browser/credit_card.h" 27 #include "components/autofill/core/browser/credit_card.h"
28 #include "components/autofill/core/browser/personal_data_manager.h" 28 #include "components/autofill/core/browser/personal_data_manager.h"
29 #include "components/autofill/core/browser/popup_item_ids.h" 29 #include "components/autofill/core/browser/popup_item_ids.h"
30 #include "components/autofill/core/browser/test_autofill_driver.h" 30 #include "components/autofill/core/browser/test_autofill_driver.h"
31 #include "components/autofill/core/browser/test_autofill_external_delegate.h" 31 #include "components/autofill/core/browser/test_autofill_external_delegate.h"
32 #include "components/autofill/core/browser/test_autofill_manager_delegate.h" 32 #include "components/autofill/core/browser/test_autofill_manager_delegate.h"
33 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 33 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
34 #include "components/autofill/core/common/autofill_pref_names.h" 34 #include "components/autofill/core/common/autofill_pref_names.h"
35 #include "components/autofill/core/common/form_data.h" 35 #include "components/autofill/core/common/form_data.h"
36 #include "components/autofill/core/common/form_field_data.h" 36 #include "components/autofill/core/common/form_field_data.h"
37 #include "components/autofill/core/common/forms_seen_state.h"
38 #include "grit/component_strings.h" 37 #include "grit/component_strings.h"
39 #include "testing/gmock/include/gmock/gmock.h" 38 #include "testing/gmock/include/gmock/gmock.h"
40 #include "testing/gtest/include/gtest/gtest.h" 39 #include "testing/gtest/include/gtest/gtest.h"
41 #include "ui/base/l10n/l10n_util.h" 40 #include "ui/base/l10n/l10n_util.h"
42 #include "ui/gfx/rect.h" 41 #include "ui/gfx/rect.h"
43 #include "url/gurl.h" 42 #include "url/gurl.h"
44 43
45 using base::ASCIIToUTF16; 44 using base::ASCIIToUTF16;
46 using base::UTF8ToUTF16; 45 using base::UTF8ToUTF16;
47 using testing::_; 46 using testing::_;
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 const FormFieldData& field) { 626 const FormFieldData& field) {
628 GetAutofillSuggestions(kDefaultPageID, form, field); 627 GetAutofillSuggestions(kDefaultPageID, form, field);
629 } 628 }
630 629
631 void AutocompleteSuggestionsReturned( 630 void AutocompleteSuggestionsReturned(
632 const std::vector<base::string16>& result) { 631 const std::vector<base::string16>& result) {
633 autofill_manager_->autocomplete_history_manager_->SendSuggestions(&result); 632 autofill_manager_->autocomplete_history_manager_->SendSuggestions(&result);
634 } 633 }
635 634
636 void FormsSeen(const std::vector<FormData>& forms) { 635 void FormsSeen(const std::vector<FormData>& forms) {
637 autofill_manager_->OnFormsSeen(forms, base::TimeTicks(), 636 autofill_manager_->OnFormsSeen(forms, base::TimeTicks());
638 autofill::NO_SPECIAL_FORMS_SEEN);
639 }
640
641 void PartialFormsSeen(const std::vector<FormData>& forms) {
642 autofill_manager_->OnFormsSeen(forms, base::TimeTicks(),
643 autofill::PARTIAL_FORMS_SEEN);
644 }
645
646 void DynamicFormsSeen(const std::vector<FormData>& forms) {
647 autofill_manager_->OnFormsSeen(forms, base::TimeTicks(),
648 autofill::DYNAMIC_FORMS_SEEN);
649 } 637 }
650 638
651 void FormSubmitted(const FormData& form) { 639 void FormSubmitted(const FormData& form) {
652 autofill_manager_->ResetRunLoop(); 640 autofill_manager_->ResetRunLoop();
653 if (autofill_manager_->OnFormSubmitted(form, base::TimeTicks::Now())) 641 if (autofill_manager_->OnFormSubmitted(form, base::TimeTicks::Now()))
654 autofill_manager_->WaitForAsyncFormSubmit(); 642 autofill_manager_->WaitForAsyncFormSubmit();
655 } 643 }
656 644
657 void FillAutofillFormData(int query_id, 645 void FillAutofillFormData(int query_id,
658 const FormData& form, 646 const FormData& form,
(...skipping 2223 matching lines...) Expand 10 before | Expand all | Expand 10 after
2882 test::CreateTestAddressFormData(&form); 2870 test::CreateTestAddressFormData(&form);
2883 std::vector<FormData> forms(1, form); 2871 std::vector<FormData> forms(1, form);
2884 FormsSeen(forms); 2872 FormsSeen(forms);
2885 const FormFieldData& field = form.fields[0]; 2873 const FormFieldData& field = form.fields[0];
2886 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() 2874 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery()
2887 2875
2888 EXPECT_TRUE(external_delegate_->on_query_seen()); 2876 EXPECT_TRUE(external_delegate_->on_query_seen());
2889 } 2877 }
2890 2878
2891 } // namespace autofill 2879 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_manager.cc ('k') | components/autofill/core/browser/autofill_metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698