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

Side by Side Diff: components/autofill/core/browser/autofill_external_delegate_unittest.cc

Issue 1859453002: components/autofill: scoped_ptr -> unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed Created 4 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
OLDNEW
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 <memory>
5 #include <vector> 6 #include <vector>
6 7
7 #include "base/command_line.h" 8 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
9 #include "base/macros.h" 10 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
11 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 #include "base/test/histogram_tester.h" 14 #include "base/test/histogram_tester.h"
14 #include "build/build_config.h" 15 #include "build/build_config.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 141 }
141 142
142 void IssueOnSuggestionsReturned() { 143 void IssueOnSuggestionsReturned() {
143 std::vector<Suggestion> suggestions; 144 std::vector<Suggestion> suggestions;
144 suggestions.push_back(Suggestion()); 145 suggestions.push_back(Suggestion());
145 suggestions[0].frontend_id = kAutofillProfileId; 146 suggestions[0].frontend_id = kAutofillProfileId;
146 external_delegate_->OnSuggestionsReturned(kQueryId, suggestions); 147 external_delegate_->OnSuggestionsReturned(kQueryId, suggestions);
147 } 148 }
148 149
149 testing::NiceMock<MockAutofillClient> autofill_client_; 150 testing::NiceMock<MockAutofillClient> autofill_client_;
150 scoped_ptr<testing::NiceMock<MockAutofillDriver>> autofill_driver_; 151 std::unique_ptr<testing::NiceMock<MockAutofillDriver>> autofill_driver_;
151 scoped_ptr<MockAutofillManager> autofill_manager_; 152 std::unique_ptr<MockAutofillManager> autofill_manager_;
152 scoped_ptr<AutofillExternalDelegate> external_delegate_; 153 std::unique_ptr<AutofillExternalDelegate> external_delegate_;
153 154
154 base::MessageLoop message_loop_; 155 base::MessageLoop message_loop_;
155 }; 156 };
156 157
157 // Test that our external delegate called the virtual methods at the right time. 158 // Test that our external delegate called the virtual methods at the right time.
158 TEST_F(AutofillExternalDelegateUnitTest, TestExternalDelegateVirtualCalls) { 159 TEST_F(AutofillExternalDelegateUnitTest, TestExternalDelegateVirtualCalls) {
159 IssueOnQuery(kQueryId); 160 IssueOnQuery(kQueryId);
160 161
161 // The enums must be cast to ints to prevent compile errors on linux_rel. 162 // The enums must be cast to ints to prevent compile errors on linux_rel.
162 auto element_ids = testing::ElementsAre( 163 auto element_ids = testing::ElementsAre(
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 RendererShouldFillFieldWithValue(dummy_string)); 605 RendererShouldFillFieldWithValue(dummy_string));
605 base::HistogramTester histogram_tester; 606 base::HistogramTester histogram_tester;
606 external_delegate_->DidAcceptSuggestion(dummy_string, 607 external_delegate_->DidAcceptSuggestion(dummy_string,
607 POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY, 608 POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY,
608 0); 609 0);
609 histogram_tester.ExpectUniqueSample( 610 histogram_tester.ExpectUniqueSample(
610 "Autofill.SuggestionAcceptedIndex.Autocomplete", 0, 1); 611 "Autofill.SuggestionAcceptedIndex.Autocomplete", 0, 1);
611 } 612 }
612 613
613 } // namespace autofill 614 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698