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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 MOCK_METHOD0(HideAutofillPopup, void()); | 48 MOCK_METHOD0(HideAutofillPopup, void()); |
49 | 49 |
50 private: | 50 private: |
51 virtual void HideAutofillPopupInternal() {}; | 51 virtual void HideAutofillPopupInternal() {}; |
52 }; | 52 }; |
53 | 53 |
54 class MockAutofillManager : public AutofillManager { | 54 class MockAutofillManager : public AutofillManager { |
55 public: | 55 public: |
56 explicit MockAutofillManager(TabContentsWrapper* tab_contents) | 56 explicit MockAutofillManager(TabContentsWrapper* tab_contents) |
57 : AutofillManager(tab_contents) {} | 57 : AutofillManager(tab_contents) {} |
58 ~MockAutofillManager() {} | |
59 | 58 |
60 MOCK_METHOD4(OnFillAutofillFormData, | 59 MOCK_METHOD4(OnFillAutofillFormData, |
61 void(int query_id, | 60 void(int query_id, |
62 const webkit::forms::FormData& form, | 61 const webkit::forms::FormData& form, |
63 const webkit::forms::FormField& field, | 62 const webkit::forms::FormField& field, |
64 int unique_id)); | 63 int unique_id)); |
| 64 |
| 65 protected: |
| 66 virtual ~MockAutofillManager() {} |
65 }; | 67 }; |
66 | 68 |
67 } // namespace | 69 } // namespace |
68 | 70 |
69 class AutofillExternalDelegateUnitTest : public TabContentsWrapperTestHarness { | 71 class AutofillExternalDelegateUnitTest : public TabContentsWrapperTestHarness { |
70 public: | 72 public: |
71 AutofillExternalDelegateUnitTest() | 73 AutofillExternalDelegateUnitTest() |
72 : ui_thread_(BrowserThread::UI, &message_loop_) {} | 74 : ui_thread_(BrowserThread::UI, &message_loop_) {} |
73 virtual ~AutofillExternalDelegateUnitTest() {} | 75 virtual ~AutofillExternalDelegateUnitTest() {} |
74 | 76 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // negative unique id. | 133 // negative unique id. |
132 TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateInvalidUniqueId) { | 134 TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateInvalidUniqueId) { |
133 // Ensure it doesn't try to preview the negative id. | 135 // Ensure it doesn't try to preview the negative id. |
134 EXPECT_CALL(*autofill_manager_, OnFillAutofillFormData(_, _, _, _)).Times(0); | 136 EXPECT_CALL(*autofill_manager_, OnFillAutofillFormData(_, _, _, _)).Times(0); |
135 external_delegate_->SelectAutofillSuggestionAtIndex(-1, 0); | 137 external_delegate_->SelectAutofillSuggestionAtIndex(-1, 0); |
136 | 138 |
137 // Ensure it doesn't try to fill the form in with the negative id. | 139 // Ensure it doesn't try to fill the form in with the negative id. |
138 EXPECT_CALL(*autofill_manager_, OnFillAutofillFormData(_, _, _, _)).Times(0); | 140 EXPECT_CALL(*autofill_manager_, OnFillAutofillFormData(_, _, _, _)).Times(0); |
139 external_delegate_->DidAcceptAutofillSuggestions(string16(), -1, 0); | 141 external_delegate_->DidAcceptAutofillSuggestions(string16(), -1, 0); |
140 } | 142 } |
OLD | NEW |