| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/string16.h" | 8 #include "base/string16.h" |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 141 |
| 142 class MockAutofillExternalDelegate : public AutofillExternalDelegate { | 142 class MockAutofillExternalDelegate : public AutofillExternalDelegate { |
| 143 public: | 143 public: |
| 144 explicit MockAutofillExternalDelegate(TabContentsWrapper* wrapper) | 144 explicit MockAutofillExternalDelegate(TabContentsWrapper* wrapper) |
| 145 : AutofillExternalDelegate(wrapper) {} | 145 : AutofillExternalDelegate(wrapper) {} |
| 146 virtual ~MockAutofillExternalDelegate() {} | 146 virtual ~MockAutofillExternalDelegate() {} |
| 147 | 147 |
| 148 virtual void OnQuery(int query_id, | 148 virtual void OnQuery(int query_id, |
| 149 const webkit_glue::FormData& form, | 149 const webkit_glue::FormData& form, |
| 150 const webkit_glue::FormField& field, | 150 const webkit_glue::FormField& field, |
| 151 const gfx::Rect& bounds) OVERRIDE {} | 151 const gfx::Rect& bounds, |
| 152 bool display_warning) OVERRIDE {} |
| 153 |
| 152 MOCK_METHOD5(OnSuggestionsReturned, | 154 MOCK_METHOD5(OnSuggestionsReturned, |
| 153 void(int query_id, | 155 void(int query_id, |
| 154 const std::vector<string16>& autofill_values, | 156 const std::vector<string16>& autofill_values, |
| 155 const std::vector<string16>& autofill_labels, | 157 const std::vector<string16>& autofill_labels, |
| 156 const std::vector<string16>& autofill_icons, | 158 const std::vector<string16>& autofill_icons, |
| 157 const std::vector<int>& autofill_unique_ids)); | 159 const std::vector<int>& autofill_unique_ids)); |
| 158 | 160 |
| 159 virtual void HideAutofillPopup() OVERRIDE {} | 161 virtual void HideAutofillPopup() OVERRIDE {} |
| 160 | 162 |
| 163 |
| 164 virtual void ApplyAutofillSuggestions( |
| 165 const std::vector<string16>& autofill_values, |
| 166 const std::vector<string16>& autofill_labels, |
| 167 const std::vector<string16>& autofill_icons, |
| 168 const std::vector<int>& autofill_unique_ids, |
| 169 int separator_index) OVERRIDE {} |
| 170 |
| 171 virtual void OnQueryPlatformSpecific( |
| 172 int query_id, |
| 173 const webkit_glue::FormData& form, |
| 174 const webkit_glue::FormField& field) OVERRIDE {} |
| 175 |
| 161 private: | 176 private: |
| 162 DISALLOW_COPY_AND_ASSIGN(MockAutofillExternalDelegate); | 177 DISALLOW_COPY_AND_ASSIGN(MockAutofillExternalDelegate); |
| 163 }; | 178 }; |
| 164 | 179 |
| 165 class AutocompleteHistoryManagerStubSend : public AutocompleteHistoryManager { | 180 class AutocompleteHistoryManagerStubSend : public AutocompleteHistoryManager { |
| 166 public: | 181 public: |
| 167 explicit AutocompleteHistoryManagerStubSend(TabContents* tab_contents, | 182 explicit AutocompleteHistoryManagerStubSend(TabContents* tab_contents, |
| 168 Profile* profile, | 183 Profile* profile, |
| 169 WebDataService* wds) | 184 WebDataService* wds) |
| 170 : AutocompleteHistoryManager(tab_contents, profile, wds) {} | 185 : AutocompleteHistoryManager(tab_contents, profile, wds) {} |
| (...skipping 12 matching lines...) Expand all Loading... |
| 183 &profile_, web_data_service_); | 198 &profile_, web_data_service_); |
| 184 | 199 |
| 185 MockAutofillExternalDelegate external_delegate( | 200 MockAutofillExternalDelegate external_delegate( |
| 186 TabContentsWrapper::GetCurrentWrapperForContents(contents())); | 201 TabContentsWrapper::GetCurrentWrapperForContents(contents())); |
| 187 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _)); | 202 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _)); |
| 188 autocomplete_history_manager.SetExternalDelegate(&external_delegate); | 203 autocomplete_history_manager.SetExternalDelegate(&external_delegate); |
| 189 | 204 |
| 190 // Should trigger a call to OnSuggestionsReturned, verified by the mock. | 205 // Should trigger a call to OnSuggestionsReturned, verified by the mock. |
| 191 autocomplete_history_manager.SendSuggestions(NULL); | 206 autocomplete_history_manager.SendSuggestions(NULL); |
| 192 } | 207 } |
| OLD | NEW |