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

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

Issue 10006037: Moved WebDataService to ProfileKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed compile Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
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/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/autocomplete_history_manager.h" 10 #include "chrome/browser/autocomplete_history_manager.h"
(...skipping 16 matching lines...) Expand all
27 27
28 class MockWebDataService : public WebDataService { 28 class MockWebDataService : public WebDataService {
29 public: 29 public:
30 MOCK_METHOD1(AddFormFields, 30 MOCK_METHOD1(AddFormFields,
31 void(const std::vector<webkit::forms::FormField>&)); // NOLINT 31 void(const std::vector<webkit::forms::FormField>&)); // NOLINT
32 }; 32 };
33 33
34 class AutocompleteHistoryManagerTest : public ChromeRenderViewHostTestHarness { 34 class AutocompleteHistoryManagerTest : public ChromeRenderViewHostTestHarness {
35 protected: 35 protected:
36 AutocompleteHistoryManagerTest() 36 AutocompleteHistoryManagerTest()
37 : ui_thread_(BrowserThread::UI, MessageLoopForUI::current()) { 37 : ui_thread_(BrowserThread::UI, MessageLoopForUI::current()),
38 db_thread_(BrowserThread::DB) {
38 } 39 }
39 40
40 virtual void SetUp() { 41 virtual void SetUp() {
41 ChromeRenderViewHostTestHarness::SetUp(); 42 ChromeRenderViewHostTestHarness::SetUp();
42 web_data_service_ = new MockWebDataService(); 43 web_data_service_ = new MockWebDataService();
43 autocomplete_manager_.reset(new AutocompleteHistoryManager( 44 autocomplete_manager_.reset(new AutocompleteHistoryManager(
44 contents(), &profile_, web_data_service_)); 45 contents(), &profile_, web_data_service_));
45 } 46 }
46 47
47 content::TestBrowserThread ui_thread_; 48 content::TestBrowserThread ui_thread_;
49 content::TestBrowserThread db_thread_;
48 50
49 TestingProfile profile_; 51 TestingProfile profile_;
50 scoped_refptr<MockWebDataService> web_data_service_; 52 scoped_refptr<MockWebDataService> web_data_service_;
51 scoped_ptr<AutocompleteHistoryManager> autocomplete_manager_; 53 scoped_ptr<AutocompleteHistoryManager> autocomplete_manager_;
52 }; 54 };
53 55
54 // Tests that credit card numbers are not sent to the WebDatabase to be saved. 56 // Tests that credit card numbers are not sent to the WebDatabase to be saved.
55 TEST_F(AutocompleteHistoryManagerTest, CreditCardNumberValue) { 57 TEST_F(AutocompleteHistoryManagerTest, CreditCardNumberValue) {
56 FormData form; 58 FormData form;
57 form.name = ASCIIToUTF16("MyForm"); 59 form.name = ASCIIToUTF16("MyForm");
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 &profile_, web_data_service_); 185 &profile_, web_data_service_);
184 186
185 MockAutofillExternalDelegate external_delegate( 187 MockAutofillExternalDelegate external_delegate(
186 TabContentsWrapper::GetCurrentWrapperForContents(contents())); 188 TabContentsWrapper::GetCurrentWrapperForContents(contents()));
187 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _)); 189 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _));
188 autocomplete_history_manager.SetExternalDelegate(&external_delegate); 190 autocomplete_history_manager.SetExternalDelegate(&external_delegate);
189 191
190 // Should trigger a call to OnSuggestionsReturned, verified by the mock. 192 // Should trigger a call to OnSuggestionsReturned, verified by the mock.
191 autocomplete_history_manager.SendSuggestions(NULL); 193 autocomplete_history_manager.SendSuggestions(NULL);
192 } 194 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete_history_manager.cc ('k') | chrome/browser/autofill/autofill_metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698