| OLD | NEW |
| 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/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/test/scoped_task_environment.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "components/autofill/core/browser/autocomplete_history_manager.h" | 15 #include "components/autofill/core/browser/autocomplete_history_manager.h" |
| 15 #include "components/autofill/core/browser/autofill_external_delegate.h" | 16 #include "components/autofill/core/browser/autofill_external_delegate.h" |
| 16 #include "components/autofill/core/browser/autofill_manager.h" | 17 #include "components/autofill/core/browser/autofill_manager.h" |
| 17 #include "components/autofill/core/browser/autofill_test_utils.h" | 18 #include "components/autofill/core/browser/autofill_test_utils.h" |
| 18 #include "components/autofill/core/browser/test_autofill_client.h" | 19 #include "components/autofill/core/browser/test_autofill_client.h" |
| 19 #include "components/autofill/core/browser/test_autofill_driver.h" | 20 #include "components/autofill/core/browser/test_autofill_driver.h" |
| 20 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 21 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 21 #include "components/autofill/core/common/form_data.h" | 22 #include "components/autofill/core/common/form_data.h" |
| 22 #include "components/prefs/pref_service.h" | 23 #include "components/prefs/pref_service.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void SetUp() override { | 72 void SetUp() override { |
| 72 web_data_service_ = new MockWebDataService(); | 73 web_data_service_ = new MockWebDataService(); |
| 73 autofill_client_.reset(new MockAutofillClient(web_data_service_)); | 74 autofill_client_.reset(new MockAutofillClient(web_data_service_)); |
| 74 autofill_driver_.reset(new TestAutofillDriver()); | 75 autofill_driver_.reset(new TestAutofillDriver()); |
| 75 autocomplete_manager_.reset(new AutocompleteHistoryManager( | 76 autocomplete_manager_.reset(new AutocompleteHistoryManager( |
| 76 autofill_driver_.get(), autofill_client_.get())); | 77 autofill_driver_.get(), autofill_client_.get())); |
| 77 } | 78 } |
| 78 | 79 |
| 79 void TearDown() override { autocomplete_manager_.reset(); } | 80 void TearDown() override { autocomplete_manager_.reset(); } |
| 80 | 81 |
| 81 base::MessageLoop message_loop_; | 82 base::test::ScopedTaskEnvironment scoped_task_environment_; |
| 82 scoped_refptr<MockWebDataService> web_data_service_; | 83 scoped_refptr<MockWebDataService> web_data_service_; |
| 83 std::unique_ptr<AutocompleteHistoryManager> autocomplete_manager_; | 84 std::unique_ptr<AutocompleteHistoryManager> autocomplete_manager_; |
| 84 std::unique_ptr<AutofillDriver> autofill_driver_; | 85 std::unique_ptr<AutofillDriver> autofill_driver_; |
| 85 std::unique_ptr<MockAutofillClient> autofill_client_; | 86 std::unique_ptr<MockAutofillClient> autofill_client_; |
| 86 }; | 87 }; |
| 87 | 88 |
| 88 // Tests that credit card numbers are not sent to the WebDatabase to be saved. | 89 // Tests that credit card numbers are not sent to the WebDatabase to be saved. |
| 89 TEST_F(AutocompleteHistoryManagerTest, CreditCardNumberValue) { | 90 TEST_F(AutocompleteHistoryManagerTest, CreditCardNumberValue) { |
| 90 FormData form; | 91 FormData form; |
| 91 form.name = ASCIIToUTF16("MyForm"); | 92 form.name = ASCIIToUTF16("MyForm"); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 OnSuggestionsReturned(0, | 261 OnSuggestionsReturned(0, |
| 261 testing::Truly(IsEmptySuggestionVector))); | 262 testing::Truly(IsEmptySuggestionVector))); |
| 262 autocomplete_history_manager.OnGetAutocompleteSuggestions( | 263 autocomplete_history_manager.OnGetAutocompleteSuggestions( |
| 263 0, | 264 0, |
| 264 field.name, | 265 field.name, |
| 265 field.value, | 266 field.value, |
| 266 field.form_control_type); | 267 field.form_control_type); |
| 267 } | 268 } |
| 268 | 269 |
| 269 } // namespace autofill | 270 } // namespace autofill |
| OLD | NEW |