Escape search terms correctly in the path portion of a custom search engine.

This regressed with the fix for bug 111923.  This attempts to correct the problem without breaking that bug, which requires being able to encode path components using arbitrary encodings.

This also eliminates a variety of functions as cleanup:
  * BrowserAccessibilityWin::Escape(); this was not actually used.
  * The 4-arg form of EscapeQueryParamValue(); only template_url.cc used this, and the necessary implementation can just move there.
  * EscapeQueryParamValueUTF8(); the few remaining callers using that can just manually convert on the caller side.

BUG=127475
TEST=Create custom search engine with url "http://google.com/%s", try using your custom engine to search for "foo/bar", and make sure you wind up at "google.com/foo/bar" and not "google.com/foo%2Fbar"
Review URL: https://chromiumcodereview.appspot.com/10444117

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139929 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/browser/search_engines/template_url_unittest.cc b/chrome/browser/search_engines/template_url_unittest.cc
index 656e7b8..42aa172 100644
--- a/chrome/browser/search_engines/template_url_unittest.cc
+++ b/chrome/browser/search_engines/template_url_unittest.cc
@@ -76,16 +76,15 @@
     const char* url;
     const string16 terms;
     const std::string output;
-    bool valid_url;
   } search_term_cases[] = {
     { "http://foo{searchTerms}", ASCIIToUTF16("sea rch/bar"),
-      "http://foosea%20rch%2Fbar", false },
+      "http://foosea%20rch/bar" },
     { "http://foo{searchTerms}?boo=abc", ASCIIToUTF16("sea rch/bar"),
-      "http://foosea%20rch%2Fbar?boo=abc", false },
+      "http://foosea%20rch/bar?boo=abc" },
     { "http://foo/?boo={searchTerms}", ASCIIToUTF16("sea rch/bar"),
-      "http://foo/?boo=sea+rch%2Fbar", true },
+      "http://foo/?boo=sea+rch%2Fbar" },
     { "http://en.wikipedia.org/{searchTerms}", ASCIIToUTF16("wiki/?"),
-      "http://en.wikipedia.org/wiki%2F%3F", true }
+      "http://en.wikipedia.org/wiki/%3F" }
   };
   for (size_t i = 0; i < ARRAYSIZE_UNSAFE(search_term_cases); ++i) {
     const SearchTermsCase& value = search_term_cases[i];
@@ -94,11 +93,10 @@
     TemplateURL url(NULL, data);
     EXPECT_TRUE(url.url_ref().IsValid());
     ASSERT_TRUE(url.url_ref().SupportsReplacement());
-    std::string result = url.url_ref().ReplaceSearchTerms(value.terms,
-        TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16());
-    EXPECT_EQ(value.output, result);
-    GURL result_url(result);
-    EXPECT_EQ(value.valid_url, result_url.is_valid());
+    GURL result(url.url_ref().ReplaceSearchTerms(value.terms,
+        TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, string16()));
+    ASSERT_TRUE(result.is_valid());
+    EXPECT_EQ(value.output, result.spec());
   }
 }