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

Side by Side Diff: chrome/browser/autocomplete_history_manager_unittest.cc

Issue 8488011: Moving AutofillAgent Logic into Browser (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 namespace { 139 namespace {
140 140
141 class MockAutofillExternalDelegate : public AutofillExternalDelegate { 141 class MockAutofillExternalDelegate : public AutofillExternalDelegate {
142 public: 142 public:
143 explicit MockAutofillExternalDelegate(TabContentsWrapper* wrapper) 143 explicit MockAutofillExternalDelegate(TabContentsWrapper* wrapper)
144 : AutofillExternalDelegate(wrapper) {} 144 : AutofillExternalDelegate(wrapper) {}
145 virtual ~MockAutofillExternalDelegate() {} 145 virtual ~MockAutofillExternalDelegate() {}
146 146
147 virtual void OnQuery(int query_id, 147 virtual void OnQuery(int query_id,
148 const webkit_glue::FormData& form, 148 const webkit_glue::FormData& form,
149 const webkit_glue::FormField& field) {} 149 const webkit_glue::FormField& field,
150 bool display_warning) OVERRIDE {}
150 MOCK_METHOD5(OnSuggestionsReturned, 151 MOCK_METHOD5(OnSuggestionsReturned,
151 void(int query_id, 152 void(int query_id,
152 const std::vector<string16>& autofill_values, 153 const std::vector<string16>& autofill_values,
153 const std::vector<string16>& autofill_labels, 154 const std::vector<string16>& autofill_labels,
154 const std::vector<string16>& autofill_icons, 155 const std::vector<string16>& autofill_icons,
155 const std::vector<int>& autofill_unique_ids)); 156 const std::vector<int>& autofill_unique_ids));
156 157
158 virtual void ApplyAutofillSuggestions(
159 const std::vector<string16>& autofill_values,
160 const std::vector<string16>& autofill_labels,
161 const std::vector<string16>& autofill_icons,
162 const std::vector<int>& autofill_unique_ids,
163 int separator_index) OVERRIDE {}
164
157 private: 165 private:
158 DISALLOW_COPY_AND_ASSIGN(MockAutofillExternalDelegate); 166 DISALLOW_COPY_AND_ASSIGN(MockAutofillExternalDelegate);
159 }; 167 };
160 168
161 class AutocompleteHistoryManagerStubSend : public AutocompleteHistoryManager { 169 class AutocompleteHistoryManagerStubSend : public AutocompleteHistoryManager {
162 public: 170 public:
163 explicit AutocompleteHistoryManagerStubSend(TabContents* tab_contents, 171 explicit AutocompleteHistoryManagerStubSend(TabContents* tab_contents,
164 Profile* profile, 172 Profile* profile,
165 WebDataService* wds) 173 WebDataService* wds)
166 : AutocompleteHistoryManager(tab_contents, profile, wds) {} 174 : AutocompleteHistoryManager(tab_contents, profile, wds) {}
(...skipping 12 matching lines...) Expand all
179 &profile_, web_data_service_); 187 &profile_, web_data_service_);
180 188
181 MockAutofillExternalDelegate external_delegate( 189 MockAutofillExternalDelegate external_delegate(
182 TabContentsWrapper::GetCurrentWrapperForContents(contents())); 190 TabContentsWrapper::GetCurrentWrapperForContents(contents()));
183 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _)); 191 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _));
184 autocomplete_history_manager.SetExternalDelegate(&external_delegate); 192 autocomplete_history_manager.SetExternalDelegate(&external_delegate);
185 193
186 // Should trigger a call to OnSuggestionsReturned, verified by the mock. 194 // Should trigger a call to OnSuggestionsReturned, verified by the mock.
187 autocomplete_history_manager.SendSuggestions(NULL); 195 autocomplete_history_manager.SendSuggestions(NULL);
188 } 196 }
189
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698