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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 public: | 81 public: |
82 MockAutofillManager(AutofillDriver* driver, MockAutofillClient* client) | 82 MockAutofillManager(AutofillDriver* driver, MockAutofillClient* client) |
83 // Force to use the constructor designated for unit test, but we don't | 83 // Force to use the constructor designated for unit test, but we don't |
84 // really need personal_data in this test so we pass a NULL pointer. | 84 // really need personal_data in this test so we pass a NULL pointer. |
85 : AutofillManager(driver, client, NULL) {} | 85 : AutofillManager(driver, client, NULL) {} |
86 virtual ~MockAutofillManager() {} | 86 virtual ~MockAutofillManager() {} |
87 | 87 |
88 MOCK_METHOD2(ShouldShowScanCreditCard, | 88 MOCK_METHOD2(ShouldShowScanCreditCard, |
89 bool(const FormData& form, const FormFieldData& field)); | 89 bool(const FormData& form, const FormFieldData& field)); |
90 | 90 |
| 91 // This method is only used for emitting histograms, but makes assumptions |
| 92 // about the internal state of the AutofillManager. Override it to do |
| 93 // nothing. |
| 94 void OnUserDidAcceptAutofillSuggestion(int unique_id) override {} |
| 95 |
91 MOCK_METHOD5(FillOrPreviewForm, | 96 MOCK_METHOD5(FillOrPreviewForm, |
92 void(AutofillDriver::RendererFormDataAction action, | 97 void(AutofillDriver::RendererFormDataAction action, |
93 int query_id, | 98 int query_id, |
94 const FormData& form, | 99 const FormData& form, |
95 const FormFieldData& field, | 100 const FormFieldData& field, |
96 int unique_id)); | 101 int unique_id)); |
97 | 102 |
98 MOCK_METHOD4(FillCreditCardForm, | 103 MOCK_METHOD4(FillCreditCardForm, |
99 void(int query_id, | 104 void(int query_id, |
100 const FormData& form, | 105 const FormData& form, |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateFillFieldWithValue) { | 492 TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateFillFieldWithValue) { |
488 EXPECT_CALL(autofill_client_, HideAutofillPopup()); | 493 EXPECT_CALL(autofill_client_, HideAutofillPopup()); |
489 base::string16 dummy_string(ASCIIToUTF16("baz foo")); | 494 base::string16 dummy_string(ASCIIToUTF16("baz foo")); |
490 EXPECT_CALL(*autofill_driver_, | 495 EXPECT_CALL(*autofill_driver_, |
491 RendererShouldFillFieldWithValue(dummy_string)); | 496 RendererShouldFillFieldWithValue(dummy_string)); |
492 external_delegate_->DidAcceptSuggestion(dummy_string, | 497 external_delegate_->DidAcceptSuggestion(dummy_string, |
493 POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY); | 498 POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY); |
494 } | 499 } |
495 | 500 |
496 } // namespace autofill | 501 } // namespace autofill |
OLD | NEW |