OLD | NEW |
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 Loading... |
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" |
37 #include "grit/component_strings.h" | 38 #include "grit/component_strings.h" |
38 #include "testing/gmock/include/gmock/gmock.h" | 39 #include "testing/gmock/include/gmock/gmock.h" |
39 #include "testing/gtest/include/gtest/gtest.h" | 40 #include "testing/gtest/include/gtest/gtest.h" |
40 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
41 #include "ui/gfx/rect.h" | 42 #include "ui/gfx/rect.h" |
42 #include "url/gurl.h" | 43 #include "url/gurl.h" |
43 | 44 |
44 using base::ASCIIToUTF16; | 45 using base::ASCIIToUTF16; |
45 using base::UTF8ToUTF16; | 46 using base::UTF8ToUTF16; |
46 using testing::_; | 47 using testing::_; |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 const FormFieldData& field) { | 627 const FormFieldData& field) { |
627 GetAutofillSuggestions(kDefaultPageID, form, field); | 628 GetAutofillSuggestions(kDefaultPageID, form, field); |
628 } | 629 } |
629 | 630 |
630 void AutocompleteSuggestionsReturned( | 631 void AutocompleteSuggestionsReturned( |
631 const std::vector<base::string16>& result) { | 632 const std::vector<base::string16>& result) { |
632 autofill_manager_->autocomplete_history_manager_->SendSuggestions(&result); | 633 autofill_manager_->autocomplete_history_manager_->SendSuggestions(&result); |
633 } | 634 } |
634 | 635 |
635 void FormsSeen(const std::vector<FormData>& forms) { | 636 void FormsSeen(const std::vector<FormData>& forms) { |
636 autofill_manager_->OnFormsSeen(forms, base::TimeTicks()); | 637 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); |
637 } | 649 } |
638 | 650 |
639 void FormSubmitted(const FormData& form) { | 651 void FormSubmitted(const FormData& form) { |
640 autofill_manager_->ResetRunLoop(); | 652 autofill_manager_->ResetRunLoop(); |
641 if (autofill_manager_->OnFormSubmitted(form, base::TimeTicks::Now())) | 653 if (autofill_manager_->OnFormSubmitted(form, base::TimeTicks::Now())) |
642 autofill_manager_->WaitForAsyncFormSubmit(); | 654 autofill_manager_->WaitForAsyncFormSubmit(); |
643 } | 655 } |
644 | 656 |
645 void FillAutofillFormData(int query_id, | 657 void FillAutofillFormData(int query_id, |
646 const FormData& form, | 658 const FormData& form, |
(...skipping 2223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2870 test::CreateTestAddressFormData(&form); | 2882 test::CreateTestAddressFormData(&form); |
2871 std::vector<FormData> forms(1, form); | 2883 std::vector<FormData> forms(1, form); |
2872 FormsSeen(forms); | 2884 FormsSeen(forms); |
2873 const FormFieldData& field = form.fields[0]; | 2885 const FormFieldData& field = form.fields[0]; |
2874 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() | 2886 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() |
2875 | 2887 |
2876 EXPECT_TRUE(external_delegate_->on_query_seen()); | 2888 EXPECT_TRUE(external_delegate_->on_query_seen()); |
2877 } | 2889 } |
2878 | 2890 |
2879 } // namespace autofill | 2891 } // namespace autofill |
OLD | NEW |