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

Side by Side Diff: components/autofill/core/browser/address_field_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 "components/autofill/core/browser/address_field.h"
6
7 #include <memory>
8
5 #include "base/macros.h" 9 #include "base/macros.h"
6 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/ptr_util.h"
7 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
8 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
9 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
10 #include "components/autofill/core/browser/address_field.h"
11 #include "components/autofill/core/browser/autofill_field.h" 14 #include "components/autofill/core/browser/autofill_field.h"
12 #include "components/autofill/core/browser/autofill_scanner.h" 15 #include "components/autofill/core/browser/autofill_scanner.h"
13 #include "components/autofill/core/common/form_field_data.h" 16 #include "components/autofill/core/common/form_field_data.h"
14 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
15 18
16 using base::ASCIIToUTF16; 19 using base::ASCIIToUTF16;
17 20
18 namespace autofill { 21 namespace autofill {
19 22
20 class AddressFieldTest : public testing::Test { 23 class AddressFieldTest : public testing::Test {
21 public: 24 public:
22 AddressFieldTest() {} 25 AddressFieldTest() {}
23 26
24 protected: 27 protected:
25 ScopedVector<AutofillField> list_; 28 ScopedVector<AutofillField> list_;
26 scoped_ptr<AddressField> field_; 29 std::unique_ptr<AddressField> field_;
27 FieldCandidatesMap field_candidates_map_; 30 FieldCandidatesMap field_candidates_map_;
28 31
29 // Downcast for tests. 32 // Downcast for tests.
30 static scoped_ptr<AddressField> Parse(AutofillScanner* scanner) { 33 static std::unique_ptr<AddressField> Parse(AutofillScanner* scanner) {
31 scoped_ptr<FormField> field = AddressField::Parse(scanner); 34 std::unique_ptr<FormField> field = AddressField::Parse(scanner);
32 return make_scoped_ptr(static_cast<AddressField*>(field.release())); 35 return base::WrapUnique(static_cast<AddressField*>(field.release()));
33 } 36 }
34 37
35 private: 38 private:
36 DISALLOW_COPY_AND_ASSIGN(AddressFieldTest); 39 DISALLOW_COPY_AND_ASSIGN(AddressFieldTest);
37 }; 40 };
38 41
39 TEST_F(AddressFieldTest, Empty) { 42 TEST_F(AddressFieldTest, Empty) {
40 AutofillScanner scanner(list_.get()); 43 AutofillScanner scanner(list_.get());
41 field_ = Parse(&scanner); 44 field_ = Parse(&scanner);
42 ASSERT_EQ(nullptr, field_.get()); 45 ASSERT_EQ(nullptr, field_.get());
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 ASSERT_NE(nullptr, field_.get()); 260 ASSERT_NE(nullptr, field_.get());
258 field_->AddClassifications(&field_candidates_map_); 261 field_->AddClassifications(&field_candidates_map_);
259 ASSERT_TRUE(field_candidates_map_.find(ASCIIToUTF16("company1")) != 262 ASSERT_TRUE(field_candidates_map_.find(ASCIIToUTF16("company1")) !=
260 field_candidates_map_.end()); 263 field_candidates_map_.end());
261 EXPECT_EQ( 264 EXPECT_EQ(
262 COMPANY_NAME, 265 COMPANY_NAME,
263 field_candidates_map_[ASCIIToUTF16("company1")].BestHeuristicType()); 266 field_candidates_map_[ASCIIToUTF16("company1")].BestHeuristicType());
264 } 267 }
265 268
266 } // namespace autofill 269 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/address_field.cc ('k') | components/autofill/core/browser/address_i18n.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698