Chromium Code Reviews| 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> |
|
Mathieu
2016/04/04 13:36:17
#include <memory>
vabr (Chromium)
2016/04/04 14:29:04
Done.
| |
| 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" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/test/histogram_tester.h" | 13 #include "base/test/histogram_tester.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "components/autofill/core/browser/autofill_manager.h" | 15 #include "components/autofill/core/browser/autofill_manager.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 } | 140 } |
| 141 | 141 |
| 142 void IssueOnSuggestionsReturned() { | 142 void IssueOnSuggestionsReturned() { |
| 143 std::vector<Suggestion> suggestions; | 143 std::vector<Suggestion> suggestions; |
| 144 suggestions.push_back(Suggestion()); | 144 suggestions.push_back(Suggestion()); |
| 145 suggestions[0].frontend_id = kAutofillProfileId; | 145 suggestions[0].frontend_id = kAutofillProfileId; |
| 146 external_delegate_->OnSuggestionsReturned(kQueryId, suggestions); | 146 external_delegate_->OnSuggestionsReturned(kQueryId, suggestions); |
| 147 } | 147 } |
| 148 | 148 |
| 149 testing::NiceMock<MockAutofillClient> autofill_client_; | 149 testing::NiceMock<MockAutofillClient> autofill_client_; |
| 150 scoped_ptr<testing::NiceMock<MockAutofillDriver>> autofill_driver_; | 150 std::unique_ptr<testing::NiceMock<MockAutofillDriver>> autofill_driver_; |
| 151 scoped_ptr<MockAutofillManager> autofill_manager_; | 151 std::unique_ptr<MockAutofillManager> autofill_manager_; |
| 152 scoped_ptr<AutofillExternalDelegate> external_delegate_; | 152 std::unique_ptr<AutofillExternalDelegate> external_delegate_; |
| 153 | 153 |
| 154 base::MessageLoop message_loop_; | 154 base::MessageLoop message_loop_; |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 // Test that our external delegate called the virtual methods at the right time. | 157 // Test that our external delegate called the virtual methods at the right time. |
| 158 TEST_F(AutofillExternalDelegateUnitTest, TestExternalDelegateVirtualCalls) { | 158 TEST_F(AutofillExternalDelegateUnitTest, TestExternalDelegateVirtualCalls) { |
| 159 IssueOnQuery(kQueryId); | 159 IssueOnQuery(kQueryId); |
| 160 | 160 |
| 161 // The enums must be cast to ints to prevent compile errors on linux_rel. | 161 // The enums must be cast to ints to prevent compile errors on linux_rel. |
| 162 auto element_ids = testing::ElementsAre( | 162 auto element_ids = testing::ElementsAre( |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 604 RendererShouldFillFieldWithValue(dummy_string)); | 604 RendererShouldFillFieldWithValue(dummy_string)); |
| 605 base::HistogramTester histogram_tester; | 605 base::HistogramTester histogram_tester; |
| 606 external_delegate_->DidAcceptSuggestion(dummy_string, | 606 external_delegate_->DidAcceptSuggestion(dummy_string, |
| 607 POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY, | 607 POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY, |
| 608 0); | 608 0); |
| 609 histogram_tester.ExpectUniqueSample( | 609 histogram_tester.ExpectUniqueSample( |
| 610 "Autofill.SuggestionAcceptedIndex.Autocomplete", 0, 1); | 610 "Autofill.SuggestionAcceptedIndex.Autocomplete", 0, 1); |
| 611 } | 611 } |
| 612 | 612 |
| 613 } // namespace autofill | 613 } // namespace autofill |
| OLD | NEW |