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

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

Issue 8429016: Autofill: unit test / valgrind; gyp tweak (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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
« no previous file with comments | « no previous file | content/content_common.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 DISALLOW_COPY_AND_ASSIGN(MockAutofillExternalDelegate); 157 DISALLOW_COPY_AND_ASSIGN(MockAutofillExternalDelegate);
158 }; 158 };
159 159
160 class AutocompleteHistoryManagerStubSend : public AutocompleteHistoryManager { 160 class AutocompleteHistoryManagerStubSend : public AutocompleteHistoryManager {
161 public: 161 public:
162 explicit AutocompleteHistoryManagerStubSend(TabContents* tab_contents, 162 explicit AutocompleteHistoryManagerStubSend(TabContents* tab_contents,
163 Profile* profile, 163 Profile* profile,
164 WebDataService* wds) 164 WebDataService* wds)
165 : AutocompleteHistoryManager(tab_contents, profile, wds) {} 165 : AutocompleteHistoryManager(tab_contents, profile, wds) {}
166 166
167 virtual bool Send(IPC::Message* message) { return true; } // intentional nop 167 // Intentionally swallow the message.
168 virtual bool Send(IPC::Message* message) { delete message; return true; }
168 }; 169 };
169 170
170 } // namespace 171 } // namespace
171 172
172 // Make sure our external delegate is called at the right time. 173 // Make sure our external delegate is called at the right time.
173 TEST_F(AutocompleteHistoryManagerTest, ExternalDelegate) { 174 TEST_F(AutocompleteHistoryManagerTest, ExternalDelegate) {
174 // Local version with a stubbed out Send() 175 // Local version with a stubbed out Send()
175 AutocompleteHistoryManagerStubSend autocomplete_history_manager( 176 AutocompleteHistoryManagerStubSend autocomplete_history_manager(
176 contents(), 177 contents(),
177 &profile_, web_data_service_); 178 &profile_, web_data_service_);
178 179
179 MockAutofillExternalDelegate external_delegate( 180 MockAutofillExternalDelegate external_delegate(
180 TabContentsWrapper::GetCurrentWrapperForContents(contents())); 181 TabContentsWrapper::GetCurrentWrapperForContents(contents()));
181 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _)); 182 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _));
182 autocomplete_history_manager.SetExternalDelegate(&external_delegate); 183 autocomplete_history_manager.SetExternalDelegate(&external_delegate);
183 184
184 // Should trigger a call to OnSuggestionsReturned, verified by the mock. 185 // Should trigger a call to OnSuggestionsReturned, verified by the mock.
185 autocomplete_history_manager.SendSuggestions(NULL); 186 autocomplete_history_manager.SendSuggestions(NULL);
186 } 187 }
187 188
OLDNEW
« no previous file with comments | « no previous file | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698