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

Side by Side Diff: components/autofill/core/browser/autofill_profile_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/autofill_profile.h"
6
5 #include <stddef.h> 7 #include <stddef.h>
6 8
9 #include <memory>
10
7 #include "base/format_macros.h" 11 #include "base/format_macros.h"
8 #include "base/guid.h" 12 #include "base/guid.h"
9 #include "base/macros.h" 13 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
12 #include "base/stl_util.h" 15 #include "base/stl_util.h"
13 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
14 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
15 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
16 #include "components/autofill/core/browser/autofill_profile.h"
17 #include "components/autofill/core/browser/autofill_test_utils.h" 19 #include "components/autofill/core/browser/autofill_test_utils.h"
18 #include "components/autofill/core/browser/autofill_type.h" 20 #include "components/autofill/core/browser/autofill_type.h"
19 #include "components/autofill/core/browser/field_types.h" 21 #include "components/autofill/core/browser/field_types.h"
20 #include "components/autofill/core/common/form_field_data.h" 22 #include "components/autofill/core/common/form_field_data.h"
21 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
22 24
23 using base::ASCIIToUTF16; 25 using base::ASCIIToUTF16;
24 using base::UTF8ToUTF16; 26 using base::UTF8ToUTF16;
25 27
26 namespace autofill { 28 namespace autofill {
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 suggested_fields.push_back(NAME_FULL); 800 suggested_fields.push_back(NAME_FULL);
799 suggested_fields.push_back(ADDRESS_HOME_STREET_ADDRESS); 801 suggested_fields.push_back(ADDRESS_HOME_STREET_ADDRESS);
800 std::vector<base::string16> labels; 802 std::vector<base::string16> labels;
801 AutofillProfile::CreateInferredLabels(profiles.get(), &suggested_fields, 803 AutofillProfile::CreateInferredLabels(profiles.get(), &suggested_fields,
802 NAME_FULL, 1, "en-US", &labels); 804 NAME_FULL, 1, "en-US", &labels);
803 ASSERT_EQ(1U, labels.size()); 805 ASSERT_EQ(1U, labels.size());
804 EXPECT_EQ(ASCIIToUTF16("88 Nowhere Ave., Apt. 42"), labels[0]); 806 EXPECT_EQ(ASCIIToUTF16("88 Nowhere Ave., Apt. 42"), labels[0]);
805 } 807 }
806 808
807 TEST(AutofillProfileTest, IsSubsetOf) { 809 TEST(AutofillProfileTest, IsSubsetOf) {
808 scoped_ptr<AutofillProfile> a, b; 810 std::unique_ptr<AutofillProfile> a, b;
809 811
810 // |a| is a subset of |b|. 812 // |a| is a subset of |b|.
811 a.reset( 813 a.reset(
812 new AutofillProfile(base::GenerateGUID(), "https://www.example.com/")); 814 new AutofillProfile(base::GenerateGUID(), "https://www.example.com/"));
813 b.reset( 815 b.reset(
814 new AutofillProfile(base::GenerateGUID(), "https://www.example.com/")); 816 new AutofillProfile(base::GenerateGUID(), "https://www.example.com/"));
815 test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson", 817 test::SetProfileInfo(a.get(), "Thomas", NULL, "Jefferson",
816 "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL, 818 "declaration_guy@gmail.com", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
817 NULL); 819 NULL);
818 test::SetProfileInfo(b.get(), "Thomas", NULL, "Jefferson", 820 test::SetProfileInfo(b.get(), "Thomas", NULL, "Jefferson",
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 AutofillProfile::CanonicalizeProfileString(base::WideToUTF16( 1110 AutofillProfile::CanonicalizeProfileString(base::WideToUTF16(
1109 L"Mid\x2013Island\x2003 Plaza"))); 1111 L"Mid\x2013Island\x2003 Plaza")));
1110 1112
1111 // Newline character removed. 1113 // Newline character removed.
1112 EXPECT_EQ(ASCIIToUTF16("1600 amphitheatre pkwy app 2"), 1114 EXPECT_EQ(ASCIIToUTF16("1600 amphitheatre pkwy app 2"),
1113 AutofillProfile::CanonicalizeProfileString( 1115 AutofillProfile::CanonicalizeProfileString(
1114 ASCIIToUTF16("1600 amphitheatre pkwy \n App. 2"))); 1116 ASCIIToUTF16("1600 amphitheatre pkwy \n App. 2")));
1115 } 1117 }
1116 1118
1117 } // namespace autofill 1119 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698