| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 #endif | 322 #endif |
| 323 static_cast<int>(POPUP_ITEM_ID_AUTOFILL_OPTIONS)); | 323 static_cast<int>(POPUP_ITEM_ID_AUTOFILL_OPTIONS)); |
| 324 EXPECT_CALL(autofill_client_, | 324 EXPECT_CALL(autofill_client_, |
| 325 ShowAutofillPopup(_, _, SuggestionVectorIdsAre(element_ids), _)); | 325 ShowAutofillPopup(_, _, SuggestionVectorIdsAre(element_ids), _)); |
| 326 | 326 |
| 327 // Have an Autofill item that is identical to one of the datalist entries. | 327 // Have an Autofill item that is identical to one of the datalist entries. |
| 328 std::vector<Suggestion> autofill_item; | 328 std::vector<Suggestion> autofill_item; |
| 329 autofill_item.push_back(Suggestion()); | 329 autofill_item.push_back(Suggestion()); |
| 330 autofill_item[0].value = ASCIIToUTF16("Rick"); | 330 autofill_item[0].value = ASCIIToUTF16("Rick"); |
| 331 autofill_item[0].frontend_id = kAutofillProfileId; | 331 autofill_item[0].frontend_id = kAutofillProfileId; |
| 332 ; | |
| 333 external_delegate_->OnSuggestionsReturned(kQueryId, autofill_item); | 332 external_delegate_->OnSuggestionsReturned(kQueryId, autofill_item); |
| 334 } | 333 } |
| 335 | 334 |
| 336 // Test that we de-dupe autocomplete values against datalist values, keeping the | 335 // Test that we de-dupe autocomplete values against datalist values, keeping the |
| 337 // latter in case of a match. | 336 // latter in case of a match. |
| 338 TEST_F(AutofillExternalDelegateUnitTest, DuplicateAutocompleteDatalistValues) { | 337 TEST_F(AutofillExternalDelegateUnitTest, DuplicateAutocompleteDatalistValues) { |
| 339 IssueOnQuery(kQueryId); | 338 IssueOnQuery(kQueryId); |
| 340 | 339 |
| 341 std::vector<base::string16> data_list_items; | 340 std::vector<base::string16> data_list_items; |
| 342 data_list_items.push_back(base::ASCIIToUTF16("Rick")); | 341 data_list_items.push_back(base::ASCIIToUTF16("Rick")); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 RendererShouldFillFieldWithValue(dummy_string)); | 595 RendererShouldFillFieldWithValue(dummy_string)); |
| 597 base::HistogramTester histogram_tester; | 596 base::HistogramTester histogram_tester; |
| 598 external_delegate_->DidAcceptSuggestion(dummy_string, | 597 external_delegate_->DidAcceptSuggestion(dummy_string, |
| 599 POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY, | 598 POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY, |
| 600 0); | 599 0); |
| 601 histogram_tester.ExpectUniqueSample( | 600 histogram_tester.ExpectUniqueSample( |
| 602 "Autofill.SuggestionAcceptedIndex.Autocomplete", 0, 1); | 601 "Autofill.SuggestionAcceptedIndex.Autocomplete", 0, 1); |
| 603 } | 602 } |
| 604 | 603 |
| 605 } // namespace autofill | 604 } // namespace autofill |
| OLD | NEW |