Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: components/autofill/core/browser/autocomplete_history_manager_unittest.cc

Issue 204343004: Add supports that allow Autofill to be initiated from textarea field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update code as per Ilya's review comments Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 MockAutofillExternalDelegate external_delegate(autofill_manager.get(), 219 MockAutofillExternalDelegate external_delegate(autofill_manager.get(),
220 autofill_driver_.get()); 220 autofill_driver_.get());
221 autocomplete_history_manager.SetExternalDelegate(&external_delegate); 221 autocomplete_history_manager.SetExternalDelegate(&external_delegate);
222 222
223 // Should trigger a call to OnSuggestionsReturned, verified by the mock. 223 // Should trigger a call to OnSuggestionsReturned, verified by the mock.
224 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _)); 224 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _));
225 autocomplete_history_manager.SendSuggestions(NULL); 225 autocomplete_history_manager.SendSuggestions(NULL);
226 } 226 }
227 227
228 // Verify that no autocomplete suggestion is returned for textarea.
Ilya Sherman 2014/03/20 22:22:03 Hmm, where does the test verify that no suggestion
ziran.sun 2014/03/21 12:00:22 It's actually testing if autocomplete_history_mana
Ilya Sherman 2014/03/21 23:01:11 IMO the test would make more sense if the mock exp
ziran.sun 2014/03/24 15:24:49 Yes, this certainly makes sense. Just updated code
229 TEST_F(AutocompleteHistoryManagerTest, TextArea) {
Ilya Sherman 2014/03/20 22:22:03 nit: Please name this test "NoAutocompleteSuggesti
ziran.sun 2014/03/21 12:00:22 Done.
230 TestAutocompleteHistoryManager autocomplete_history_manager(
231 autofill_driver_.get(), manager_delegate_.get());
232
233 scoped_ptr<AutofillManager> autofill_manager(new AutofillManager(
234 autofill_driver_.get(),
235 manager_delegate_.get(),
236 "en-US",
237 AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER));
238
239 MockAutofillExternalDelegate external_delegate(autofill_manager.get(),
240 autofill_driver_.get());
241 autocomplete_history_manager.SetExternalDelegate(&external_delegate);
242
243 FormData form;
244 form.name = ASCIIToUTF16("MyForm");
245 form.method = ASCIIToUTF16("POST");
246 form.origin = GURL("http://myform.com/form.html");
247 form.action = GURL("http://myform.com/submit.html");
248 form.user_submitted = true;
249
250 FormFieldData field;
251 test::CreateTestFormField("Address", "address", "", "textarea", &field);
252
253 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _));
254 autocomplete_history_manager.OnGetAutocompleteSuggestions(
255 0,
256 field.name,
257 field.value,
258 field.form_control_type,
259 std::vector<base::string16>(),
260 std::vector<base::string16>(),
261 std::vector<base::string16>(),
262 std::vector<int>());
263 }
264
228 } // namespace autofill 265 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autocomplete_history_manager.cc ('k') | components/autofill/core/browser/autofill_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698