| OLD | NEW |
| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "chrome/browser/autofill/autofill_manager.h" | 10 #include "chrome/browser/autofill/autofill_manager.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 MOCK_METHOD0(HideAutofillPopup, void()); | 51 MOCK_METHOD0(HideAutofillPopup, void()); |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 virtual void HideAutofillPopupInternal() {}; | 54 virtual void HideAutofillPopupInternal() {}; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 class MockAutofillManager : public AutofillManager { | 57 class MockAutofillManager : public AutofillManager { |
| 58 public: | 58 public: |
| 59 explicit MockAutofillManager(TabContentsWrapper* tab_contents) | 59 explicit MockAutofillManager(TabContentsWrapper* tab_contents) |
| 60 : AutofillManager(tab_contents) {} | 60 // Force to use the constructor designated for unit test, but we don't |
| 61 // really need personal_data in this test so we pass a NULL pointer. |
| 62 : AutofillManager(tab_contents, NULL) {} |
| 61 | 63 |
| 62 MOCK_METHOD4(OnFillAutofillFormData, | 64 MOCK_METHOD4(OnFillAutofillFormData, |
| 63 void(int query_id, | 65 void(int query_id, |
| 64 const webkit::forms::FormData& form, | 66 const webkit::forms::FormData& form, |
| 65 const webkit::forms::FormField& field, | 67 const webkit::forms::FormField& field, |
| 66 int unique_id)); | 68 int unique_id)); |
| 67 | 69 |
| 68 protected: | 70 protected: |
| 69 virtual ~MockAutofillManager() {} | 71 virtual ~MockAutofillManager() {} |
| 70 }; | 72 }; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 external_delegate_->SelectAutofillSuggestionAtIndex(1); | 166 external_delegate_->SelectAutofillSuggestionAtIndex(1); |
| 165 } | 167 } |
| 166 | 168 |
| 167 // Test that the popup is hidden once we are done editing the autofill field. | 169 // Test that the popup is hidden once we are done editing the autofill field. |
| 168 TEST_F(AutofillExternalDelegateUnitTest, | 170 TEST_F(AutofillExternalDelegateUnitTest, |
| 169 ExternalDelegateHidePopupAfterEditing) { | 171 ExternalDelegateHidePopupAfterEditing) { |
| 170 EXPECT_CALL(*external_delegate_, HideAutofillPopup()); | 172 EXPECT_CALL(*external_delegate_, HideAutofillPopup()); |
| 171 | 173 |
| 172 external_delegate_->DidEndTextFieldEditing(); | 174 external_delegate_->DidEndTextFieldEditing(); |
| 173 } | 175 } |
| OLD | NEW |