Revert "[sheriff] Revert "Reduce usage of base::UTF8ToUTF16().""

This reverts commit d30ba328981c8835d579ce23af94a2617d2e2d1b.

The original CL exposed a pre-existing bug in the tests.  This fixes it.

Bug: 1189439
Change-Id: I832366e83092d39a6224f4ee75db2265886ff85a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2880897
Auto-Submit: Peter Kasting <[email protected]>
Commit-Queue: Daniel Cheng <[email protected]>
Reviewed-by: Daniel Cheng <[email protected]>
Owners-Override: Daniel Cheng <[email protected]>
Cr-Commit-Position: refs/heads/master@{#880613}
diff --git a/components/search_engines/template_url_unittest.cc b/components/search_engines/template_url_unittest.cc
index 79ec26e..2cbb292 100644
--- a/components/search_engines/template_url_unittest.cc
+++ b/components/search_engines/template_url_unittest.cc
@@ -522,14 +522,14 @@
     const std::string url;
     const std::string expected_result;
   } test_data[] = {
-      {"BIG5", u"\x60BD", "http://foo/?{searchTerms}{inputEncoding}",
+      {"BIG5", u"悽", "http://foo/?{searchTerms}{inputEncoding}",
        "http://foo/?%B1~BIG5"},
       {"UTF-8", u"blah", "http://foo/?{searchTerms}{inputEncoding}",
        "http://foo/?blahUTF-8"},
-      {"Shift_JIS", base::UTF8ToUTF16("\xe3\x81\x82"),
-       "http://foo/{searchTerms}/bar", "http://foo/%82%A0/bar"},
-      {"Shift_JIS", base::UTF8ToUTF16("\xe3\x81\x82 \xe3\x81\x84"),
-       "http://foo/{searchTerms}/bar", "http://foo/%82%A0%20%82%A2/bar"},
+      {"Shift_JIS", u"あ", "http://foo/{searchTerms}/bar",
+       "http://foo/%82%A0/bar"},
+      {"Shift_JIS", u"あ い", "http://foo/{searchTerms}/bar",
+       "http://foo/%82%A0%20%82%A2/bar"},
   };
   TemplateURLData data;
   for (size_t i = 0; i < base::size(test_data); ++i) {
@@ -558,27 +558,27 @@
   } test_data[] = {
       // First and third encodings are valid. First is used.
       {{"windows-1251", "cp-866", "UTF-8"},
-       base::UTF8ToUTF16("\xD1\x8F"),
+       u"я",
        "http://foo/?{searchTerms}{inputEncoding}",
        "http://foo/?%FFwindows-1251"},
       // Second and third encodings are valid, second is used.
       {{"cp-866", "GB2312", "UTF-8"},
-       base::UTF8ToUTF16("\xE7\x8B\x97"),
+       u"狗",
        "http://foo/?{searchTerms}{inputEncoding}",
        "http://foo/?%B9%B7GB2312"},
       // Second and third encodings are valid in another order, second is used.
       {{"cp-866", "UTF-8", "GB2312"},
-       base::UTF8ToUTF16("\xE7\x8B\x97"),
+       u"狗",
        "http://foo/?{searchTerms}{inputEncoding}",
        "http://foo/?%E7%8B%97UTF-8"},
       // Both encodings are invalid, fallback to UTF-8.
       {{"cp-866", "windows-1251"},
-       base::UTF8ToUTF16("\xE7\x8B\x97"),
+       u"狗",
        "http://foo/?{searchTerms}{inputEncoding}",
        "http://foo/?%E7%8B%97UTF-8"},
       // No encodings are given, fallback to UTF-8.
       {{},
-       base::UTF8ToUTF16("\xE7\x8B\x97"),
+       u"狗",
        "http://foo/?{searchTerms}{inputEncoding}",
        "http://foo/?%E7%8B%97UTF-8"},
   };
@@ -1854,9 +1854,7 @@
   ASSERT_EQ(u"blah", TemplateURL::GenerateKeyword(GURL("http://blah/")));
   // Don't generate the empty string.
   ASSERT_EQ(u"www.", TemplateURL::GenerateKeyword(GURL("http://www.")));
-  ASSERT_EQ(
-      base::UTF8ToUTF16("\xd0\xb0\xd0\xb1\xd0\xb2"),
-      TemplateURL::GenerateKeyword(GURL("http://xn--80acd")));
+  ASSERT_EQ(u"абв", TemplateURL::GenerateKeyword(GURL("http://xn--80acd")));
 
   // Generated keywords must always be in lowercase, because TemplateURLs always
   // converts keywords to lowercase in its constructor and TemplateURLService