From 7a0ba51c75001b30803574f5894256ae883993b8 Mon Sep 17 00:00:00 2001
From: "isherman@chromium.org"
 <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Wed, 15 Dec 2010 04:40:25 +0000
Subject: [PATCH] Don't wrap string16() around ASCIIToUTF16()

BUG=none
TEST=it compiles

Review URL: http://codereview.chromium.org/5766004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69231 0039d316-1c4b-4281-b951-d872f2087c98
---
 .../autofill/autofill_profile_unittest.cc     | 116 ++++++++----------
 1 file changed, 54 insertions(+), 62 deletions(-)

diff --git a/chrome/browser/autofill/autofill_profile_unittest.cc b/chrome/browser/autofill/autofill_profile_unittest.cc
index f3fd1e588da80..769296f54b86b 100644
--- a/chrome/browser/autofill/autofill_profile_unittest.cc
+++ b/chrome/browser/autofill/autofill_profile_unittest.cc
@@ -39,7 +39,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) {
       "12345678910", "01987654321");
   EXPECT_TRUE(UpdateProfileLabel(&profile00));
   string16 summary00 = profile00.Label();
-  EXPECT_EQ(string16(ASCIIToUTF16("Hollywood, CA")), summary00);
+  EXPECT_EQ(ASCIIToUTF16("Hollywood, CA"), summary00);
 
   // Case 1: "<address>"
   AutoFillProfile profile1;
@@ -48,7 +48,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) {
       "91601", "US", "12345678910", "01987654321");
   EXPECT_TRUE(UpdateProfileLabel(&profile1));
   string16 summary1 = profile1.Label();
-  EXPECT_EQ(string16(ASCIIToUTF16("123 Zoo St., Hollywood")), summary1);
+  EXPECT_EQ(ASCIIToUTF16("123 Zoo St., Hollywood"), summary1);
 
   // Case 2: "<lastname>"
   AutoFillProfile profile2;
@@ -58,7 +58,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) {
   EXPECT_TRUE(UpdateProfileLabel(&profile2));
   string16 summary2 = profile2.Label();
   // Summary does include full name which is empty if the first name is empty.
-  EXPECT_EQ(string16(ASCIIToUTF16("Hollywood, CA")), summary2);
+  EXPECT_EQ(ASCIIToUTF16("Hollywood, CA"), summary2);
 
   // Case 3: "<lastname>, <address>"
   AutoFillProfile profile3;
@@ -67,7 +67,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) {
       "Hollywood", "CA", "91601", "US", "12345678910", "01987654321");
   EXPECT_TRUE(UpdateProfileLabel(&profile3));
   string16 summary3 = profile3.Label();
-  EXPECT_EQ(string16(ASCIIToUTF16("123 Zoo St., Hollywood")), summary3);
+  EXPECT_EQ(ASCIIToUTF16("123 Zoo St., Hollywood"), summary3);
 
   // Case 4: "<firstname>"
   AutoFillProfile profile4;
@@ -76,7 +76,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) {
       "12345678910", "01987654321");
   EXPECT_TRUE(UpdateProfileLabel(&profile4));
   string16 summary4 = profile4.Label();
-  EXPECT_EQ(string16(ASCIIToUTF16("Marion Mitchell, Hollywood")), summary4);
+  EXPECT_EQ(ASCIIToUTF16("Marion Mitchell, Hollywood"), summary4);
 
   // Case 5: "<firstname>, <address>"
   AutoFillProfile profile5;
@@ -85,7 +85,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) {
       "91601", "US", "12345678910", "01987654321");
   EXPECT_TRUE(UpdateProfileLabel(&profile5));
   string16 summary5 = profile5.Label();
-  EXPECT_EQ(string16(ASCIIToUTF16("Marion Mitchell, 123 Zoo St.")), summary5);
+  EXPECT_EQ(ASCIIToUTF16("Marion Mitchell, 123 Zoo St."), summary5);
 
   // Case 6: "<firstname> <lastname>"
   AutoFillProfile profile6;
@@ -94,7 +94,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) {
       "91601", "US", "12345678910", "01987654321");
   EXPECT_TRUE(UpdateProfileLabel(&profile6));
   string16 summary6 = profile6.Label();
-  EXPECT_EQ(string16(ASCIIToUTF16("Marion Mitchell Morrison, Hollywood")),
+  EXPECT_EQ(ASCIIToUTF16("Marion Mitchell Morrison, Hollywood"),
             summary6);
 
   // Case 7: "<firstname> <lastname>, <address>"
@@ -104,7 +104,7 @@ TEST(AutoFillProfileTest, PreviewSummaryString) {
       "Hollywood", "CA", "91601", "US", "12345678910", "01987654321");
   EXPECT_TRUE(UpdateProfileLabel(&profile7));
   string16 summary7 = profile7.Label();
-  EXPECT_EQ(string16(ASCIIToUTF16("Marion Mitchell Morrison, 123 Zoo St.")),
+  EXPECT_EQ(ASCIIToUTF16("Marion Mitchell Morrison, 123 Zoo St."),
             summary7);
 
   // Case 7a: "<firstname> <lastname>, <address>" - same as #7, except for
@@ -119,10 +119,10 @@ TEST(AutoFillProfileTest, PreviewSummaryString) {
   EXPECT_TRUE(AutoFillProfile::AdjustInferredLabels(&profiles));
   summary7 = profile7.Label();
   string16 summary7a = profile7a.Label();
-  EXPECT_EQ(string16(ASCIIToUTF16(
-      "Marion Mitchell Morrison, 123 Zoo St., johnwayne@me.xyz")), summary7);
-  EXPECT_EQ(string16(ASCIIToUTF16(
-      "Marion Mitchell Morrison, 123 Zoo St., marion@me.xyz")), summary7a);
+  EXPECT_EQ(ASCIIToUTF16(
+      "Marion Mitchell Morrison, 123 Zoo St., johnwayne@me.xyz"), summary7);
+  EXPECT_EQ(ASCIIToUTF16(
+      "Marion Mitchell Morrison, 123 Zoo St., marion@me.xyz"), summary7a);
 }
 
 TEST(AutoFillProfileTest, AdjustInferredLabels) {
@@ -163,9 +163,9 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) {
   EXPECT_TRUE(AutoFillProfile::AdjustInferredLabels(&profiles));
   // No need to adjust them anymore.
   EXPECT_FALSE(AutoFillProfile::AdjustInferredLabels(&profiles));
-  EXPECT_EQ(string16(ASCIIToUTF16("John Doe, 666 Erebus St.")),
+  EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St."),
             profiles[0]->Label());
-  EXPECT_EQ(string16(ASCIIToUTF16("Jane Doe, 123 Letha Shore.")),
+  EXPECT_EQ(ASCIIToUTF16("Jane Doe, 123 Letha Shore."),
             profiles[1]->Label());
 
   profiles.push_back(new AutoFillProfile);
@@ -187,13 +187,11 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) {
   EXPECT_TRUE(AutoFillProfile::AdjustInferredLabels(&profiles));
 
   // Profile 0 and 2 inferred label now includes an e-mail.
-  EXPECT_EQ(string16(
-            ASCIIToUTF16("John Doe, 666 Erebus St., johndoe@hades.com")),
+  EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., johndoe@hades.com"),
             profiles[0]->Label());
-  EXPECT_EQ(string16(ASCIIToUTF16("Jane Doe, 123 Letha Shore.")),
+  EXPECT_EQ(ASCIIToUTF16("Jane Doe, 123 Letha Shore."),
             profiles[1]->Label());
-  EXPECT_EQ(string16(
-            ASCIIToUTF16("John Doe, 666 Erebus St., johndoe@tertium.com")),
+  EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., johndoe@tertium.com"),
             profiles[2]->Label());
 
   delete profiles[2];
@@ -219,13 +217,11 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) {
   EXPECT_TRUE(AutoFillProfile::AdjustInferredLabels(&profiles));
 
   // Profile 0 and 2 inferred label now includes a fax number.
-  EXPECT_EQ(string16(ASCIIToUTF16(
-            "John Doe, 666 Erebus St., fax:#22222222222")),
+  EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., fax:#22222222222"),
             profiles[0]->Label());
-  EXPECT_EQ(string16(ASCIIToUTF16("Jane Doe, 123 Letha Shore.")),
+  EXPECT_EQ(ASCIIToUTF16("Jane Doe, 123 Letha Shore."),
             profiles[1]->Label());
-  EXPECT_EQ(string16(ASCIIToUTF16(
-            "John Doe, 666 Erebus St., fax:#33333333333")),
+  EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., fax:#33333333333"),
             profiles[2]->Label());
 
   profiles.push_back(new AutoFillProfile);
@@ -247,17 +243,17 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) {
 
   EXPECT_TRUE(AutoFillProfile::AdjustInferredLabels(&profiles));
 
-  EXPECT_EQ(string16(ASCIIToUTF16("John Doe, 666 Erebus St., 11111111111,"
-                                  " fax:#22222222222")),
+  EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., 11111111111,"
+                         " fax:#22222222222"),
             profiles[0]->Label());
-  EXPECT_EQ(string16(ASCIIToUTF16("Jane Doe, 123 Letha Shore.")),
+  EXPECT_EQ(ASCIIToUTF16("Jane Doe, 123 Letha Shore."),
             profiles[1]->Label());
-  EXPECT_EQ(string16(ASCIIToUTF16("John Doe, 666 Erebus St., 11111111111,"
-                                  " fax:#33333333333")),
+  EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., 11111111111,"
+                         " fax:#33333333333"),
             profiles[2]->Label());
   // This one differs from other ones by unique phone, so no need for extra
   // information.
-  EXPECT_EQ(string16(ASCIIToUTF16("John Doe, 666 Erebus St., 44444444444")),
+  EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., 44444444444"),
             profiles[3]->Label());
 
   profiles.push_back(new AutoFillProfile);
@@ -279,25 +275,21 @@ TEST(AutoFillProfileTest, AdjustInferredLabels) {
 
   EXPECT_TRUE(AutoFillProfile::AdjustInferredLabels(&profiles));
 
-  EXPECT_EQ(string16(ASCIIToUTF16(
-      "John Doe, 666 Erebus St., johndoe@hades.com,"
-      " 11111111111, fax:#22222222222")),
-      profiles[0]->Label());
-  EXPECT_EQ(string16(ASCIIToUTF16("Jane Doe, 123 Letha Shore.")),
+  EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., johndoe@hades.com,"
+                         " 11111111111, fax:#22222222222"),
+            profiles[0]->Label());
+  EXPECT_EQ(ASCIIToUTF16("Jane Doe, 123 Letha Shore."),
             profiles[1]->Label());
-  EXPECT_EQ(string16(ASCIIToUTF16(
-      "John Doe, 666 Erebus St., johndoe@hades.com,"
-      " 11111111111, fax:#33333333333")),
-      profiles[2]->Label());
-  EXPECT_EQ(string16(ASCIIToUTF16(
-      "John Doe, 666 Erebus St., johndoe@hades.com,"
-      " 44444444444, fax:#33333333333")),
-      profiles[3]->Label());
+  EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., johndoe@hades.com,"
+                         " 11111111111, fax:#33333333333"),
+            profiles[2]->Label());
+  EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., johndoe@hades.com,"
+                         " 44444444444, fax:#33333333333"),
+            profiles[3]->Label());
   // This one differs from other ones by unique e-mail, so no need for extra
   // information.
-  EXPECT_EQ(string16(ASCIIToUTF16(
-      "John Doe, 666 Erebus St., johndoe@styx.com")),
-      profiles[4]->Label());
+  EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., johndoe@styx.com"),
+            profiles[4]->Label());
 
   EXPECT_FALSE(AutoFillProfile::AdjustInferredLabels(&profiles));
 
@@ -341,21 +333,21 @@ TEST(AutoFillProfileTest, CreateInferredLabels) {
   // Two fields at least - no filter.
   AutoFillProfile::CreateInferredLabels(&profiles, &labels, 2, UNKNOWN_TYPE,
                                         NULL);
-  EXPECT_EQ(string16(ASCIIToUTF16("John Doe, 666 Erebus St.")), labels[0]);
-  EXPECT_EQ(string16(ASCIIToUTF16("Jane Doe, 123 Letha Shore.")), labels[1]);
+  EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St."), labels[0]);
+  EXPECT_EQ(ASCIIToUTF16("Jane Doe, 123 Letha Shore."), labels[1]);
 
   // Three fields at least - no filter.
   AutoFillProfile::CreateInferredLabels(&profiles, &labels, 3, UNKNOWN_TYPE,
                                         NULL);
-  EXPECT_EQ(string16(ASCIIToUTF16("John Doe, 666 Erebus St., Elysium")),
+  EXPECT_EQ(ASCIIToUTF16("John Doe, 666 Erebus St., Elysium"),
             labels[0]);
-  EXPECT_EQ(string16(ASCIIToUTF16("Jane Doe, 123 Letha Shore., Dis")),
+  EXPECT_EQ(ASCIIToUTF16("Jane Doe, 123 Letha Shore., Dis"),
             labels[1]);
 
   // Two fields at least - filter out the name.
   AutoFillProfile::CreateInferredLabels(&profiles, &labels, 2, NAME_FULL, NULL);
-  EXPECT_EQ(string16(ASCIIToUTF16("666 Erebus St., Elysium")), labels[0]);
-  EXPECT_EQ(string16(ASCIIToUTF16("123 Letha Shore., Dis")), labels[1]);
+  EXPECT_EQ(ASCIIToUTF16("666 Erebus St., Elysium"), labels[0]);
+  EXPECT_EQ(ASCIIToUTF16("123 Letha Shore., Dis"), labels[1]);
 
   std::vector<AutoFillFieldType> suggested_fields;
   suggested_fields.push_back(ADDRESS_HOME_CITY);
@@ -365,21 +357,21 @@ TEST(AutoFillProfileTest, CreateInferredLabels) {
   // Two fields at least, from suggested fields - no filter.
   AutoFillProfile::CreateInferredLabels(&profiles, &labels, 2, UNKNOWN_TYPE,
                                         &suggested_fields);
-  EXPECT_EQ(string16(ASCIIToUTF16("Elysium, CA")), labels[0]);
-  EXPECT_EQ(string16(ASCIIToUTF16("Dis, CA")), labels[1]);
+  EXPECT_EQ(ASCIIToUTF16("Elysium, CA"), labels[0]);
+  EXPECT_EQ(ASCIIToUTF16("Dis, CA"), labels[1]);
 
   // Three fields at least, from suggested fields - no filter.
   AutoFillProfile::CreateInferredLabels(&profiles, &labels, 3, UNKNOWN_TYPE,
                                         &suggested_fields);
-  EXPECT_EQ(string16(ASCIIToUTF16("Elysium, CA, 91111")), labels[0]);
-  EXPECT_EQ(string16(ASCIIToUTF16("Dis, CA, 91222")), labels[1]);
+  EXPECT_EQ(ASCIIToUTF16("Elysium, CA, 91111"), labels[0]);
+  EXPECT_EQ(ASCIIToUTF16("Dis, CA, 91222"), labels[1]);
 
   // Three fields at least, from suggested fields - but filter reduces available
   // fields to two.
   AutoFillProfile::CreateInferredLabels(&profiles, &labels, 3,
                                         ADDRESS_HOME_STATE, &suggested_fields);
-  EXPECT_EQ(string16(ASCIIToUTF16("Elysium, 91111")), labels[0]);
-  EXPECT_EQ(string16(ASCIIToUTF16("Dis, 91222")), labels[1]);
+  EXPECT_EQ(ASCIIToUTF16("Elysium, 91111"), labels[0]);
+  EXPECT_EQ(ASCIIToUTF16("Dis, 91222"), labels[1]);
 
   suggested_fields.clear();
   // In our implementation we always display NAME_FULL for all NAME* fields...
@@ -387,15 +379,15 @@ TEST(AutoFillProfileTest, CreateInferredLabels) {
   // One field at least, from suggested fields - no filter.
   AutoFillProfile::CreateInferredLabels(&profiles, &labels, 1, UNKNOWN_TYPE,
                                         &suggested_fields);
-  EXPECT_EQ(string16(ASCIIToUTF16("John Doe")), labels[0]);
-  EXPECT_EQ(string16(ASCIIToUTF16("Jane Doe")), labels[1]);
+  EXPECT_EQ(ASCIIToUTF16("John Doe"), labels[0]);
+  EXPECT_EQ(ASCIIToUTF16("Jane Doe"), labels[1]);
 
   // One field at least, from suggested fields - filter the same as suggested
   // field.
   AutoFillProfile::CreateInferredLabels(&profiles, &labels, 1, NAME_MIDDLE,
                                         &suggested_fields);
-  EXPECT_EQ(string16(ASCIIToUTF16("")), labels[0]);
-  EXPECT_EQ(string16(ASCIIToUTF16("")), labels[1]);
+  EXPECT_EQ(string16(), labels[0]);
+  EXPECT_EQ(string16(), labels[1]);
   // Clean up.
   STLDeleteContainerPointers(profiles.begin(), profiles.end());
 }
-- 
GitLab