OLD | NEW |
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 19 matching lines...) Expand all Loading... |
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 protected: | 33 protected: |
34 virtual ~MockWebDataService() {} | 34 virtual ~MockWebDataService() {} |
35 }; | 35 }; |
36 | 36 |
37 class AutocompleteHistoryManagerTest : public ChromeRenderViewHostTestHarness { | 37 class AutocompleteHistoryManagerTest : public ChromeRenderViewHostTestHarness { |
38 protected: | 38 protected: |
39 AutocompleteHistoryManagerTest() | 39 AutocompleteHistoryManagerTest() |
40 : ui_thread_(BrowserThread::UI, MessageLoopForUI::current()) { | 40 : ui_thread_(BrowserThread::UI, MessageLoopForUI::current()), |
| 41 db_thread_(BrowserThread::DB) { |
41 } | 42 } |
42 | 43 |
43 virtual void SetUp() { | 44 virtual void SetUp() { |
44 ChromeRenderViewHostTestHarness::SetUp(); | 45 ChromeRenderViewHostTestHarness::SetUp(); |
45 web_data_service_ = new MockWebDataService(); | 46 web_data_service_ = new MockWebDataService(); |
46 autocomplete_manager_.reset(new AutocompleteHistoryManager( | 47 autocomplete_manager_.reset(new AutocompleteHistoryManager( |
47 contents(), &profile_, web_data_service_)); | 48 contents(), &profile_, web_data_service_)); |
48 } | 49 } |
49 | 50 |
50 content::TestBrowserThread ui_thread_; | 51 content::TestBrowserThread ui_thread_; |
| 52 content::TestBrowserThread db_thread_; |
51 | 53 |
52 TestingProfile profile_; | 54 TestingProfile profile_; |
53 scoped_refptr<MockWebDataService> web_data_service_; | 55 scoped_refptr<MockWebDataService> web_data_service_; |
54 scoped_ptr<AutocompleteHistoryManager> autocomplete_manager_; | 56 scoped_ptr<AutocompleteHistoryManager> autocomplete_manager_; |
55 }; | 57 }; |
56 | 58 |
57 // Tests that credit card numbers are not sent to the WebDatabase to be saved. | 59 // Tests that credit card numbers are not sent to the WebDatabase to be saved. |
58 TEST_F(AutocompleteHistoryManagerTest, CreditCardNumberValue) { | 60 TEST_F(AutocompleteHistoryManagerTest, CreditCardNumberValue) { |
59 FormData form; | 61 FormData form; |
60 form.name = ASCIIToUTF16("MyForm"); | 62 form.name = ASCIIToUTF16("MyForm"); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 &profile_, web_data_service_); | 187 &profile_, web_data_service_); |
186 | 188 |
187 MockAutofillExternalDelegate external_delegate( | 189 MockAutofillExternalDelegate external_delegate( |
188 TabContentsWrapper::GetCurrentWrapperForContents(contents())); | 190 TabContentsWrapper::GetCurrentWrapperForContents(contents())); |
189 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _)); | 191 EXPECT_CALL(external_delegate, OnSuggestionsReturned(_, _, _, _, _)); |
190 autocomplete_history_manager.SetExternalDelegate(&external_delegate); | 192 autocomplete_history_manager.SetExternalDelegate(&external_delegate); |
191 | 193 |
192 // Should trigger a call to OnSuggestionsReturned, verified by the mock. | 194 // Should trigger a call to OnSuggestionsReturned, verified by the mock. |
193 autocomplete_history_manager.SendSuggestions(NULL); | 195 autocomplete_history_manager.SendSuggestions(NULL); |
194 } | 196 } |
OLD | NEW |