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

Side by Side Diff: components/autofill/core/browser/name_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/name_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/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
9 #include "components/autofill/core/browser/autofill_field.h" 13 #include "components/autofill/core/browser/autofill_field.h"
10 #include "components/autofill/core/browser/autofill_scanner.h" 14 #include "components/autofill/core/browser/autofill_scanner.h"
11 #include "components/autofill/core/browser/name_field.h"
12 #include "components/autofill/core/common/form_field_data.h" 15 #include "components/autofill/core/common/form_field_data.h"
13 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
14 17
15 using base::ASCIIToUTF16; 18 using base::ASCIIToUTF16;
16 19
17 namespace autofill { 20 namespace autofill {
18 21
19 class NameFieldTest : public testing::Test { 22 class NameFieldTest : public testing::Test {
20 public: 23 public:
21 NameFieldTest() {} 24 NameFieldTest() {}
22 25
23 protected: 26 protected:
24 ScopedVector<AutofillField> list_; 27 ScopedVector<AutofillField> list_;
25 scoped_ptr<NameField> field_; 28 std::unique_ptr<NameField> field_;
26 FieldCandidatesMap field_candidates_map_; 29 FieldCandidatesMap field_candidates_map_;
27 30
28 // Downcast for tests. 31 // Downcast for tests.
29 static scoped_ptr<NameField> Parse(AutofillScanner* scanner) { 32 static std::unique_ptr<NameField> Parse(AutofillScanner* scanner) {
30 scoped_ptr<FormField> field = NameField::Parse(scanner); 33 std::unique_ptr<FormField> field = NameField::Parse(scanner);
31 return make_scoped_ptr(static_cast<NameField*>(field.release())); 34 return base::WrapUnique(static_cast<NameField*>(field.release()));
32 } 35 }
33 36
34 private: 37 private:
35 DISALLOW_COPY_AND_ASSIGN(NameFieldTest); 38 DISALLOW_COPY_AND_ASSIGN(NameFieldTest);
36 }; 39 };
37 40
38 TEST_F(NameFieldTest, FirstMiddleLast) { 41 TEST_F(NameFieldTest, FirstMiddleLast) {
39 FormFieldData field; 42 FormFieldData field;
40 field.form_control_type = "text"; 43 field.form_control_type = "text";
41 44
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 field_candidates_map_.end()); 333 field_candidates_map_.end());
331 EXPECT_EQ(NAME_MIDDLE_INITIAL, 334 EXPECT_EQ(NAME_MIDDLE_INITIAL,
332 field_candidates_map_[ASCIIToUTF16("name2")].BestHeuristicType()); 335 field_candidates_map_[ASCIIToUTF16("name2")].BestHeuristicType());
333 ASSERT_TRUE(field_candidates_map_.find(ASCIIToUTF16("name3")) != 336 ASSERT_TRUE(field_candidates_map_.find(ASCIIToUTF16("name3")) !=
334 field_candidates_map_.end()); 337 field_candidates_map_.end());
335 EXPECT_EQ(NAME_LAST, 338 EXPECT_EQ(NAME_LAST,
336 field_candidates_map_[ASCIIToUTF16("name3")].BestHeuristicType()); 339 field_candidates_map_[ASCIIToUTF16("name3")].BestHeuristicType());
337 } 340 }
338 341
339 } // namespace autofill 342 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/name_field.cc ('k') | components/autofill/core/browser/payments/payments_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698