[LSC] Remove base::ASCIIToUTF16("...") in //components
This change removes calls to base::ASCIIToUTF16 in //components with a
single-line string literal and replaces them with a u"..." literal
instead. Files where this change would cause compilation errors were not
changed.
This is a mechanical change:
$ git grep -lw ASCIIToUTF16 components | xargs \
sed -i 's/\(base::\)\?ASCIIToUTF16(\("\(\\.\|[^\\"]\)*"\))/u\2/g'
$ git cl format
Bug: 1189439
Change-Id: Ie31fb5af442621ca093c5dfc46b69c846307731a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2780083
Commit-Queue: Peter Kasting <[email protected]>
Auto-Submit: Jan Wilken Dörrie <[email protected]>
Reviewed-by: Peter Kasting <[email protected]>
Owners-Override: Peter Kasting <[email protected]>
Cr-Commit-Position: refs/heads/master@{#865632}
diff --git a/components/omnibox/browser/answers_cache_unittest.cc b/components/omnibox/browser/answers_cache_unittest.cc
index 0090ccb..c2d33b033 100644
--- a/components/omnibox/browser/answers_cache_unittest.cc
+++ b/components/omnibox/browser/answers_cache_unittest.cc
@@ -14,14 +14,14 @@
TEST(AnswersCacheTest, UpdatePopulatesCache) {
AnswersCache cache(1);
- cache.UpdateRecentAnswers(base::ASCIIToUTF16("weather los angeles"), 2334);
+ cache.UpdateRecentAnswers(u"weather los angeles", 2334);
EXPECT_FALSE(cache.empty());
}
TEST(AnswersCacheTest, GetWillRetrieveMatchingInfo) {
AnswersCache cache(1);
- std::u16string full_query_text = base::ASCIIToUTF16("weather los angeles");
+ std::u16string full_query_text = u"weather los angeles";
int query_type = 2334;
cache.UpdateRecentAnswers(full_query_text, query_type);
@@ -44,32 +44,31 @@
TEST(AnswersCacheTest, MatchMostRecent) {
AnswersCache cache(2);
- std::u16string query_weather_la = base::ASCIIToUTF16("weather los angeles");
- std::u16string query_weather_lv = base::ASCIIToUTF16("weather las vegas");
+ std::u16string query_weather_la = u"weather los angeles";
+ std::u16string query_weather_lv = u"weather las vegas";
int query_type = 2334;
cache.UpdateRecentAnswers(query_weather_lv, query_type);
cache.UpdateRecentAnswers(query_weather_la, query_type);
// "weather los angeles" is most recent match to "weather l".
- AnswersQueryData data =
- cache.GetTopAnswerEntry(base::ASCIIToUTF16("weather l"));
+ AnswersQueryData data = cache.GetTopAnswerEntry(u"weather l");
EXPECT_EQ(query_weather_la, data.full_query_text);
// Update recency for "weather las vegas".
cache.GetTopAnswerEntry(query_weather_lv);
// "weather las vegas" should now be the most recent match to "weather l".
- data = cache.GetTopAnswerEntry(base::ASCIIToUTF16("weather l"));
+ data = cache.GetTopAnswerEntry(u"weather l");
EXPECT_EQ(query_weather_lv, data.full_query_text);
}
TEST(AnswersCacheTest, LeastRecentItemIsEvicted) {
AnswersCache cache(2);
- std::u16string query_weather_la = base::ASCIIToUTF16("weather los angeles");
- std::u16string query_weather_lv = base::ASCIIToUTF16("weather las vegas");
- std::u16string query_weather_lb = base::ASCIIToUTF16("weather long beach");
+ std::u16string query_weather_la = u"weather los angeles";
+ std::u16string query_weather_lv = u"weather las vegas";
+ std::u16string query_weather_lb = u"weather long beach";
int query_type = 2334;
cache.UpdateRecentAnswers(query_weather_lb, query_type);
@@ -93,9 +92,9 @@
TEST(AnswersCacheTest, DuplicateEntries) {
AnswersCache cache(2);
- std::u16string query_weather_lv = base::ASCIIToUTF16("weather las vegas");
- std::u16string query_weather_lb = base::ASCIIToUTF16("weather long beach");
- std::u16string query_weather_l = base::ASCIIToUTF16("weather l");
+ std::u16string query_weather_lv = u"weather las vegas";
+ std::u16string query_weather_lb = u"weather long beach";
+ std::u16string query_weather_l = u"weather l";
int query_type = 2334;
cache.UpdateRecentAnswers(query_weather_lb, query_type);
diff --git a/components/omnibox/browser/autocomplete_input.cc b/components/omnibox/browser/autocomplete_input.cc
index e9be180..84ca8053 100644
--- a/components/omnibox/browser/autocomplete_input.cc
+++ b/components/omnibox/browser/autocomplete_input.cc
@@ -49,9 +49,8 @@
// to split a single term in a hostname (if it seems to think that the
// hostname is multiple words). Neither of these behaviors is desirable.
const std::string separator(url::kStandardSchemeSeparator);
- for (const auto& term :
- base::SplitString(text, base::ASCIIToUTF16(" "),
- base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
+ for (const auto& term : base::SplitString(text, u" ", base::TRIM_WHITESPACE,
+ base::SPLIT_WANT_ALL)) {
const std::string term_utf8(base::UTF16ToUTF8(term));
static const char* kSchemes[2] = { url::kHttpScheme, url::kHttpsScheme };
for (const char* scheme : kSchemes) {
@@ -372,8 +371,7 @@
// just the word "invalid" is not a hostname).
const std::u16string original_host(
text.substr(parts->host.begin, parts->host.len));
- if (text != base::ASCIIToUTF16("invalid") &&
- (host_info.family == url::CanonHostInfo::NEUTRAL) &&
+ if (text != u"invalid" && (host_info.family == url::CanonHostInfo::NEUTRAL) &&
(!net::IsCanonicalizedHostCompliant(canonicalized_url->host()) ||
canonicalized_url->DomainIs("invalid"))) {
// Invalid hostname. There are several possible cases:
diff --git a/components/omnibox/browser/autocomplete_input_unittest.cc b/components/omnibox/browser/autocomplete_input_unittest.cc
index 4dcd3c2..6b9073d 100644
--- a/components/omnibox/browser/autocomplete_input_unittest.cc
+++ b/components/omnibox/browser/autocomplete_input_unittest.cc
@@ -27,197 +27,187 @@
const metrics::OmniboxInputType type;
} input_cases[] = {
{std::u16string(), metrics::OmniboxInputType::EMPTY},
- {ASCIIToUTF16("?"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("?foo"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("?foo bar"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("?http://foo.com/bar"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("foo"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("foo._"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("foo.c"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("foo.com"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("-foo.com"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("foo-.com"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("foo_.com"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("foo.-com"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("foo/"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("foo/bar"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("foo/bar%00"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("foo/bar/"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("foo/bar baz\\"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("foo.com/bar"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("foo;bar"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("foo/bar baz"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("foo bar.com"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("foo bar"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("foo+bar"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("foo+bar.com"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("\"foo:bar\""), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("link:foo.com"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("foo:81"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("www.foo.com:81"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("foo.com:123456"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("foo.com:abc"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("1.2.3.4:abc"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("user@foo"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("[email protected]"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("user@foo/"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("user@foo/z"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("user@foo/z z"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("[email protected]/z"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("user @foo/"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("us er@foo/z"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("u ser@foo/z z"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("us [email protected]/z"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("user:pass@"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("user:pass@!foo.com"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("user:pass@foo"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("user:[email protected]"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("user:[email protected]"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("space user:pass@foo"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("space user:[email protected]"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("space user:[email protected]"),
- metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("user:[email protected]:81"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("user:pass@foo:81"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16(".1"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16(".1/3"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("1.2"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16(".1.2"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("1.2/"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("1.2/45"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("6008/32768"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("12345678/"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("123456789/"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("1.2:45"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("[email protected]:45"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("user@foo:45"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("user:[email protected]:45"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("host?query"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("host#"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("host#ref"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("host# ref"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("host/#ref"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("host/?#ref"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("host/?#"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("host.com#ref"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://host#ref"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("host/path?query"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("host/path#ref"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("en.wikipedia.org/wiki/Jim Beam"),
- metrics::OmniboxInputType::URL},
+ {u"?", metrics::OmniboxInputType::QUERY},
+ {u"?foo", metrics::OmniboxInputType::QUERY},
+ {u"?foo bar", metrics::OmniboxInputType::QUERY},
+ {u"?http://foo.com/bar", metrics::OmniboxInputType::QUERY},
+ {u"foo", metrics::OmniboxInputType::UNKNOWN},
+ {u"foo._", metrics::OmniboxInputType::QUERY},
+ {u"foo.c", metrics::OmniboxInputType::UNKNOWN},
+ {u"foo.com", metrics::OmniboxInputType::URL},
+ {u"-foo.com", metrics::OmniboxInputType::URL},
+ {u"foo-.com", metrics::OmniboxInputType::URL},
+ {u"foo_.com", metrics::OmniboxInputType::URL},
+ {u"foo.-com", metrics::OmniboxInputType::QUERY},
+ {u"foo/", metrics::OmniboxInputType::URL},
+ {u"foo/bar", metrics::OmniboxInputType::UNKNOWN},
+ {u"foo/bar%00", metrics::OmniboxInputType::QUERY},
+ {u"foo/bar/", metrics::OmniboxInputType::URL},
+ {u"foo/bar baz\\", metrics::OmniboxInputType::URL},
+ {u"foo.com/bar", metrics::OmniboxInputType::URL},
+ {u"foo;bar", metrics::OmniboxInputType::QUERY},
+ {u"foo/bar baz", metrics::OmniboxInputType::UNKNOWN},
+ {u"foo bar.com", metrics::OmniboxInputType::QUERY},
+ {u"foo bar", metrics::OmniboxInputType::QUERY},
+ {u"foo+bar", metrics::OmniboxInputType::QUERY},
+ {u"foo+bar.com", metrics::OmniboxInputType::UNKNOWN},
+ {u"\"foo:bar\"", metrics::OmniboxInputType::QUERY},
+ {u"link:foo.com", metrics::OmniboxInputType::UNKNOWN},
+ {u"foo:81", metrics::OmniboxInputType::URL},
+ {u"www.foo.com:81", metrics::OmniboxInputType::URL},
+ {u"foo.com:123456", metrics::OmniboxInputType::QUERY},
+ {u"foo.com:abc", metrics::OmniboxInputType::QUERY},
+ {u"1.2.3.4:abc", metrics::OmniboxInputType::QUERY},
+ {u"user@foo", metrics::OmniboxInputType::UNKNOWN},
+ {u"[email protected]", metrics::OmniboxInputType::UNKNOWN},
+ {u"user@foo/", metrics::OmniboxInputType::URL},
+ {u"user@foo/z", metrics::OmniboxInputType::URL},
+ {u"user@foo/z z", metrics::OmniboxInputType::URL},
+ {u"[email protected]/z", metrics::OmniboxInputType::URL},
+ {u"user @foo/", metrics::OmniboxInputType::UNKNOWN},
+ {u"us er@foo/z", metrics::OmniboxInputType::UNKNOWN},
+ {u"u ser@foo/z z", metrics::OmniboxInputType::UNKNOWN},
+ {u"us [email protected]/z", metrics::OmniboxInputType::UNKNOWN},
+ {u"user:pass@", metrics::OmniboxInputType::UNKNOWN},
+ {u"user:pass@!foo.com", metrics::OmniboxInputType::UNKNOWN},
+ {u"user:pass@foo", metrics::OmniboxInputType::URL},
+ {u"user:[email protected]", metrics::OmniboxInputType::URL},
+ {u"user:[email protected]", metrics::OmniboxInputType::URL},
+ {u"space user:pass@foo", metrics::OmniboxInputType::UNKNOWN},
+ {u"space user:[email protected]", metrics::OmniboxInputType::UNKNOWN},
+ {u"space user:[email protected]", metrics::OmniboxInputType::UNKNOWN},
+ {u"user:[email protected]:81", metrics::OmniboxInputType::URL},
+ {u"user:pass@foo:81", metrics::OmniboxInputType::URL},
+ {u".1", metrics::OmniboxInputType::QUERY},
+ {u".1/3", metrics::OmniboxInputType::QUERY},
+ {u"1.2", metrics::OmniboxInputType::QUERY},
+ {u".1.2", metrics::OmniboxInputType::UNKNOWN},
+ {u"1.2/", metrics::OmniboxInputType::URL},
+ {u"1.2/45", metrics::OmniboxInputType::QUERY},
+ {u"6008/32768", metrics::OmniboxInputType::QUERY},
+ {u"12345678/", metrics::OmniboxInputType::QUERY},
+ {u"123456789/", metrics::OmniboxInputType::URL},
+ {u"1.2:45", metrics::OmniboxInputType::QUERY},
+ {u"[email protected]:45", metrics::OmniboxInputType::QUERY},
+ {u"user@foo:45", metrics::OmniboxInputType::URL},
+ {u"user:[email protected]:45", metrics::OmniboxInputType::URL},
+ {u"host?query", metrics::OmniboxInputType::UNKNOWN},
+ {u"host#", metrics::OmniboxInputType::UNKNOWN},
+ {u"host#ref", metrics::OmniboxInputType::UNKNOWN},
+ {u"host# ref", metrics::OmniboxInputType::UNKNOWN},
+ {u"host/#ref", metrics::OmniboxInputType::URL},
+ {u"host/?#ref", metrics::OmniboxInputType::URL},
+ {u"host/?#", metrics::OmniboxInputType::URL},
+ {u"host.com#ref", metrics::OmniboxInputType::URL},
+ {u"http://host#ref", metrics::OmniboxInputType::URL},
+ {u"host/path?query", metrics::OmniboxInputType::URL},
+ {u"host/path#ref", metrics::OmniboxInputType::URL},
+ {u"en.wikipedia.org/wiki/Jim Beam", metrics::OmniboxInputType::URL},
// In Chrome itself, mailto: will get handled by ShellExecute, but in
// unittest mode, we don't have the data loaded in the external protocol
// handler to know this.
- // { ASCIIToUTF16("mailto:[email protected]"), metrics::OmniboxInputType::URL },
- {ASCIIToUTF16("view-source:http://www.foo.com/"),
- metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("javascript"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("javascript:alert(\"Hi there\");"),
- metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("javascript:alert%28\"Hi there\"%29;"),
- metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("javascript:foo"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("javascript:foo;"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("javascript:\"foo\""), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("javascript:"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("javascript:the cromulent parts"),
- metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("javascript:foo.getter"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("JavaScript:Tutorials"), metrics::OmniboxInputType::UNKNOWN},
+ // { u"mailto:[email protected]", metrics::OmniboxInputType::URL },
+ {u"view-source:http://www.foo.com/", metrics::OmniboxInputType::URL},
+ {u"javascript", metrics::OmniboxInputType::UNKNOWN},
+ {u"javascript:alert(\"Hi there\");", metrics::OmniboxInputType::URL},
+ {u"javascript:alert%28\"Hi there\"%29;", metrics::OmniboxInputType::URL},
+ {u"javascript:foo", metrics::OmniboxInputType::UNKNOWN},
+ {u"javascript:foo;", metrics::OmniboxInputType::URL},
+ {u"javascript:\"foo\"", metrics::OmniboxInputType::URL},
+ {u"javascript:", metrics::OmniboxInputType::UNKNOWN},
+ {u"javascript:the cromulent parts", metrics::OmniboxInputType::UNKNOWN},
+ {u"javascript:foo.getter", metrics::OmniboxInputType::URL},
+ {u"JavaScript:Tutorials", metrics::OmniboxInputType::UNKNOWN},
#if defined(OS_WIN)
- {ASCIIToUTF16("C:\\Program Files"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("\\\\Server\\Folder\\File"), metrics::OmniboxInputType::URL},
+ {u"C:\\Program Files", metrics::OmniboxInputType::URL},
+ {u"\\\\Server\\Folder\\File", metrics::OmniboxInputType::URL},
#endif // defined(OS_WIN)
- {ASCIIToUTF16("http:foo"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://foo"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://foo._"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("http://foo.c"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://foo.com"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://foo_bar.com"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://foo/bar%00"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("http://foo/bar baz"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://-foo.com"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://foo-.com"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://foo_.com"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://foo.-com"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("http://_foo_.com"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://foo.com:abc"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("http://foo.com:123456"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("http://1.2.3.4:abc"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("http:[email protected]"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://[email protected]"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://space [email protected]"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://user:pass@foo"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://space user:pass@foo"),
- metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http:space user:pass@foo"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http:user:[email protected]"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://user:[email protected]"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://1.2"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http:[email protected]"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://1.2/45"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http:ps/2 games"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("https://foo.com"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("127.0.0.1"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("127.0.1"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("127.0.1/"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("0.0.0"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("0.0.0.0"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("0.0.0.1"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("http://0.0.0.1/"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("browser.tabs.closeButtons"),
- metrics::OmniboxInputType::UNKNOWN},
+ {u"http:foo", metrics::OmniboxInputType::URL},
+ {u"http://foo", metrics::OmniboxInputType::URL},
+ {u"http://foo._", metrics::OmniboxInputType::UNKNOWN},
+ {u"http://foo.c", metrics::OmniboxInputType::URL},
+ {u"http://foo.com", metrics::OmniboxInputType::URL},
+ {u"http://foo_bar.com", metrics::OmniboxInputType::URL},
+ {u"http://foo/bar%00", metrics::OmniboxInputType::QUERY},
+ {u"http://foo/bar baz", metrics::OmniboxInputType::URL},
+ {u"http://-foo.com", metrics::OmniboxInputType::URL},
+ {u"http://foo-.com", metrics::OmniboxInputType::URL},
+ {u"http://foo_.com", metrics::OmniboxInputType::URL},
+ {u"http://foo.-com", metrics::OmniboxInputType::UNKNOWN},
+ {u"http://_foo_.com", metrics::OmniboxInputType::URL},
+ {u"http://foo.com:abc", metrics::OmniboxInputType::QUERY},
+ {u"http://foo.com:123456", metrics::OmniboxInputType::QUERY},
+ {u"http://1.2.3.4:abc", metrics::OmniboxInputType::QUERY},
+ {u"http:[email protected]", metrics::OmniboxInputType::URL},
+ {u"http://[email protected]", metrics::OmniboxInputType::URL},
+ {u"http://space [email protected]", metrics::OmniboxInputType::URL},
+ {u"http://user:pass@foo", metrics::OmniboxInputType::URL},
+ {u"http://space user:pass@foo", metrics::OmniboxInputType::URL},
+ {u"http:space user:pass@foo", metrics::OmniboxInputType::URL},
+ {u"http:user:[email protected]", metrics::OmniboxInputType::URL},
+ {u"http://user:[email protected]", metrics::OmniboxInputType::URL},
+ {u"http://1.2", metrics::OmniboxInputType::URL},
+ {u"http:[email protected]", metrics::OmniboxInputType::URL},
+ {u"http://1.2/45", metrics::OmniboxInputType::URL},
+ {u"http:ps/2 games", metrics::OmniboxInputType::URL},
+ {u"https://foo.com", metrics::OmniboxInputType::URL},
+ {u"127.0.0.1", metrics::OmniboxInputType::URL},
+ {u"127.0.1", metrics::OmniboxInputType::QUERY},
+ {u"127.0.1/", metrics::OmniboxInputType::URL},
+ {u"0.0.0", metrics::OmniboxInputType::QUERY},
+ {u"0.0.0.0", metrics::OmniboxInputType::URL},
+ {u"0.0.0.1", metrics::OmniboxInputType::QUERY},
+ {u"http://0.0.0.1/", metrics::OmniboxInputType::QUERY},
+ {u"browser.tabs.closeButtons", metrics::OmniboxInputType::UNKNOWN},
{u"\u6d4b\u8bd5", metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("[2001:]"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("[2001:dB8::1]"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("192.168.0.256"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("[foo.com]"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("filesystem:http://a.com/t/bar"),
- metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("filesystem:http://a.com/"),
- metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("filesystem:file://"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("filesystem:http"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("filesystem:"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("chrome-search://"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("chrome-devtools:"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("chrome-devtools://"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("chrome-devtools://x"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("devtools:"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("devtools://"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("devtools://x"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("about://f;"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("://w"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16(":w"), metrics::OmniboxInputType::UNKNOWN},
+ {u"[2001:]", metrics::OmniboxInputType::QUERY},
+ {u"[2001:dB8::1]", metrics::OmniboxInputType::URL},
+ {u"192.168.0.256", metrics::OmniboxInputType::QUERY},
+ {u"[foo.com]", metrics::OmniboxInputType::QUERY},
+ {u"filesystem:http://a.com/t/bar", metrics::OmniboxInputType::URL},
+ {u"filesystem:http://a.com/", metrics::OmniboxInputType::QUERY},
+ {u"filesystem:file://", metrics::OmniboxInputType::QUERY},
+ {u"filesystem:http", metrics::OmniboxInputType::QUERY},
+ {u"filesystem:", metrics::OmniboxInputType::QUERY},
+ {u"chrome-search://", metrics::OmniboxInputType::QUERY},
+ {u"chrome-devtools:", metrics::OmniboxInputType::UNKNOWN},
+ {u"chrome-devtools://", metrics::OmniboxInputType::UNKNOWN},
+ {u"chrome-devtools://x", metrics::OmniboxInputType::UNKNOWN},
+ {u"devtools:", metrics::OmniboxInputType::QUERY},
+ {u"devtools://", metrics::OmniboxInputType::QUERY},
+ {u"devtools://x", metrics::OmniboxInputType::URL},
+ {u"about://f;", metrics::OmniboxInputType::QUERY},
+ {u"://w", metrics::OmniboxInputType::UNKNOWN},
+ {u":w", metrics::OmniboxInputType::UNKNOWN},
{u".\u062A", metrics::OmniboxInputType::UNKNOWN},
// These tests are for https://tools.ietf.org/html/rfc6761.
- {ASCIIToUTF16("localhost"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("localhost:8080"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("foo.localhost"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("foo localhost"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("foo.example"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("foo example"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("http://example/"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("example"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("example "), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16(" example"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16(" example "), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("example."), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16(".example"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16(".example."), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("example:"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("example:80/ "), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("http://foo.invalid"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("foo.invalid/"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("foo.invalid"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("foo invalid"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("invalid"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("foo.test"), metrics::OmniboxInputType::URL},
- {ASCIIToUTF16("foo test"), metrics::OmniboxInputType::QUERY},
- {ASCIIToUTF16("test"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("test.."), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("..test"), metrics::OmniboxInputType::UNKNOWN},
- {ASCIIToUTF16("test:80/"), metrics::OmniboxInputType::URL},
+ {u"localhost", metrics::OmniboxInputType::URL},
+ {u"localhost:8080", metrics::OmniboxInputType::URL},
+ {u"foo.localhost", metrics::OmniboxInputType::URL},
+ {u"foo localhost", metrics::OmniboxInputType::QUERY},
+ {u"foo.example", metrics::OmniboxInputType::URL},
+ {u"foo example", metrics::OmniboxInputType::QUERY},
+ {u"http://example/", metrics::OmniboxInputType::URL},
+ {u"example", metrics::OmniboxInputType::UNKNOWN},
+ {u"example ", metrics::OmniboxInputType::UNKNOWN},
+ {u" example", metrics::OmniboxInputType::UNKNOWN},
+ {u" example ", metrics::OmniboxInputType::UNKNOWN},
+ {u"example.", metrics::OmniboxInputType::UNKNOWN},
+ {u".example", metrics::OmniboxInputType::UNKNOWN},
+ {u".example.", metrics::OmniboxInputType::UNKNOWN},
+ {u"example:", metrics::OmniboxInputType::UNKNOWN},
+ {u"example:80/ ", metrics::OmniboxInputType::URL},
+ {u"http://foo.invalid", metrics::OmniboxInputType::UNKNOWN},
+ {u"foo.invalid/", metrics::OmniboxInputType::QUERY},
+ {u"foo.invalid", metrics::OmniboxInputType::QUERY},
+ {u"foo invalid", metrics::OmniboxInputType::QUERY},
+ {u"invalid", metrics::OmniboxInputType::UNKNOWN},
+ {u"foo.test", metrics::OmniboxInputType::URL},
+ {u"foo test", metrics::OmniboxInputType::QUERY},
+ {u"test", metrics::OmniboxInputType::UNKNOWN},
+ {u"test..", metrics::OmniboxInputType::UNKNOWN},
+ {u"..test", metrics::OmniboxInputType::UNKNOWN},
+ {u"test:80/", metrics::OmniboxInputType::URL},
};
for (size_t i = 0; i < base::size(input_cases); ++i) {
@@ -236,30 +226,28 @@
const metrics::OmniboxInputType type;
const std::string spec; // Unused if not a URL.
} input_cases[] = {
- {ASCIIToUTF16("401k"), metrics::OmniboxInputType::URL,
+ {u"401k", metrics::OmniboxInputType::URL,
std::string("http://www.401k.com/")},
- {ASCIIToUTF16("56"), metrics::OmniboxInputType::URL,
+ {u"56", metrics::OmniboxInputType::URL,
std::string("http://www.56.com/")},
- {ASCIIToUTF16("1.2"), metrics::OmniboxInputType::URL,
+ {u"1.2", metrics::OmniboxInputType::URL,
std::string("http://www.1.2.com/")},
- {ASCIIToUTF16("1.2/3.4"), metrics::OmniboxInputType::URL,
+ {u"1.2/3.4", metrics::OmniboxInputType::URL,
std::string("http://www.1.2.com/3.4")},
- {ASCIIToUTF16("192.168.0.1"), metrics::OmniboxInputType::URL,
+ {u"192.168.0.1", metrics::OmniboxInputType::URL,
std::string("http://www.192.168.0.1.com/")},
- {ASCIIToUTF16("999999999999999"), metrics::OmniboxInputType::URL,
+ {u"999999999999999", metrics::OmniboxInputType::URL,
std::string("http://www.999999999999999.com/")},
- {ASCIIToUTF16("x@y"), metrics::OmniboxInputType::URL,
+ {u"x@y", metrics::OmniboxInputType::URL,
std::string("http://[email protected]/")},
- {ASCIIToUTF16("[email protected]"), metrics::OmniboxInputType::URL,
+ {u"[email protected]", metrics::OmniboxInputType::URL,
std::string("http://[email protected]/")},
- {ASCIIToUTF16("space user@y"), metrics::OmniboxInputType::UNKNOWN,
- std::string()},
- {ASCIIToUTF16("y/z z"), metrics::OmniboxInputType::URL,
+ {u"space user@y", metrics::OmniboxInputType::UNKNOWN, std::string()},
+ {u"y/z z", metrics::OmniboxInputType::URL,
std::string("http://www.y.com/z%20z")},
- {ASCIIToUTF16("abc.com"), metrics::OmniboxInputType::URL,
+ {u"abc.com", metrics::OmniboxInputType::URL,
std::string("http://abc.com/")},
- {ASCIIToUTF16("foo bar"), metrics::OmniboxInputType::QUERY,
- std::string()},
+ {u"foo bar", metrics::OmniboxInputType::QUERY, std::string()},
};
for (size_t i = 0; i < base::size(input_cases); ++i) {
@@ -292,34 +280,27 @@
const Component host;
} input_cases[] = {
{std::u16string(), kInvalidComponent, kInvalidComponent},
- {ASCIIToUTF16("?"), kInvalidComponent, kInvalidComponent},
- {ASCIIToUTF16("?http://foo.com/bar"), kInvalidComponent,
- kInvalidComponent},
- {ASCIIToUTF16("foo/bar baz"), kInvalidComponent, Component(0, 3)},
- {ASCIIToUTF16("http://foo/bar baz"), Component(0, 4), Component(7, 3)},
- {ASCIIToUTF16("link:foo.com"), Component(0, 4), kInvalidComponent},
- {ASCIIToUTF16("www.foo.com:81"), kInvalidComponent, Component(0, 11)},
+ {u"?", kInvalidComponent, kInvalidComponent},
+ {u"?http://foo.com/bar", kInvalidComponent, kInvalidComponent},
+ {u"foo/bar baz", kInvalidComponent, Component(0, 3)},
+ {u"http://foo/bar baz", Component(0, 4), Component(7, 3)},
+ {u"link:foo.com", Component(0, 4), kInvalidComponent},
+ {u"www.foo.com:81", kInvalidComponent, Component(0, 11)},
{u"\u6d4b\u8bd5", kInvalidComponent, Component(0, 2)},
- {ASCIIToUTF16("view-source:http://www.foo.com/"), Component(12, 4),
- Component(19, 11)},
- {ASCIIToUTF16("view-source:https://example.com/"), Component(12, 5),
+ {u"view-source:http://www.foo.com/", Component(12, 4), Component(19, 11)},
+ {u"view-source:https://example.com/", Component(12, 5),
Component(20, 11)},
- {ASCIIToUTF16("view-source:www.foo.com"), kInvalidComponent,
- Component(12, 11)},
- {ASCIIToUTF16("view-source:"), Component(0, 11), kInvalidComponent},
- {ASCIIToUTF16("view-source:garbage"), kInvalidComponent,
- Component(12, 7)},
- {ASCIIToUTF16("view-source:http://http://foo"), Component(12, 4),
- Component(19, 4)},
- {ASCIIToUTF16("view-source:view-source:http://example.com/"),
- Component(12, 11), kInvalidComponent},
- {ASCIIToUTF16("blob:http://www.foo.com/"), Component(5, 4),
- Component(12, 11)},
- {ASCIIToUTF16("blob:https://example.com/"), Component(5, 5),
- Component(13, 11)},
- {ASCIIToUTF16("blob:www.foo.com"), kInvalidComponent, Component(5, 11)},
- {ASCIIToUTF16("blob:"), Component(0, 4), kInvalidComponent},
- {ASCIIToUTF16("blob:garbage"), kInvalidComponent, Component(5, 7)},
+ {u"view-source:www.foo.com", kInvalidComponent, Component(12, 11)},
+ {u"view-source:", Component(0, 11), kInvalidComponent},
+ {u"view-source:garbage", kInvalidComponent, Component(12, 7)},
+ {u"view-source:http://http://foo", Component(12, 4), Component(19, 4)},
+ {u"view-source:view-source:http://example.com/", Component(12, 11),
+ kInvalidComponent},
+ {u"blob:http://www.foo.com/", Component(5, 4), Component(12, 11)},
+ {u"blob:https://example.com/", Component(5, 5), Component(13, 11)},
+ {u"blob:www.foo.com", kInvalidComponent, Component(5, 11)},
+ {u"blob:", Component(0, 4), kInvalidComponent},
+ {u"blob:garbage", kInvalidComponent, Component(5, 7)},
};
for (size_t i = 0; i < base::size(input_cases); ++i) {
@@ -343,25 +324,24 @@
const std::u16string normalized_input;
size_t normalized_cursor_position;
} input_cases[] = {
- {ASCIIToUTF16("foo bar"), std::u16string::npos, ASCIIToUTF16("foo bar"),
- std::u16string::npos},
+ {u"foo bar", std::u16string::npos, u"foo bar", std::u16string::npos},
// Regular case, no changes.
- {ASCIIToUTF16("foo bar"), 3, ASCIIToUTF16("foo bar"), 3},
+ {u"foo bar", 3, u"foo bar", 3},
// Extra leading space.
- {ASCIIToUTF16(" foo bar"), 3, ASCIIToUTF16("foo bar"), 1},
- {ASCIIToUTF16(" foo bar"), 3, ASCIIToUTF16("foo bar"), 0},
- {ASCIIToUTF16(" foo bar "), 2, ASCIIToUTF16("foo bar "), 0},
+ {u" foo bar", 3, u"foo bar", 1},
+ {u" foo bar", 3, u"foo bar", 0},
+ {u" foo bar ", 2, u"foo bar ", 0},
// A leading '?' used to be a magic character indicating the following
// input should be treated as a "forced query", but now if such a string
// reaches the AutocompleteInput parser the '?' should just be treated
// like a normal character.
- {ASCIIToUTF16("?foo bar"), 2, ASCIIToUTF16("?foo bar"), 2},
- {ASCIIToUTF16(" ?foo bar"), 4, ASCIIToUTF16("?foo bar"), 2},
- {ASCIIToUTF16("? foo bar"), 4, ASCIIToUTF16("? foo bar"), 4},
- {ASCIIToUTF16(" ? foo bar"), 6, ASCIIToUTF16("? foo bar"), 4},
+ {u"?foo bar", 2, u"?foo bar", 2},
+ {u" ?foo bar", 4, u"?foo bar", 2},
+ {u"? foo bar", 4, u"? foo bar", 4},
+ {u" ? foo bar", 6, u"? foo bar", 4},
};
for (size_t i = 0; i < base::size(input_cases); ++i) {
@@ -384,32 +364,27 @@
};
const TestData test_cases[] = {
- {ASCIIToUTF16("example.com"), GURL("https://example.com"), true},
+ {u"example.com", GURL("https://example.com"), true},
// If the hostname has a port specified, the URL shouldn't be upgraded
// to HTTPS because we can't assume that the HTTPS site is served over the
// default SSL port. Port 80 is dropped in URLs so it's still upgraded.
- {ASCIIToUTF16("example.com:80"), GURL("https://example.com"), true},
- {ASCIIToUTF16("example.com:8080"), GURL("http://example.com:8080"),
- false},
+ {u"example.com:80", GURL("https://example.com"), true},
+ {u"example.com:8080", GURL("http://example.com:8080"), false},
// Non-URL inputs shouldn't be upgraded.
- {ASCIIToUTF16("example query"), GURL(), false},
+ {u"example query", GURL(), false},
// IP addresses shouldn't be upgraded.
- {ASCIIToUTF16("127.0.0.1"), GURL("http://127.0.0.1"), false},
- {ASCIIToUTF16("127.0.0.1:80"), GURL("http://127.0.0.1:80"), false},
- {ASCIIToUTF16("127.0.0.1:8080"), GURL("http://127.0.0.1:8080"), false},
+ {u"127.0.0.1", GURL("http://127.0.0.1"), false},
+ {u"127.0.0.1:80", GURL("http://127.0.0.1:80"), false},
+ {u"127.0.0.1:8080", GURL("http://127.0.0.1:8080"), false},
// Non-unique hostnames shouldn't be upgraded.
- {ASCIIToUTF16("site.test"), GURL("http://site.test"), false},
+ {u"site.test", GURL("http://site.test"), false},
// Fully typed URLs shouldn't be upgraded.
- {ASCIIToUTF16("http://example.com"), GURL("http://example.com"), false},
- {ASCIIToUTF16("HTTP://EXAMPLE.COM"), GURL("http://example.com"), false},
- {ASCIIToUTF16("http://example.com:80"), GURL("http://example.com"),
- false},
- {ASCIIToUTF16("HTTP://EXAMPLE.COM:80"), GURL("http://example.com"),
- false},
- {ASCIIToUTF16("http://example.com:8080"), GURL("http://example.com:8080"),
- false},
- {ASCIIToUTF16("HTTP://EXAMPLE.COM:8080"), GURL("http://example.com:8080"),
- false},
+ {u"http://example.com", GURL("http://example.com"), false},
+ {u"HTTP://EXAMPLE.COM", GURL("http://example.com"), false},
+ {u"http://example.com:80", GURL("http://example.com"), false},
+ {u"HTTP://EXAMPLE.COM:80", GURL("http://example.com"), false},
+ {u"http://example.com:8080", GURL("http://example.com:8080"), false},
+ {u"HTTP://EXAMPLE.COM:8080", GURL("http://example.com:8080"), false},
};
for (const TestData& test_case : test_cases) {
AutocompleteInput input(test_case.input, std::u16string::npos,
@@ -432,27 +407,22 @@
// non-zero value for https_port_for_testing.
int https_port_for_testing = 12345;
const TestData test_cases_non_default_port[] = {
- {ASCIIToUTF16("example.com:8080"), GURL("https://example.com:12345"),
- true},
+ {u"example.com:8080", GURL("https://example.com:12345"), true},
// Non-URL inputs shouldn't be upgraded.
- {ASCIIToUTF16("example query"), GURL(), false},
+ {u"example query", GURL(), false},
// IP addresses shouldn't be upgraded.
- {ASCIIToUTF16("127.0.0.1"), GURL("http://127.0.0.1"), false},
- {ASCIIToUTF16("127.0.0.1:80"), GURL("http://127.0.0.1:80"), false},
- {ASCIIToUTF16("127.0.0.1:8080"), GURL("http://127.0.0.1:8080"), false},
+ {u"127.0.0.1", GURL("http://127.0.0.1"), false},
+ {u"127.0.0.1:80", GURL("http://127.0.0.1:80"), false},
+ {u"127.0.0.1:8080", GURL("http://127.0.0.1:8080"), false},
// Non-unique hostnames shouldn't be upgraded.
- {ASCIIToUTF16("site.test"), GURL("http://site.test"), false},
+ {u"site.test", GURL("http://site.test"), false},
// // Fully typed URLs shouldn't be upgraded.
- {ASCIIToUTF16("http://example.com"), GURL("http://example.com"), false},
- {ASCIIToUTF16("HTTP://EXAMPLE.COM"), GURL("http://example.com"), false},
- {ASCIIToUTF16("http://example.com:80"), GURL("http://example.com"),
- false},
- {ASCIIToUTF16("HTTP://EXAMPLE.COM:80"), GURL("http://example.com"),
- false},
- {ASCIIToUTF16("http://example.com:8080"), GURL("http://example.com:8080"),
- false},
- {ASCIIToUTF16("HTTP://EXAMPLE.COM:8080"), GURL("http://example.com:8080"),
- false}};
+ {u"http://example.com", GURL("http://example.com"), false},
+ {u"HTTP://EXAMPLE.COM", GURL("http://example.com"), false},
+ {u"http://example.com:80", GURL("http://example.com"), false},
+ {u"HTTP://EXAMPLE.COM:80", GURL("http://example.com"), false},
+ {u"http://example.com:8080", GURL("http://example.com:8080"), false},
+ {u"HTTP://EXAMPLE.COM:8080", GURL("http://example.com:8080"), false}};
for (const TestData& test_case : test_cases_non_default_port) {
AutocompleteInput input(
test_case.input, std::u16string::npos,
diff --git a/components/omnibox/browser/autocomplete_match.cc b/components/omnibox/browser/autocomplete_match.cc
index 17f92663..75624eb 100644
--- a/components/omnibox/browser/autocomplete_match.cc
+++ b/components/omnibox/browser/autocomplete_match.cc
@@ -391,7 +391,7 @@
"what you typed.");
case Type::SEARCH_WHAT_YOU_TYPED:
- return base::ASCIIToUTF16("This search query is exactly what you typed.");
+ return u"This search query is exactly what you typed.";
case Type::SEARCH_HISTORY:
// TODO(tommycli): We may need to distinguish between matches sourced
@@ -433,13 +433,13 @@
case Type::CLIPBOARD_URL:
case Type::CLIPBOARD_TEXT:
case Type::CLIPBOARD_IMAGE:
- return base::ASCIIToUTF16("This match is from the system clipboard.");
+ return u"This match is from the system clipboard.";
case Type::VOICE_SUGGEST:
- return base::ASCIIToUTF16("This match is from voice.");
+ return u"This match is from voice.";
case Type::DOCUMENT_SUGGESTION:
- return base::ASCIIToUTF16("This match is from your documents.");
+ return u"This match is from your documents.";
case Type::PEDAL:
return base::ASCIIToUTF16(
diff --git a/components/omnibox/browser/autocomplete_match_type.cc b/components/omnibox/browser/autocomplete_match_type.cc
index f537fac..e5611bb 100644
--- a/components/omnibox/browser/autocomplete_match_type.cc
+++ b/components/omnibox/browser/autocomplete_match_type.cc
@@ -147,9 +147,8 @@
// TODO(skare) http://crbug.com/951109: format as string in grd so this isn't
// special-cased.
if (match.type == AutocompleteMatchType::DOCUMENT_SUGGESTION) {
- std::u16string doc_string = match.contents + base::ASCIIToUTF16(", ") +
- match.description + base::ASCIIToUTF16(", ") +
- match_text;
+ std::u16string doc_string =
+ match.contents + u", " + match.description + u", " + match_text;
return doc_string;
}
diff --git a/components/omnibox/browser/autocomplete_provider.cc b/components/omnibox/browser/autocomplete_provider.cc
index 29f90ce7..b95049c 100644
--- a/components/omnibox/browser/autocomplete_provider.cc
+++ b/components/omnibox/browser/autocomplete_provider.cc
@@ -227,8 +227,7 @@
// trailing slashes (if the scheme is the only thing in the input). It's not
// clear that the result of fixup really matters in this case, but there's no
// harm in making sure.
- const size_t last_input_nonslash =
- input_text.find_last_not_of(base::ASCIIToUTF16("/\\"));
+ const size_t last_input_nonslash = input_text.find_last_not_of(u"/\\");
size_t num_input_slashes =
(last_input_nonslash == std::u16string::npos)
? input_text.length()
@@ -237,8 +236,7 @@
if (output.length() > input_text.length() &&
base::StartsWith(output, input_text, base::CompareCase::SENSITIVE))
num_input_slashes = 0;
- const size_t last_output_nonslash =
- output.find_last_not_of(base::ASCIIToUTF16("/\\"));
+ const size_t last_output_nonslash = output.find_last_not_of(u"/\\");
const size_t num_output_slashes =
(last_output_nonslash == std::u16string::npos)
? output.length()
diff --git a/components/omnibox/browser/autocomplete_provider_unittest.cc b/components/omnibox/browser/autocomplete_provider_unittest.cc
index 58f9553b..509a103 100644
--- a/components/omnibox/browser/autocomplete_provider_unittest.cc
+++ b/components/omnibox/browser/autocomplete_provider_unittest.cc
@@ -147,15 +147,13 @@
// Generate 4 results synchronously, the rest later.
AddResults(0, 1);
- AddResultsWithSearchTermsArgs(
- 1, 1, AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
- TemplateURLRef::SearchTermsArgs(base::ASCIIToUTF16("echo")));
- AddResultsWithSearchTermsArgs(
- 2, 1, AutocompleteMatchType::NAVSUGGEST,
- TemplateURLRef::SearchTermsArgs(base::ASCIIToUTF16("nav")));
- AddResultsWithSearchTermsArgs(
- 3, 1, AutocompleteMatchType::SEARCH_SUGGEST,
- TemplateURLRef::SearchTermsArgs(base::ASCIIToUTF16("query")));
+ AddResultsWithSearchTermsArgs(1, 1,
+ AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
+ TemplateURLRef::SearchTermsArgs(u"echo"));
+ AddResultsWithSearchTermsArgs(2, 1, AutocompleteMatchType::NAVSUGGEST,
+ TemplateURLRef::SearchTermsArgs(u"nav"));
+ AddResultsWithSearchTermsArgs(3, 1, AutocompleteMatchType::SEARCH_SUGGEST,
+ TemplateURLRef::SearchTermsArgs(u"query"));
if (input.want_asynchronous_matches()) {
done_ = false;
@@ -405,7 +403,7 @@
// Construct two new providers, with either the same or different prefixes.
TestProvider* provider1 =
- new TestProvider(kResultsPerProvider, base::ASCIIToUTF16("http://a"),
+ new TestProvider(kResultsPerProvider, u"http://a",
base::ASCIIToUTF16(kTestTemplateURLKeyword), client_);
providers.push_back(provider1);
@@ -437,8 +435,8 @@
void AutocompleteProviderTest::ResetControllerWithKeywordAndSearchProviders() {
// Reset the default TemplateURL.
TemplateURLData data;
- data.SetShortName(base::ASCIIToUTF16("default"));
- data.SetKeyword(base::ASCIIToUTF16("default"));
+ data.SetShortName(u"default");
+ data.SetKeyword(u"default");
data.SetURL("http://defaultturl/{searchTerms}");
TemplateURLService* turl_model = client_->GetTemplateURLService();
TemplateURL* default_turl =
@@ -449,8 +447,8 @@
// Create another TemplateURL for KeywordProvider.
TemplateURLData data2;
- data2.SetShortName(base::ASCIIToUTF16("k"));
- data2.SetKeyword(base::ASCIIToUTF16("k"));
+ data2.SetShortName(u"k");
+ data2.SetKeyword(u"k");
data2.SetURL("http://keyword/{searchTerms}");
TemplateURL* keyword_turl =
turl_model->Add(std::make_unique<TemplateURL>(data2));
@@ -466,8 +464,8 @@
// Create a TemplateURL for KeywordProvider.
TemplateURLData data;
- data.SetShortName(base::ASCIIToUTF16("foo.com"));
- data.SetKeyword(base::ASCIIToUTF16("foo.com"));
+ data.SetShortName(u"foo.com");
+ data.SetKeyword(u"foo.com");
data.SetURL("http://foo.com/{searchTerms}");
TemplateURL* keyword_turl =
turl_model->Add(std::make_unique<TemplateURL>(data));
@@ -475,15 +473,15 @@
// Make a TemplateURL for KeywordProvider that a shorter version of the
// first.
- data.SetShortName(base::ASCIIToUTF16("f"));
- data.SetKeyword(base::ASCIIToUTF16("f"));
+ data.SetShortName(u"f");
+ data.SetKeyword(u"f");
data.SetURL("http://f.com/{searchTerms}");
keyword_turl = turl_model->Add(std::make_unique<TemplateURL>(data));
ASSERT_NE(0, keyword_turl->id());
// Create another TemplateURL for KeywordProvider.
- data.SetShortName(base::ASCIIToUTF16("bar.com"));
- data.SetKeyword(base::ASCIIToUTF16("bar.com"));
+ data.SetShortName(u"bar.com");
+ data.SetKeyword(u"bar.com");
data.SetURL("http://bar.com/{searchTerms}");
keyword_turl = turl_model->Add(std::make_unique<TemplateURL>(data));
ASSERT_NE(0, keyword_turl->id());
@@ -709,40 +707,33 @@
{
KeywordTestData duplicate_url[] = {
- {base::ASCIIToUTF16("fo"), std::u16string(), std::u16string()},
- {base::ASCIIToUTF16("foo.com"), std::u16string(),
- base::ASCIIToUTF16("foo.com")},
- {base::ASCIIToUTF16("foo.com"), std::u16string(), std::u16string()}};
+ {u"fo", std::u16string(), std::u16string()},
+ {u"foo.com", std::u16string(), u"foo.com"},
+ {u"foo.com", std::u16string(), std::u16string()}};
SCOPED_TRACE("Duplicate url");
- RunKeywordTest(base::ASCIIToUTF16("fo"), duplicate_url,
- base::size(duplicate_url));
+ RunKeywordTest(u"fo", duplicate_url, base::size(duplicate_url));
}
{
KeywordTestData keyword_match[] = {
- {base::ASCIIToUTF16("foo.com"), base::ASCIIToUTF16("foo.com"),
- std::u16string()},
- {base::ASCIIToUTF16("foo.com"), std::u16string(), std::u16string()}};
+ {u"foo.com", u"foo.com", std::u16string()},
+ {u"foo.com", std::u16string(), std::u16string()}};
SCOPED_TRACE("Duplicate url with keyword match");
- RunKeywordTest(base::ASCIIToUTF16("fo"), keyword_match,
- base::size(keyword_match));
+ RunKeywordTest(u"fo", keyword_match, base::size(keyword_match));
}
{
KeywordTestData multiple_keyword[] = {
- {base::ASCIIToUTF16("fo"), std::u16string(), std::u16string()},
- {base::ASCIIToUTF16("foo.com"), std::u16string(),
- base::ASCIIToUTF16("foo.com")},
- {base::ASCIIToUTF16("foo.com"), std::u16string(), std::u16string()},
- {base::ASCIIToUTF16("bar.com"), std::u16string(),
- base::ASCIIToUTF16("bar.com")},
+ {u"fo", std::u16string(), std::u16string()},
+ {u"foo.com", std::u16string(), u"foo.com"},
+ {u"foo.com", std::u16string(), std::u16string()},
+ {u"bar.com", std::u16string(), u"bar.com"},
};
SCOPED_TRACE("Duplicate url with multiple keywords");
- RunKeywordTest(base::ASCIIToUTF16("fo"), multiple_keyword,
- base::size(multiple_keyword));
+ RunKeywordTest(u"fo", multiple_keyword, base::size(multiple_keyword));
}
}
@@ -752,13 +743,11 @@
ResetControllerWithKeywordProvider();
{
- KeywordTestData keyword_match[] = {{base::ASCIIToUTF16("foo.com"),
- std::u16string(),
- base::ASCIIToUTF16("foo.com")}};
+ KeywordTestData keyword_match[] = {
+ {u"foo.com", std::u16string(), u"foo.com"}};
SCOPED_TRACE("keyword match as usual");
- RunKeywordTest(base::ASCIIToUTF16("fo"), keyword_match,
- base::size(keyword_match));
+ RunKeywordTest(u"fo", keyword_match, base::size(keyword_match));
}
// The same result set with an input of "f" (versus "fo") should get
@@ -766,13 +755,10 @@
// a keyword and that should trump the keyword normally associated with
// this match.
{
- KeywordTestData keyword_match[] = {{base::ASCIIToUTF16("foo.com"),
- std::u16string(),
- base::ASCIIToUTF16("f")}};
+ KeywordTestData keyword_match[] = {{u"foo.com", std::u16string(), u"f"}};
SCOPED_TRACE("keyword exact match");
- RunKeywordTest(base::ASCIIToUTF16("f"), keyword_match,
- base::size(keyword_match));
+ RunKeywordTest(u"f", keyword_match, base::size(keyword_match));
}
}
@@ -1054,24 +1040,24 @@
using base::ASCIIToUTF16;
ACMatchClassifications matches =
AutocompleteMatch::ClassificationsFromString("0,0");
- ClassifyTest classify_test(ASCIIToUTF16("A man, a plan, a canal Panama"),
+ ClassifyTest classify_test(u"A man, a plan, a canal Panama",
/*text_is_query=*/false, matches);
ACMatchClassifications spans;
- spans = classify_test.RunTest(ASCIIToUTF16("man"));
+ spans = classify_test.RunTest(u"man");
// A man, a plan, a canal Panama
// ACMatch spans should be: '--MMM------------------------'
EXPECT_EQ("0,0,2,2,5,0", AutocompleteMatch::ClassificationsToString(spans));
- spans = classify_test.RunTest(ASCIIToUTF16("man p"));
+ spans = classify_test.RunTest(u"man p");
// A man, a plan, a canal Panama
// ACMatch spans should be: '--MMM----M-------------M-----'
EXPECT_EQ("0,0,2,2,5,0,9,2,10,0,23,2,24,0",
AutocompleteMatch::ClassificationsToString(spans));
// Comparisons should be case insensitive.
- spans = classify_test.RunTest(ASCIIToUTF16("mAn pLAn panAMa"));
+ spans = classify_test.RunTest(u"mAn pLAn panAMa");
// A man, a plan, a canal Panama
// ACMatch spans should be: '--MMM----MMMM----------MMMMMM'
EXPECT_EQ("0,0,2,2,5,0,9,2,13,0,23,2",
@@ -1079,14 +1065,14 @@
// When the user input is a prefix of the suggest text, subsequent occurrences
// of the user words should be matched.
- spans = classify_test.RunTest(ASCIIToUTF16("a man,"));
+ spans = classify_test.RunTest(u"a man,");
// A man, a plan, a canal Panama
// ACMatch spans should be: 'MMMMMM-----------------------'
EXPECT_EQ("0,2,6,0", AutocompleteMatch::ClassificationsToString(spans));
// Matches must begin at word-starts in the suggest text. E.g. 'a' in 'plan'
// should not match.
- spans = classify_test.RunTest(ASCIIToUTF16("a man, p"));
+ spans = classify_test.RunTest(u"a man, p");
// A man, a plan, a canal Panama
// ACMatch spans should be: 'M-MMM--M-M-----M-------M-----'
EXPECT_EQ("0,2,1,0,2,2,5,0,7,2,8,0,9,2,10,0,15,2,16,0,23,2,24,0",
@@ -1097,41 +1083,41 @@
"Scores, Rumors, Fantasy Games, and more"),
/*text_is_query=*/false, matches);
- spans = classify_test2.RunTest(ASCIIToUTF16("ne"));
+ spans = classify_test2.RunTest(u"ne");
// Yahoo! Sports - Sports News, Scores, Rumors, Fantasy Games, and more
// -----------------------MM-------------------------------------------
EXPECT_EQ("0,0,23,2,25,0", AutocompleteMatch::ClassificationsToString(spans));
- spans = classify_test2.RunTest(ASCIIToUTF16("neWs R"));
+ spans = classify_test2.RunTest(u"neWs R");
// Yahoo! Sports - Sports News, Scores, Rumors, Fantasy Games, and more
// -----------------------MMMM----------M------------------------------
EXPECT_EQ("0,0,23,2,27,0,37,2,38,0",
AutocompleteMatch::ClassificationsToString(spans));
matches = AutocompleteMatch::ClassificationsFromString("0,1");
- ClassifyTest classify_test3(ASCIIToUTF16("livescore.goal.com"),
+ ClassifyTest classify_test3(u"livescore.goal.com",
/*text_is_query=*/false, matches);
// Matches should be merged with existing classifications.
// Matches can begin after symbols in the suggest text.
- spans = classify_test3.RunTest(ASCIIToUTF16("go"));
+ spans = classify_test3.RunTest(u"go");
// livescore.goal.com
// ----------MM------
// ACMatch spans should match first two letters of the "goal".
EXPECT_EQ("0,1,10,3,12,1", AutocompleteMatch::ClassificationsToString(spans));
matches = AutocompleteMatch::ClassificationsFromString("0,0,13,1");
- ClassifyTest classify_test4(ASCIIToUTF16("Email login: mail.somecorp.com"),
+ ClassifyTest classify_test4(u"Email login: mail.somecorp.com",
/*text_is_query=*/false, matches);
// Matches must begin at word-starts in the suggest text.
- spans = classify_test4.RunTest(ASCIIToUTF16("ail"));
+ spans = classify_test4.RunTest(u"ail");
// Email login: mail.somecorp.com
// 000000000000011111111111111111
EXPECT_EQ("0,0,13,1", AutocompleteMatch::ClassificationsToString(spans));
// The longest matches should take precedence (e.g. 'log' instead of 'lo').
- spans = classify_test4.RunTest(ASCIIToUTF16("lo log mail em"));
+ spans = classify_test4.RunTest(u"lo log mail em");
// Email login: mail.somecorp.com
// 220000222000033331111111111111
EXPECT_EQ("0,2,2,0,6,2,9,0,13,3,17,1",
@@ -1142,12 +1128,12 @@
// Extra parens in the next line hack around C++03's "most vexing parse".
class ClassifyTest classify_test5((std::u16string()), /*text_is_query=*/false,
ACMatchClassifications());
- spans = classify_test5.RunTest(ASCIIToUTF16("man"));
+ spans = classify_test5.RunTest(u"man");
ASSERT_EQ(0U, spans.size());
// Matches which end at beginning of classification merge properly.
matches = AutocompleteMatch::ClassificationsFromString("0,4,9,0");
- ClassifyTest classify_test6(ASCIIToUTF16("html password example"),
+ ClassifyTest classify_test6(u"html password example",
/*text_is_query=*/false, matches);
// Extra space in the next string avoids having the string be a prefix of the
@@ -1156,55 +1142,56 @@
// pass" as a match) and one which uses four (which marks the individual words
// as matches but not the space between them). This way only the latter is
// valid.
- spans = classify_test6.RunTest(ASCIIToUTF16("html pass"));
+ spans = classify_test6.RunTest(u"html pass");
EXPECT_EQ("0,6,4,4,5,6,9,0",
AutocompleteMatch::ClassificationsToString(spans));
// Multiple matches with both beginning and end at beginning of
// classifications merge properly.
matches = AutocompleteMatch::ClassificationsFromString("0,1,11,0");
- ClassifyTest classify_test7(ASCIIToUTF16("http://a.co is great"),
+ ClassifyTest classify_test7(u"http://a.co is great",
/*text_is_query=*/false, matches);
- spans = classify_test7.RunTest(ASCIIToUTF16("ht co"));
+ spans = classify_test7.RunTest(u"ht co");
EXPECT_EQ("0,3,2,1,9,3,11,0",
AutocompleteMatch::ClassificationsToString(spans));
// Search queries should be bold non-matches and unbold matches.
matches = AutocompleteMatch::ClassificationsFromString("0,0");
- ClassifyTest classify_test8(ASCIIToUTF16("panama canal"),
+ ClassifyTest classify_test8(u"panama canal",
/*text_is_query=*/true, matches);
- spans = classify_test8.RunTest(ASCIIToUTF16("pan"));
+ spans = classify_test8.RunTest(u"pan");
// panama canal
// ACMatch spans should be: "---MMMMMMMMM";
EXPECT_EQ("0,0,3,2", AutocompleteMatch::ClassificationsToString(spans));
- spans = classify_test8.RunTest(ASCIIToUTF16("canal"));
+ spans = classify_test8.RunTest(u"canal");
// panama canal
// ACMatch spans should be: "MMMMMMM-----";
EXPECT_EQ("0,2,7,0", AutocompleteMatch::ClassificationsToString(spans));
// Search autocomplete suggestion.
- ClassifyTest classify_test9(ASCIIToUTF16("comcast webmail login"),
+ ClassifyTest classify_test9(u"comcast webmail login",
/*text_is_query=*/true, ACMatchClassifications());
// Matches first and first part of middle word and the last word.
- spans = classify_test9.RunTest(ASCIIToUTF16("comcast web login"));
+ spans = classify_test9.RunTest(u"comcast web login");
// comcast webmail login
// ACMatch spans should be: "-------M---MMMMM-----";
EXPECT_EQ("0,0,7,2,8,0,11,2,16,0",
AutocompleteMatch::ClassificationsToString(spans));
// Matches partial word in the middle of suggestion.
- spans = classify_test9.RunTest(ASCIIToUTF16("web"));
+ spans = classify_test9.RunTest(u"web");
// comcast webmail login
// ACMatch spans should be: "MMMMMMMM---MMMMMMMMMM";
EXPECT_EQ("0,2,8,0,11,2", AutocompleteMatch::ClassificationsToString(spans));
- ClassifyTest classify_test10(ASCIIToUTF16("comcast.net web mail login"),
- /*text_is_query=*/true, ACMatchClassifications());
+ ClassifyTest classify_test10(u"comcast.net web mail login",
+ /*text_is_query=*/true,
+ ACMatchClassifications());
- spans = classify_test10.RunTest(ASCIIToUTF16("comcast web login"));
+ spans = classify_test10.RunTest(u"comcast web login");
// comcast.net web mail login
// ACMatch spans should be: "-------MMMMM---MMMMMM-----";
EXPECT_EQ("0,0,7,2,12,0,15,2,21,0",
@@ -1212,10 +1199,11 @@
// Same with |classify_test10| except using characters in
// base::kWhitespaceASCIIAs16 instead of white space.
- ClassifyTest classify_test11(ASCIIToUTF16("comcast.net\x0aweb\x0dmail login"),
- /*text_is_query=*/true, ACMatchClassifications());
+ ClassifyTest classify_test11(u"comcast.net\x0aweb\x0dmail login",
+ /*text_is_query=*/true,
+ ACMatchClassifications());
- spans = classify_test11.RunTest(ASCIIToUTF16("comcast web login"));
+ spans = classify_test11.RunTest(u"comcast web login");
// comcast.net web mail login
// ACMatch spans should be: "-------MMMMM---MMMMMM-----";
EXPECT_EQ("0,0,7,2,12,0,15,2,21,0",
diff --git a/components/omnibox/browser/autocomplete_result.cc b/components/omnibox/browser/autocomplete_result.cc
index 6f8b9864..51d29fc 100644
--- a/components/omnibox/browser/autocomplete_result.cc
+++ b/components/omnibox/browser/autocomplete_result.cc
@@ -323,12 +323,11 @@
auto* default_match = this->default_match();
if (default_match && default_match->destination_url.is_valid()) {
const std::u16string debug_info =
- base::ASCIIToUTF16("fill_into_edit=") + default_match->fill_into_edit +
- base::ASCIIToUTF16(", provider=") +
+ u"fill_into_edit=" + default_match->fill_into_edit + u", provider=" +
((default_match->provider != nullptr)
? base::ASCIIToUTF16(default_match->provider->GetName())
: std::u16string()) +
- base::ASCIIToUTF16(", input=") + input.text();
+ u", input=" + input.text();
if (AutocompleteMatch::IsSearchType(default_match->type)) {
// We shouldn't get query matches for URL inputs.
diff --git a/components/omnibox/browser/autocomplete_result_unittest.cc b/components/omnibox/browser/autocomplete_result_unittest.cc
index f6d36df4..b960eee 100644
--- a/components/omnibox/browser/autocomplete_result_unittest.cc
+++ b/components/omnibox/browser/autocomplete_result_unittest.cc
@@ -261,8 +261,7 @@
size_t current_size,
const TestData* expected,
size_t expected_size) {
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
RunTransferOldMatchesTest(last, last_size, current, current_size, expected,
expected_size, input);
@@ -328,8 +327,7 @@
AutocompleteMatch match;
match.relevance = 1;
match.allowed_to_be_default_match = true;
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
matches.push_back(match);
r1.AppendMatches(input, matches);
@@ -346,8 +344,7 @@
}
TEST_F(AutocompleteResultTest, AlternateNavUrl) {
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
FakeAutocompleteProviderClient client;
@@ -377,8 +374,7 @@
}
TEST_F(AutocompleteResultTest, AlternateNavUrl_IntranetRedirectPolicy) {
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
FakeAutocompleteProviderClient client;
@@ -472,8 +468,7 @@
// match is allowed to be default.
TEST_F(AutocompleteResultTest,
TransferOldMatchesAllowedToBeDefaultWithPreventInlineAutocompletion) {
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
input.set_prevent_inline_autocomplete(true);
@@ -692,8 +687,7 @@
matches[3].destination_url = GURL();
matches[4].destination_url = GURL();
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -733,8 +727,7 @@
matches[3].type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL;
matches[4].type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL;
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -768,8 +761,7 @@
matches[1].type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL;
matches[2].type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL;
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -801,8 +793,7 @@
for (size_t i = 1; i < 5; ++i)
matches[i].type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL;
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -836,8 +827,7 @@
for (size_t i = 2; i < base::size(data); ++i)
matches[i].type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL;
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -870,8 +860,7 @@
for (size_t i = 1; i < base::size(data); ++i)
matches[i].type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL;
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -908,8 +897,7 @@
for (size_t i = 1; i < 5; ++i)
matches[i].type = AutocompleteMatchType::SEARCH_SUGGEST_TAIL;
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -952,8 +940,8 @@
TEST_F(AutocompleteResultTest, SortAndCullDuplicateSearchURLs) {
// Register a template URL that corresponds to 'foo' search engine.
TemplateURLData url_data;
- url_data.SetShortName(base::ASCIIToUTF16("unittest"));
- url_data.SetKeyword(base::ASCIIToUTF16("foo"));
+ url_data.SetShortName(u"unittest");
+ url_data.SetKeyword(u"foo");
url_data.SetURL("http://www.foo.com/s?q={searchTerms}");
template_url_service_->Add(std::make_unique<TemplateURL>(url_data));
@@ -973,8 +961,7 @@
matches[3].destination_url = GURL("http://www.foo.com/s?q=foo&aqs=0");
matches[4].destination_url = GURL("http://www.foo.com/");
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -996,8 +983,8 @@
TEST_F(AutocompleteResultTest, SortAndCullWithMatchDups) {
// Register a template URL that corresponds to 'foo' search engine.
TemplateURLData url_data;
- url_data.SetShortName(base::ASCIIToUTF16("unittest"));
- url_data.SetKeyword(base::ASCIIToUTF16("foo"));
+ url_data.SetShortName(u"unittest");
+ url_data.SetKeyword(u"foo");
url_data.SetURL("http://www.foo.com/s?q={searchTerms}");
template_url_service_->Add(std::make_unique<TemplateURL>(url_data));
@@ -1024,8 +1011,7 @@
matches[4].destination_url = GURL("http://www.foo.com/");
matches[5].destination_url = GURL("http://www.foo.com/s?q=foo2&oq=f");
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -1077,7 +1063,7 @@
base::FieldTrialList::CreateFieldTrial(
OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A");
- AutocompleteInput input(base::ASCIIToUTF16("a"), OmniboxEventProto::HOME_PAGE,
+ AutocompleteInput input(u"a", OmniboxEventProto::HOME_PAGE,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -1108,8 +1094,7 @@
{0, 1, 400, true},
};
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
ACMatches last_matches;
@@ -1152,8 +1137,7 @@
{11, 1, 200, true},
};
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
ACMatches last_matches;
@@ -1216,8 +1200,7 @@
matches[0].provider->type_ = AutocompleteProvider::TYPE_SEARCH;
matches[1].provider->type_ = AutocompleteProvider::TYPE_ON_DEVICE_HEAD;
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
// Test setting on device suggestion relevances to 0.
@@ -1380,8 +1363,7 @@
// PopulateAutocompleteMatches()).
ACMatches matches;
PopulateAutocompleteMatches(data, base::size(data), &matches);
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::HOME_PAGE,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::HOME_PAGE,
test_scheme_classifier);
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -1395,8 +1377,7 @@
PopulateAutocompleteMatches(data, base::size(data), &matches);
matches[0].allowed_to_be_default_match = false;
matches[1].allowed_to_be_default_match = false;
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::HOME_PAGE,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::HOME_PAGE,
test_scheme_classifier);
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -1423,8 +1404,7 @@
// appropriately.
ACMatches matches;
PopulateAutocompleteMatches(data, base::size(data), &matches);
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::HOME_PAGE,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::HOME_PAGE,
test_scheme_classifier);
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -1456,8 +1436,7 @@
// even for a default match that isn't the best.
ACMatches matches;
PopulateAutocompleteMatches(data, base::size(data), &matches);
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::HOME_PAGE,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::HOME_PAGE,
test_scheme_classifier);
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -1529,8 +1508,7 @@
ACMatches matches;
PopulateEntityTestCases(test_cases, &matches);
- AutocompleteInput input(base::ASCIIToUTF16("f"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"f", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -1550,8 +1528,7 @@
result.match_at(1)->type);
EXPECT_EQ(1100, result.match_at(1)->relevance);
EXPECT_TRUE(result.match_at(1)->allowed_to_be_default_match);
- EXPECT_EQ(base::ASCIIToUTF16("oo"),
- result.match_at(1)->inline_autocompletion);
+ EXPECT_EQ(u"oo", result.match_at(1)->inline_autocompletion);
}
TEST_F(AutocompleteResultTest, SortAndCullPreferEntitiesFillIntoEditMustMatch) {
@@ -1574,8 +1551,7 @@
ACMatches matches;
PopulateEntityTestCases(test_cases, &matches);
- AutocompleteInput input(base::ASCIIToUTF16("f"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"f", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -1590,8 +1566,7 @@
result.match_at(0)->type);
EXPECT_EQ(1100, result.match_at(0)->relevance);
EXPECT_TRUE(result.match_at(0)->allowed_to_be_default_match);
- EXPECT_EQ(base::ASCIIToUTF16("oo"),
- result.match_at(0)->inline_autocompletion);
+ EXPECT_EQ(u"oo", result.match_at(0)->inline_autocompletion);
}
TEST_F(AutocompleteResultTest,
@@ -1615,8 +1590,7 @@
ACMatches matches;
PopulateEntityTestCases(test_cases, &matches);
- AutocompleteInput input(base::ASCIIToUTF16("f"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"f", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -1634,15 +1608,14 @@
result.match_at(1)->type);
EXPECT_EQ(1001, result.match_at(1)->relevance);
EXPECT_TRUE(result.match_at(1)->allowed_to_be_default_match);
- EXPECT_EQ(base::ASCIIToUTF16("oo"),
- result.match_at(1)->inline_autocompletion);
+ EXPECT_EQ(u"oo", result.match_at(1)->inline_autocompletion);
}
TEST_F(AutocompleteResultTest, SortAndCullPromoteDuplicateSearchURLs) {
// Register a template URL that corresponds to 'foo' search engine.
TemplateURLData url_data;
- url_data.SetShortName(base::ASCIIToUTF16("unittest"));
- url_data.SetKeyword(base::ASCIIToUTF16("foo"));
+ url_data.SetShortName(u"unittest");
+ url_data.SetKeyword(u"foo");
url_data.SetURL("http://www.foo.com/s?q={searchTerms}");
template_url_service_->Add(std::make_unique<TemplateURL>(url_data));
@@ -1663,8 +1636,7 @@
matches[3].destination_url = GURL("http://www.foo.com/s?q=foo&aqs=0");
matches[4].destination_url = GURL("http://www.foo.com/");
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -1702,8 +1674,7 @@
ACMatches matches;
PopulateAutocompleteMatches(data, base::size(data), &matches);
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -1744,8 +1715,7 @@
ACMatches matches;
PopulateAutocompleteMatches(data, base::size(data), &matches);
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
@@ -1800,8 +1770,7 @@
};
PopulateAutocompleteMatchesFromTestData(data, base::size(data), &matches);
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -1838,8 +1807,7 @@
};
PopulateAutocompleteMatchesFromTestData(data, base::size(data), &matches);
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -1962,8 +1930,7 @@
EXPECT_NE(nullptr, client.GetPedalProvider());
AutocompleteResult result;
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
// Populate result with test matches.
@@ -2041,8 +2008,7 @@
->SetType(AutocompleteProvider::Type::TYPE_DOCUMENT);
matches[5].type = AutocompleteMatchType::HISTORY_URL;
- AutocompleteInput input(base::ASCIIToUTF16("a"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"a", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
@@ -2147,8 +2113,7 @@
static_cast<FakeAutocompleteProvider*>(matches[4].provider)
->SetType(AutocompleteProvider::Type::TYPE_CLIPBOARD);
- AutocompleteInput input(base::ASCIIToUTF16(""),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
AutocompleteResult result;
result.AppendMatches(input, matches);
diff --git a/components/omnibox/browser/base_search_provider_unittest.cc b/components/omnibox/browser/base_search_provider_unittest.cc
index c7bc351..887ca30 100644
--- a/components/omnibox/browser/base_search_provider_unittest.cc
+++ b/components/omnibox/browser/base_search_provider_unittest.cc
@@ -100,7 +100,7 @@
auto template_url = std::make_unique<TemplateURL>(data);
TestBaseSearchProvider::MatchMap map;
- std::u16string query = base::ASCIIToUTF16("weather los angeles");
+ std::u16string query = u"weather los angeles";
SuggestionAnswer answer;
answer.set_type(2334);
@@ -177,21 +177,20 @@
auto template_url = std::make_unique<TemplateURL>(data);
AutocompleteInput autocomplete_input(
- base::ASCIIToUTF16("weather"), 7, metrics::OmniboxEventProto::BLANK,
- TestSchemeClassifier());
+ u"weather", 7, metrics::OmniboxEventProto::BLANK, TestSchemeClassifier());
EXPECT_CALL(*provider_, GetInput(_))
.WillRepeatedly(Return(autocomplete_input));
EXPECT_CALL(*provider_, GetTemplateURL(_))
.WillRepeatedly(Return(template_url.get()));
- std::u16string query = base::ASCIIToUTF16("angeles now");
- std::u16string suggestion = base::ASCIIToUTF16("weather los ") + query;
+ std::u16string query = u"angeles now";
+ std::u16string suggestion = u"weather los " + query;
SearchSuggestionParser::SuggestResult suggest_result(
suggestion, AutocompleteMatchType::SEARCH_SUGGEST_TAIL,
/*subtypes=*/{},
/*match_contents=*/query,
- /*match_contents_prefix=*/base::ASCIIToUTF16("..."),
+ /*match_contents_prefix=*/u"...",
/*annotation=*/std::u16string(),
/*suggest_query_params=*/std::string(),
/*deletion_url=*/std::string(),
@@ -224,7 +223,7 @@
auto template_url = std::make_unique<TemplateURL>(data);
TestBaseSearchProvider::MatchMap map;
- std::u16string query = base::ASCIIToUTF16("site.com");
+ std::u16string query = u"site.com";
EXPECT_CALL(*provider_, GetInput(_))
.WillRepeatedly(Return(AutocompleteInput()));
diff --git a/components/omnibox/browser/bookmark_provider_unittest.cc b/components/omnibox/browser/bookmark_provider_unittest.cc
index 7b89b3d..3d991459 100644
--- a/components/omnibox/browser/bookmark_provider_unittest.cc
+++ b/components/omnibox/browser/bookmark_provider_unittest.cc
@@ -112,9 +112,9 @@
std::u16string MatchesAsString16(const ACMatches& matches) {
std::u16string matches_string;
for (auto i = matches.begin(); i != matches.end(); ++i) {
- matches_string.append(base::ASCIIToUTF16(" '"));
+ matches_string.append(u" '");
matches_string.append(i->description);
- matches_string.append(base::ASCIIToUTF16("'\n"));
+ matches_string.append(u"'\n");
}
return matches_string;
}
@@ -524,8 +524,7 @@
}
TEST_F(BookmarkProviderTest, DoesNotProvideMatchesOnFocus) {
- AutocompleteInput input(base::ASCIIToUTF16("foo"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"foo", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
input.set_focus_type(OmniboxFocusType::ON_FOCUS);
provider_->Start(input, false);
diff --git a/components/omnibox/browser/builtin_provider.cc b/components/omnibox/browser/builtin_provider.cc
index 90e44ae..b631648 100644
--- a/components/omnibox/browser/builtin_provider.cc
+++ b/components/omnibox/browser/builtin_provider.cc
@@ -69,15 +69,14 @@
// Match input about: or |embedderAbout| URL input against builtin URLs.
GURL url = url_formatter::FixupURL(base::UTF16ToUTF8(text), std::string());
const bool text_ends_with_slash =
- base::EndsWith(text, base::ASCIIToUTF16("/"),
- base::CompareCase::SENSITIVE);
+ base::EndsWith(text, u"/", base::CompareCase::SENSITIVE);
// BuiltinProvider doesn't know how to suggest valid ?query or #fragment
// extensions to builtin URLs.
if (url.SchemeIs(client_->GetEmbedderRepresentationOfAboutScheme()) &&
url.has_host() && !url.has_query() && !url.has_ref()) {
// Suggest about:blank for substrings, taking URL fixup into account.
// Chrome does not support trailing slashes or paths for about:blank.
- const std::u16string blank_host = base::ASCIIToUTF16("blank");
+ const std::u16string blank_host = u"blank";
const std::u16string host = base::UTF8ToUTF16(url.host());
if (base::StartsWith(text, base::ASCIIToUTF16(url::kAboutScheme),
base::CompareCase::INSENSITIVE_ASCII) &&
@@ -94,7 +93,7 @@
// Include the path for sub-pages (e.g. "chrome://settings/browser").
std::u16string host_and_path = base::UTF8ToUTF16(url.host() + url.path());
- base::TrimString(host_and_path, base::ASCIIToUTF16("/"), &host_and_path);
+ base::TrimString(host_and_path, u"/", &host_and_path);
size_t match_length = embedderAbout.length() + host_and_path.length();
for (Builtins::const_iterator i(builtins_.begin());
(i != builtins_.end()) && (matches_.size() < provider_max_matches_);
@@ -111,9 +110,9 @@
// trying to add a 'y' to an input like "chrome://histor/".
std::u16string inline_autocompletion(
match_string.substr(match_length));
- if (text_ends_with_slash && !base::StartsWith(
- match_string.substr(match_length), base::ASCIIToUTF16("/"),
- base::CompareCase::INSENSITIVE_ASCII))
+ if (text_ends_with_slash &&
+ !base::StartsWith(match_string.substr(match_length), u"/",
+ base::CompareCase::INSENSITIVE_ASCII))
inline_autocompletion = std::u16string();
AddMatch(match_string, inline_autocompletion, styles);
}
diff --git a/components/omnibox/browser/builtin_provider_unittest.cc b/components/omnibox/browser/builtin_provider_unittest.cc
index 8a5333d8..119e809 100644
--- a/components/omnibox/browser/builtin_provider_unittest.cc
+++ b/components/omnibox/browser/builtin_provider_unittest.cc
@@ -70,7 +70,7 @@
urls.push_back(ASCIIToUTF16(kHostMemory));
urls.push_back(ASCIIToUTF16(kHostSubpage));
- std::u16string prefix = ASCIIToUTF16(kHostSubpage) + ASCIIToUTF16("/");
+ std::u16string prefix = ASCIIToUTF16(kHostSubpage) + u"/";
urls.push_back(prefix + ASCIIToUTF16(kSubpageOne));
urls.push_back(prefix + ASCIIToUTF16(kSubpageTwo));
urls.push_back(prefix + ASCIIToUTF16(kSubpageThree));
@@ -132,8 +132,8 @@
TEST_F(BuiltinProviderTest, TypingScheme) {
const std::u16string kAbout = ASCIIToUTF16(url::kAboutScheme);
const std::u16string kEmbedder = ASCIIToUTF16(kEmbedderAboutScheme);
- const std::u16string kSeparator1 = ASCIIToUTF16(":");
- const std::u16string kSeparator2 = ASCIIToUTF16(":/");
+ const std::u16string kSeparator1 = u":";
+ const std::u16string kSeparator2 = u":/";
const std::u16string kSeparator3 =
ASCIIToUTF16(url::kStandardSchemeSeparator);
@@ -143,34 +143,34 @@
const GURL kURL3(kDefaultURL3);
TestData typing_scheme_cases[] = {
- // Typing an unrelated scheme should give nothing.
- {ASCIIToUTF16("h"), {}},
- {ASCIIToUTF16("http"), {}},
- {ASCIIToUTF16("file"), {}},
- {ASCIIToUTF16("abouz"), {}},
- {ASCIIToUTF16("aboutt"), {}},
- {ASCIIToUTF16("aboutt:"), {}},
- {ASCIIToUTF16("chroma"), {}},
- {ASCIIToUTF16("chromee"), {}},
- {ASCIIToUTF16("chromee:"), {}},
+ // Typing an unrelated scheme should give nothing.
+ {u"h", {}},
+ {u"http", {}},
+ {u"file", {}},
+ {u"abouz", {}},
+ {u"aboutt", {}},
+ {u"aboutt:", {}},
+ {u"chroma", {}},
+ {u"chromee", {}},
+ {u"chromee:", {}},
- // Typing a portion of about:// should give the default urls.
- {kAbout.substr(0, 1), {kURL1, kURL2, kURL3}},
- {ASCIIToUTF16("A"), {kURL1, kURL2, kURL3}},
- {kAbout, {kURL1, kURL2, kURL3}},
- {kAbout + kSeparator1, {kURL1, kURL2, kURL3}},
- {kAbout + kSeparator2, {kURL1, kURL2, kURL3}},
- {kAbout + kSeparator3, {kURL1, kURL2, kURL3}},
- {ASCIIToUTF16("aBoUT://"), {kURL1, kURL2, kURL3}},
+ // Typing a portion of about:// should give the default urls.
+ {kAbout.substr(0, 1), {kURL1, kURL2, kURL3}},
+ {u"A", {kURL1, kURL2, kURL3}},
+ {kAbout, {kURL1, kURL2, kURL3}},
+ {kAbout + kSeparator1, {kURL1, kURL2, kURL3}},
+ {kAbout + kSeparator2, {kURL1, kURL2, kURL3}},
+ {kAbout + kSeparator3, {kURL1, kURL2, kURL3}},
+ {u"aBoUT://", {kURL1, kURL2, kURL3}},
- // Typing a portion of the embedder scheme should give the default urls.
- {kEmbedder.substr(0, 1), {kURL1, kURL2, kURL3}},
- {ASCIIToUTF16("C"), {kURL1, kURL2, kURL3}},
- {kEmbedder, {kURL1, kURL2, kURL3}},
- {kEmbedder + kSeparator1, {kURL1, kURL2, kURL3}},
- {kEmbedder + kSeparator2, {kURL1, kURL2, kURL3}},
- {kEmbedder + kSeparator3, {kURL1, kURL2, kURL3}},
- {ASCIIToUTF16("ChRoMe://"), {kURL1, kURL2, kURL3}},
+ // Typing a portion of the embedder scheme should give the default urls.
+ {kEmbedder.substr(0, 1), {kURL1, kURL2, kURL3}},
+ {u"C", {kURL1, kURL2, kURL3}},
+ {kEmbedder, {kURL1, kURL2, kURL3}},
+ {kEmbedder + kSeparator1, {kURL1, kURL2, kURL3}},
+ {kEmbedder + kSeparator2, {kURL1, kURL2, kURL3}},
+ {kEmbedder + kSeparator3, {kURL1, kURL2, kURL3}},
+ {u"ChRoMe://", {kURL1, kURL2, kURL3}},
};
RunTest(typing_scheme_cases, base::size(typing_scheme_cases));
@@ -178,17 +178,17 @@
TEST_F(BuiltinProviderTest, NonEmbedderURLs) {
TestData test_cases[] = {
- // Typing an unrelated scheme should give nothing.
- {ASCIIToUTF16("g@rb@g3"), {}},
- {ASCIIToUTF16("www.google.com"), {}},
- {ASCIIToUTF16("http:www.google.com"), {}},
- {ASCIIToUTF16("http://www.google.com"), {}},
- {ASCIIToUTF16("file:filename"), {}},
- {ASCIIToUTF16("scheme:"), {}},
- {ASCIIToUTF16("scheme://"), {}},
- {ASCIIToUTF16("scheme://host"), {}},
- {ASCIIToUTF16("scheme:host/path?query#ref"), {}},
- {ASCIIToUTF16("scheme://host/path?query#ref"), {}},
+ // Typing an unrelated scheme should give nothing.
+ {u"g@rb@g3", {}},
+ {u"www.google.com", {}},
+ {u"http:www.google.com", {}},
+ {u"http://www.google.com", {}},
+ {u"file:filename", {}},
+ {u"scheme:", {}},
+ {u"scheme://", {}},
+ {u"scheme://host", {}},
+ {u"scheme:host/path?query#ref", {}},
+ {u"scheme://host/path?query#ref", {}},
};
RunTest(test_cases, base::size(test_cases));
@@ -197,8 +197,8 @@
TEST_F(BuiltinProviderTest, EmbedderProvidedURLs) {
const std::u16string kAbout = ASCIIToUTF16(url::kAboutScheme);
const std::u16string kEmbedder = ASCIIToUTF16(kEmbedderAboutScheme);
- const std::u16string kSep1 = ASCIIToUTF16(":");
- const std::u16string kSep2 = ASCIIToUTF16(":/");
+ const std::u16string kSep1 = u":";
+ const std::u16string kSep2 = u":/";
const std::u16string kSep3 = ASCIIToUTF16(url::kStandardSchemeSeparator);
// The following hosts are arbitrary, chosen so that they all start with the
@@ -211,33 +211,33 @@
const GURL kURLM3(kEmbedder + kSep3 + kHostM3);
TestData test_cases[] = {
- // Typing an about URL with an unknown host should give nothing.
- {kAbout + kSep1 + ASCIIToUTF16("host"), {}},
- {kAbout + kSep2 + ASCIIToUTF16("host"), {}},
- {kAbout + kSep3 + ASCIIToUTF16("host"), {}},
+ // Typing an about URL with an unknown host should give nothing.
+ {kAbout + kSep1 + u"host", {}},
+ {kAbout + kSep2 + u"host", {}},
+ {kAbout + kSep3 + u"host", {}},
- // Typing an embedder URL with an unknown host should give nothing.
- {kEmbedder + kSep1 + ASCIIToUTF16("host"), {}},
- {kEmbedder + kSep2 + ASCIIToUTF16("host"), {}},
- {kEmbedder + kSep3 + ASCIIToUTF16("host"), {}},
+ // Typing an embedder URL with an unknown host should give nothing.
+ {kEmbedder + kSep1 + u"host", {}},
+ {kEmbedder + kSep2 + u"host", {}},
+ {kEmbedder + kSep3 + u"host", {}},
- // Typing an about URL should provide matching URLs.
- {kAbout + kSep1 + kHostM1.substr(0, 1), {kURLM1, kURLM2, kURLM3}},
- {kAbout + kSep2 + kHostM1.substr(0, 2), {kURLM1, kURLM2, kURLM3}},
- {kAbout + kSep3 + kHostM1.substr(0, 3), {kURLM1}},
- {kAbout + kSep3 + kHostM2.substr(0, 3), {kURLM2, kURLM3}},
- {kAbout + kSep3 + kHostM1, {kURLM1}},
- {kAbout + kSep2 + kHostM2, {kURLM2}},
- {kAbout + kSep2 + kHostM3, {kURLM2, kURLM3}},
+ // Typing an about URL should provide matching URLs.
+ {kAbout + kSep1 + kHostM1.substr(0, 1), {kURLM1, kURLM2, kURLM3}},
+ {kAbout + kSep2 + kHostM1.substr(0, 2), {kURLM1, kURLM2, kURLM3}},
+ {kAbout + kSep3 + kHostM1.substr(0, 3), {kURLM1}},
+ {kAbout + kSep3 + kHostM2.substr(0, 3), {kURLM2, kURLM3}},
+ {kAbout + kSep3 + kHostM1, {kURLM1}},
+ {kAbout + kSep2 + kHostM2, {kURLM2}},
+ {kAbout + kSep2 + kHostM3, {kURLM2, kURLM3}},
- // Typing an embedder URL should provide matching URLs.
- {kEmbedder + kSep1 + kHostM1.substr(0, 1), {kURLM1, kURLM2, kURLM3}},
- {kEmbedder + kSep2 + kHostM1.substr(0, 2), {kURLM1, kURLM2, kURLM3}},
- {kEmbedder + kSep3 + kHostM1.substr(0, 3), {kURLM1}},
- {kEmbedder + kSep3 + kHostM2.substr(0, 3), {kURLM2, kURLM3}},
- {kEmbedder + kSep3 + kHostM1, {kURLM1}},
- {kEmbedder + kSep2 + kHostM2, {kURLM2}},
- {kEmbedder + kSep2 + kHostM3, {kURLM2, kURLM3}},
+ // Typing an embedder URL should provide matching URLs.
+ {kEmbedder + kSep1 + kHostM1.substr(0, 1), {kURLM1, kURLM2, kURLM3}},
+ {kEmbedder + kSep2 + kHostM1.substr(0, 2), {kURLM1, kURLM2, kURLM3}},
+ {kEmbedder + kSep3 + kHostM1.substr(0, 3), {kURLM1}},
+ {kEmbedder + kSep3 + kHostM2.substr(0, 3), {kURLM2, kURLM3}},
+ {kEmbedder + kSep3 + kHostM1, {kURLM1}},
+ {kEmbedder + kSep2 + kHostM2, {kURLM2}},
+ {kEmbedder + kSep2 + kHostM3, {kURLM2, kURLM3}},
};
RunTest(test_cases, base::size(test_cases));
@@ -247,60 +247,64 @@
const std::u16string kAbout = ASCIIToUTF16(url::kAboutScheme);
const std::u16string kEmbedder = ASCIIToUTF16(kEmbedderAboutScheme);
const std::u16string kAboutBlank = ASCIIToUTF16(url::kAboutBlankURL);
- const std::u16string kBlank = ASCIIToUTF16("blank");
+ const std::u16string kBlank = u"blank";
const std::u16string kSeparator1 =
ASCIIToUTF16(url::kStandardSchemeSeparator);
- const std::u16string kSeparator2 = ASCIIToUTF16(":///");
- const std::u16string kSeparator3 = ASCIIToUTF16(";///");
+ const std::u16string kSeparator2 = u":///";
+ const std::u16string kSeparator3 = u";///";
const GURL kURLBar =
GURL(kEmbedder + kSeparator1 + ASCIIToUTF16(kHostBar));
const GURL kURLBlank(kAboutBlank);
TestData about_blank_cases[] = {
- // Typing an about:blank prefix should yield about:blank, among other URLs.
- {kAboutBlank.substr(0, 7), {kURLBlank, kURLBar}},
- {kAboutBlank.substr(0, 8), {kURLBlank}},
+ // Typing an about:blank prefix should yield about:blank, among other
+ // URLs.
+ {kAboutBlank.substr(0, 7), {kURLBlank, kURLBar}},
+ {kAboutBlank.substr(0, 8), {kURLBlank}},
- // Using any separator that is supported by fixup should yield about:blank.
- // For now, BuiltinProvider does not suggest url-what-you-typed matches for
- // for about:blank; check "about:blan" and "about;blan" substrings instead.
- {kAbout + kSeparator2.substr(0, 1) + kBlank.substr(0, 4), {kURLBlank}},
- {kAbout + kSeparator2.substr(0, 2) + kBlank, {kURLBlank}},
- {kAbout + kSeparator2.substr(0, 3) + kBlank, {kURLBlank}},
- {kAbout + kSeparator2 + kBlank, {kURLBlank}},
- {kAbout + kSeparator3.substr(0, 1) + kBlank.substr(0, 4), {kURLBlank}},
- {kAbout + kSeparator3.substr(0, 2) + kBlank, {kURLBlank}},
- {kAbout + kSeparator3.substr(0, 3) + kBlank, {kURLBlank}},
- {kAbout + kSeparator3 + kBlank, {kURLBlank}},
+ // Using any separator that is supported by fixup should yield
+ // about:blank.
+ // For now, BuiltinProvider does not suggest url-what-you-typed matches
+ // for
+ // for about:blank; check "about:blan" and "about;blan" substrings
+ // instead.
+ {kAbout + kSeparator2.substr(0, 1) + kBlank.substr(0, 4), {kURLBlank}},
+ {kAbout + kSeparator2.substr(0, 2) + kBlank, {kURLBlank}},
+ {kAbout + kSeparator2.substr(0, 3) + kBlank, {kURLBlank}},
+ {kAbout + kSeparator2 + kBlank, {kURLBlank}},
+ {kAbout + kSeparator3.substr(0, 1) + kBlank.substr(0, 4), {kURLBlank}},
+ {kAbout + kSeparator3.substr(0, 2) + kBlank, {kURLBlank}},
+ {kAbout + kSeparator3.substr(0, 3) + kBlank, {kURLBlank}},
+ {kAbout + kSeparator3 + kBlank, {kURLBlank}},
- // Using the embedder scheme should not yield about:blank.
- {kEmbedder + kSeparator1.substr(0, 1) + kBlank, {}},
- {kEmbedder + kSeparator1.substr(0, 2) + kBlank, {}},
- {kEmbedder + kSeparator1.substr(0, 3) + kBlank, {}},
- {kEmbedder + kSeparator1 + kBlank, {}},
+ // Using the embedder scheme should not yield about:blank.
+ {kEmbedder + kSeparator1.substr(0, 1) + kBlank, {}},
+ {kEmbedder + kSeparator1.substr(0, 2) + kBlank, {}},
+ {kEmbedder + kSeparator1.substr(0, 3) + kBlank, {}},
+ {kEmbedder + kSeparator1 + kBlank, {}},
- // Adding trailing text should not yield about:blank.
- {kAboutBlank + ASCIIToUTF16("/"), {}},
- {kAboutBlank + ASCIIToUTF16("/p"), {}},
- {kAboutBlank + ASCIIToUTF16("x"), {}},
- {kAboutBlank + ASCIIToUTF16("?q"), {}},
- {kAboutBlank + ASCIIToUTF16("#r"), {}},
+ // Adding trailing text should not yield about:blank.
+ {kAboutBlank + u"/", {}},
+ {kAboutBlank + u"/p", {}},
+ {kAboutBlank + u"x", {}},
+ {kAboutBlank + u"?q", {}},
+ {kAboutBlank + u"#r", {}},
- // Interrupting "blank" with conflicting text should not yield about:blank.
- {kAboutBlank.substr(0, 9) + ASCIIToUTF16("/"), {}},
- {kAboutBlank.substr(0, 9) + ASCIIToUTF16("/p"), {}},
- {kAboutBlank.substr(0, 9) + ASCIIToUTF16("x"), {}},
- {kAboutBlank.substr(0, 9) + ASCIIToUTF16("?q"), {}},
- {kAboutBlank.substr(0, 9) + ASCIIToUTF16("#r"), {}},
+ // Interrupting "blank" with conflicting text should not yield
+ // about:blank.
+ {kAboutBlank.substr(0, 9) + u"/", {}},
+ {kAboutBlank.substr(0, 9) + u"/p", {}},
+ {kAboutBlank.substr(0, 9) + u"x", {}},
+ {kAboutBlank.substr(0, 9) + u"?q", {}},
+ {kAboutBlank.substr(0, 9) + u"#r", {}},
};
RunTest(about_blank_cases, base::size(about_blank_cases));
}
TEST_F(BuiltinProviderTest, DoesNotSupportMatchesOnFocus) {
- AutocompleteInput input(ASCIIToUTF16("chrome://m"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"chrome://m", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
input.set_focus_type(OmniboxFocusType::ON_FOCUS);
provider_->Start(input, false);
@@ -341,9 +345,8 @@
const std::u16string kHostMem = ASCIIToUTF16(kHostMemory);
const std::u16string kHostMemInt = ASCIIToUTF16(kHostMemoryInternals);
const std::u16string kHostSub = ASCIIToUTF16(kHostSubpage);
- const std::u16string kHostSubTwo = ASCIIToUTF16(kHostSubpage) +
- ASCIIToUTF16("/") +
- ASCIIToUTF16(kSubpageTwo);
+ const std::u16string kHostSubTwo =
+ ASCIIToUTF16(kHostSubpage) + u"/" + ASCIIToUTF16(kSubpageTwo);
struct InliningTestData {
const std::u16string input;
@@ -422,12 +425,9 @@
// Typing something non-match after an inline autocompletion should stop
// the inline autocompletion from appearing.
- {kAbout + kSep + kHostB.substr(0, 2) + ASCIIToUTF16("/"),
- std::u16string()},
- {kAbout + kSep + kHostB.substr(0, 2) + ASCIIToUTF16("a"),
- std::u16string()},
- {kAbout + kSep + kHostB.substr(0, 2) + ASCIIToUTF16("+"),
- std::u16string()},
+ {kAbout + kSep + kHostB.substr(0, 2) + u"/", std::u16string()},
+ {kAbout + kSep + kHostB.substr(0, 2) + u"a", std::u16string()},
+ {kAbout + kSep + kHostB.substr(0, 2) + u"+", std::u16string()},
};
ACMatches matches;
diff --git a/components/omnibox/browser/clipboard_provider.cc b/components/omnibox/browser/clipboard_provider.cc
index b19ad9c..73de409 100644
--- a/components/omnibox/browser/clipboard_provider.cc
+++ b/components/omnibox/browser/clipboard_provider.cc
@@ -570,7 +570,7 @@
AutocompleteMatch match = NewBlankImageMatch();
match.search_terms_args =
- std::make_unique<TemplateURLRef::SearchTermsArgs>(base::ASCIIToUTF16(""));
+ std::make_unique<TemplateURLRef::SearchTermsArgs>(u"");
match.search_terms_args->image_thumbnail_content.assign(
image_bytes->front_as<char>(), image_bytes->size());
TemplateURLRef::PostContent post_content;
diff --git a/components/omnibox/browser/document_provider.cc b/components/omnibox/browser/document_provider.cc
index 47d1c00e..ca9263d 100644
--- a/components/omnibox/browser/document_provider.cc
+++ b/components/omnibox/browser/document_provider.cc
@@ -388,7 +388,7 @@
template_url_service, &keyword_input);
if (keyword_provider &&
IsExplicitlyInKeywordMode(input, keyword_provider->keyword()) &&
- !base::StartsWith(input.text(), base::ASCIIToUTF16("drive.google.com"),
+ !base::StartsWith(input.text(), u"drive.google.com",
base::CompareCase::SENSITIVE)) {
return false;
}
@@ -423,11 +423,11 @@
// prefixes, but the SchemeClassifier won't have classified them as URLs yet.
// Note these checks are of the form "(string constant) starts with input."
if (input.text().length() <= 8) {
- if (StartsWith(base::ASCIIToUTF16("https://"), input.text(),
+ if (StartsWith(u"https://", input.text(),
base::CompareCase::INSENSITIVE_ASCII) ||
- StartsWith(base::ASCIIToUTF16("http://"), input.text(),
+ StartsWith(u"http://", input.text(),
base::CompareCase::INSENSITIVE_ASCII) ||
- StartsWith(base::ASCIIToUTF16("www."), input.text(),
+ StartsWith(u"www.", input.text(),
base::CompareCase::INSENSITIVE_ASCII)) {
return true;
}
diff --git a/components/omnibox/browser/document_provider_unittest.cc b/components/omnibox/browser/document_provider_unittest.cc
index 417ff25..25ac089 100644
--- a/components/omnibox/browser/document_provider_unittest.cc
+++ b/components/omnibox/browser/document_provider_unittest.cc
@@ -114,23 +114,23 @@
turl_model->Load();
TemplateURLData data;
- data.SetShortName(base::ASCIIToUTF16("t"));
+ data.SetShortName(u"t");
data.SetURL("https://www.google.com/?q={searchTerms}");
data.suggestions_url = "https://www.google.com/complete/?q={searchTerms}";
default_template_url_ = turl_model->Add(std::make_unique<TemplateURL>(data));
turl_model->SetUserSelectedDefaultSearchProvider(default_template_url_);
// Add a keyword provider.
- data.SetShortName(base::ASCIIToUTF16("wiki"));
- data.SetKeyword(base::ASCIIToUTF16("wikipedia.org"));
+ data.SetShortName(u"wiki");
+ data.SetKeyword(u"wikipedia.org");
data.SetURL("https://en.wikipedia.org/w/index.php?search={searchTerms}");
data.suggestions_url =
"https://en.wikipedia.org/w/index.php?search={searchTerms}";
turl_model->Add(std::make_unique<TemplateURL>(data));
// Add another.
- data.SetShortName(base::ASCIIToUTF16("drive"));
- data.SetKeyword(base::ASCIIToUTF16("drive.google.com"));
+ data.SetShortName(u"drive");
+ data.SetKeyword(u"drive.google.com");
data.SetURL("https://drive.google.com/drive/search?q={searchTerms}");
data.suggestions_url =
"https://drive.google.com/drive/search?q={searchTerms}";
@@ -156,9 +156,8 @@
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(omnibox::kDocumentProvider);
InitClient();
- AutocompleteInput input = AutocompleteInput(base::ASCIIToUTF16("text text"),
- metrics::OmniboxEventProto::OTHER,
- TestSchemeClassifier());
+ AutocompleteInput input = AutocompleteInput(
+ u"text text", metrics::OmniboxEventProto::OTHER, TestSchemeClassifier());
// Check |IsDocumentProviderAllowed()| returns true when all conditions pass.
EXPECT_TRUE(provider_->IsDocumentProviderAllowed(client_.get(), input));
@@ -210,7 +209,7 @@
// default; i.e. we didn't explicitly set this above.
TemplateURLService* template_url_service = client_->GetTemplateURLService();
TemplateURLData data;
- data.SetShortName(base::ASCIIToUTF16("t"));
+ data.SetShortName(u"t");
data.SetURL("https://www.notgoogle.com/?q={searchTerms}");
data.suggestions_url = "https://www.notgoogle.com/complete/?q={searchTerms}";
TemplateURL* new_default_provider =
@@ -230,7 +229,7 @@
feature_list.InitWithFeatures(
{omnibox::kDocumentProvider, omnibox::kExperimentalKeywordMode}, {});
{
- AutocompleteInput input(base::ASCIIToUTF16("wikipedia.org soup"),
+ AutocompleteInput input(u"wikipedia.org soup",
metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
input.set_prefer_keyword(true);
@@ -238,14 +237,14 @@
}
{
// Amazon is not registered as a keyword in |SetUp()|.
- AutocompleteInput input(base::ASCIIToUTF16("amazon.com soup"),
+ AutocompleteInput input(u"amazon.com soup",
metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
input.set_prefer_keyword(true);
EXPECT_TRUE(provider_->IsDocumentProviderAllowed(client_.get(), input));
}
{
- AutocompleteInput input(base::ASCIIToUTF16("drive.google.com soup"),
+ AutocompleteInput input(u"drive.google.com soup",
metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
input.set_prefer_keyword(true);
@@ -255,8 +254,7 @@
// Input should not be on-focus.
{
- AutocompleteInput input(base::ASCIIToUTF16("text text"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"text text", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
input.set_focus_type(OmniboxFocusType::ON_FOCUS);
EXPECT_FALSE(provider_->IsDocumentProviderAllowed(client_.get(), input));
@@ -264,7 +262,7 @@
// Input should not be empty.
{
- AutocompleteInput input(base::ASCIIToUTF16(" "),
+ AutocompleteInput input(u" ",
metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
EXPECT_FALSE(provider_->IsDocumentProviderAllowed(client_.get(), input));
@@ -273,16 +271,14 @@
// Input should be of sufficient length. The default limit is 4, which can't
// be set here since it's read when the doc provider is constructed.
{
- AutocompleteInput input(base::ASCIIToUTF16("12"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"12", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
EXPECT_FALSE(provider_->IsDocumentProviderAllowed(client_.get(), input));
}
// Input should not look like a URL.
{
- AutocompleteInput input(base::ASCIIToUTF16("www.x.com"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"www.x.com", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
input.set_focus_type(OmniboxFocusType::ON_FOCUS);
EXPECT_FALSE(provider_->IsDocumentProviderAllowed(client_.get(), input));
@@ -351,19 +347,19 @@
ACMatches matches = provider_->ParseDocumentSearchResults(*response);
EXPECT_EQ(matches.size(), 3u);
- EXPECT_EQ(matches[0].contents, base::ASCIIToUTF16("Document 1 longer title"));
+ EXPECT_EQ(matches[0].contents, u"Document 1 longer title");
EXPECT_EQ(matches[0].destination_url,
GURL("https://documentprovider.tld/doc?id=1"));
EXPECT_EQ(matches[0].relevance, 1234); // Server-specified.
EXPECT_EQ(matches[0].stripped_destination_url, GURL(SAMPLE_STRIPPED_URL));
- EXPECT_EQ(matches[1].contents, base::ASCIIToUTF16("Document 2 longer title"));
+ EXPECT_EQ(matches[1].contents, u"Document 2 longer title");
EXPECT_EQ(matches[1].destination_url,
GURL("https://documentprovider.tld/doc?id=2"));
EXPECT_EQ(matches[1].relevance, 0);
EXPECT_TRUE(matches[1].stripped_destination_url.is_empty());
- EXPECT_EQ(matches[2].contents, base::ASCIIToUTF16("Document 3 longer title"));
+ EXPECT_EQ(matches[2].contents, u"Document 3 longer title");
EXPECT_EQ(matches[2].destination_url,
GURL("https://documentprovider.tld/doc?id=3"));
EXPECT_EQ(matches[2].relevance, 0);
@@ -524,25 +520,18 @@
ACMatches matches = provider_->ParseDocumentSearchResults(*response);
EXPECT_EQ(matches.size(), 5u);
- EXPECT_EQ(matches[0].description,
- base::ASCIIToUTF16("1/12/94 - Google Docs"));
- EXPECT_EQ(matches[1].description,
- base::ASCIIToUTF16("1/12/94 - Google Drive"));
- EXPECT_EQ(matches[2].description,
- base::ASCIIToUTF16("1/12/94 - Google Sheets"));
- EXPECT_EQ(matches[3].description, base::ASCIIToUTF16("Google Sheets"));
- EXPECT_EQ(matches[4].description, base::ASCIIToUTF16(""));
+ EXPECT_EQ(matches[0].description, u"1/12/94 - Google Docs");
+ EXPECT_EQ(matches[1].description, u"1/12/94 - Google Drive");
+ EXPECT_EQ(matches[2].description, u"1/12/94 - Google Sheets");
+ EXPECT_EQ(matches[3].description, u"Google Sheets");
+ EXPECT_EQ(matches[4].description, u"");
// Also verify description_for_shortcuts does not include dates.
- EXPECT_EQ(matches[0].description_for_shortcuts,
- base::ASCIIToUTF16("Google Docs"));
- EXPECT_EQ(matches[1].description_for_shortcuts,
- base::ASCIIToUTF16("Google Drive"));
- EXPECT_EQ(matches[2].description_for_shortcuts,
- base::ASCIIToUTF16("Google Sheets"));
- EXPECT_EQ(matches[3].description_for_shortcuts,
- base::ASCIIToUTF16("Google Sheets"));
- EXPECT_EQ(matches[4].description_for_shortcuts, base::ASCIIToUTF16(""));
+ EXPECT_EQ(matches[0].description_for_shortcuts, u"Google Docs");
+ EXPECT_EQ(matches[1].description_for_shortcuts, u"Google Drive");
+ EXPECT_EQ(matches[2].description_for_shortcuts, u"Google Sheets");
+ EXPECT_EQ(matches[3].description_for_shortcuts, u"Google Sheets");
+ EXPECT_EQ(matches[4].description_for_shortcuts, u"");
}
// Verify correct formatting when the DisplayOwner feature param is true.
@@ -555,27 +544,19 @@
ACMatches matches = provider_->ParseDocumentSearchResults(*response);
EXPECT_EQ(matches.size(), 5u);
- EXPECT_EQ(matches[0].description,
- base::ASCIIToUTF16("1/12/94 - Green Moon - Google Docs"));
- EXPECT_EQ(matches[1].description,
- base::ASCIIToUTF16("1/12/94 - Blue Sunset - Google Drive"));
- EXPECT_EQ(matches[2].description,
- base::ASCIIToUTF16("1/12/94 - Google Sheets"));
- EXPECT_EQ(matches[3].description,
- base::ASCIIToUTF16("Red Lightning - Google Sheets"));
- EXPECT_EQ(matches[4].description, base::ASCIIToUTF16(""));
+ EXPECT_EQ(matches[0].description, u"1/12/94 - Green Moon - Google Docs");
+ EXPECT_EQ(matches[1].description, u"1/12/94 - Blue Sunset - Google Drive");
+ EXPECT_EQ(matches[2].description, u"1/12/94 - Google Sheets");
+ EXPECT_EQ(matches[3].description, u"Red Lightning - Google Sheets");
+ EXPECT_EQ(matches[4].description, u"");
// Also verify description_for_shortcuts does not include dates & owners.
EXPECT_EQ(matches.size(), 5u);
- EXPECT_EQ(matches[0].description_for_shortcuts,
- base::ASCIIToUTF16("Google Docs"));
- EXPECT_EQ(matches[1].description_for_shortcuts,
- base::ASCIIToUTF16("Google Drive"));
- EXPECT_EQ(matches[2].description_for_shortcuts,
- base::ASCIIToUTF16("Google Sheets"));
- EXPECT_EQ(matches[3].description_for_shortcuts,
- base::ASCIIToUTF16("Google Sheets"));
- EXPECT_EQ(matches[4].description_for_shortcuts, base::ASCIIToUTF16(""));
+ EXPECT_EQ(matches[0].description_for_shortcuts, u"Google Docs");
+ EXPECT_EQ(matches[1].description_for_shortcuts, u"Google Drive");
+ EXPECT_EQ(matches[2].description_for_shortcuts, u"Google Sheets");
+ EXPECT_EQ(matches[3].description_for_shortcuts, u"Google Sheets");
+ EXPECT_EQ(matches[4].description_for_shortcuts, u"");
}
}
@@ -619,19 +600,19 @@
// Server is suggesting relevances of [1234, 1234, 1234]
// We should break ties to [1234, 1233, 1232]
- EXPECT_EQ(matches[0].contents, base::ASCIIToUTF16("Document 1"));
+ EXPECT_EQ(matches[0].contents, u"Document 1");
EXPECT_EQ(matches[0].destination_url,
GURL("https://documentprovider.tld/doc?id=1"));
EXPECT_EQ(matches[0].relevance, 1234); // As the server specified.
EXPECT_EQ(matches[0].stripped_destination_url, GURL(SAMPLE_STRIPPED_URL));
- EXPECT_EQ(matches[1].contents, base::ASCIIToUTF16("Document 2"));
+ EXPECT_EQ(matches[1].contents, u"Document 2");
EXPECT_EQ(matches[1].destination_url,
GURL("https://documentprovider.tld/doc?id=2"));
EXPECT_EQ(matches[1].relevance, 1233); // Tie demoted
EXPECT_TRUE(matches[1].stripped_destination_url.is_empty());
- EXPECT_EQ(matches[2].contents, base::ASCIIToUTF16("Document 3"));
+ EXPECT_EQ(matches[2].contents, u"Document 3");
EXPECT_EQ(matches[2].destination_url,
GURL("https://documentprovider.tld/doc?id=3"));
EXPECT_EQ(matches[2].relevance, 1232); // Tie demoted, twice.
@@ -680,19 +661,19 @@
// Server is suggesting relevances of [1233, 1234, 1233, 1000, 1000]
// We should break ties to [1234, 1233, 1232, 1000, 999]
- EXPECT_EQ(matches[0].contents, base::ASCIIToUTF16("Document 1"));
+ EXPECT_EQ(matches[0].contents, u"Document 1");
EXPECT_EQ(matches[0].destination_url,
GURL("https://documentprovider.tld/doc?id=1"));
EXPECT_EQ(matches[0].relevance, 1234); // As the server specified.
EXPECT_EQ(matches[0].stripped_destination_url, GURL(SAMPLE_STRIPPED_URL));
- EXPECT_EQ(matches[1].contents, base::ASCIIToUTF16("Document 2"));
+ EXPECT_EQ(matches[1].contents, u"Document 2");
EXPECT_EQ(matches[1].destination_url,
GURL("https://documentprovider.tld/doc?id=2"));
EXPECT_EQ(matches[1].relevance, 1233); // Tie demoted
EXPECT_TRUE(matches[1].stripped_destination_url.is_empty());
- EXPECT_EQ(matches[2].contents, base::ASCIIToUTF16("Document 3"));
+ EXPECT_EQ(matches[2].contents, u"Document 3");
EXPECT_EQ(matches[2].destination_url,
GURL("https://documentprovider.tld/doc?id=3"));
// Document 2's demotion caused an implicit tie.
@@ -743,19 +724,19 @@
// Server is suggesting relevances of [1, 1, 1]
// We should break ties, but not below zero, to [1, 0, 0]
- EXPECT_EQ(matches[0].contents, base::ASCIIToUTF16("Document 1"));
+ EXPECT_EQ(matches[0].contents, u"Document 1");
EXPECT_EQ(matches[0].destination_url,
GURL("https://documentprovider.tld/doc?id=1"));
EXPECT_EQ(matches[0].relevance, 1); // As the server specified.
EXPECT_EQ(matches[0].stripped_destination_url, GURL(SAMPLE_STRIPPED_URL));
- EXPECT_EQ(matches[1].contents, base::ASCIIToUTF16("Document 2"));
+ EXPECT_EQ(matches[1].contents, u"Document 2");
EXPECT_EQ(matches[1].destination_url,
GURL("https://documentprovider.tld/doc?id=2"));
EXPECT_EQ(matches[1].relevance, 0); // Tie demoted
EXPECT_TRUE(matches[1].stripped_destination_url.is_empty());
- EXPECT_EQ(matches[2].contents, base::ASCIIToUTF16("Document 3"));
+ EXPECT_EQ(matches[2].contents, u"Document 3");
EXPECT_EQ(matches[2].destination_url,
GURL("https://documentprovider.tld/doc?id=3"));
// Tie is demoted further.
@@ -811,13 +792,13 @@
// ISO8601 UTC timestamp strings since the service returns them in practice.
EXPECT_EQ(DocumentProvider::GenerateLastModifiedString(
base::TimeToISO8601(modified_today), local_now),
- base::ASCIIToUTF16("2:18 AM"));
+ u"2:18 AM");
EXPECT_EQ(DocumentProvider::GenerateLastModifiedString(
base::TimeToISO8601(modified_this_year), local_now),
- base::ASCIIToUTF16("Aug 19"));
+ u"Aug 19");
EXPECT_EQ(DocumentProvider::GenerateLastModifiedString(
base::TimeToISO8601(modified_last_year), local_now),
- base::ASCIIToUTF16("8/27/17"));
+ u"8/27/17");
}
#endif // !defined(OS_IOS)
@@ -1154,8 +1135,7 @@
omnibox::kDocumentProvider, {{"DocumentUseClientScore", "true"}});
InitClient();
- AutocompleteInput input(base::ASCIIToUTF16("document"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"document", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
input.set_want_asynchronous_matches(false);
@@ -1199,8 +1179,7 @@
feature_list.InitAndEnableFeature(omnibox::kDocumentProvider);
InitClient();
- AutocompleteInput invalid_input(base::ASCIIToUTF16("12"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput invalid_input(u"12", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
invalid_input.set_want_asynchronous_matches(true);
diff --git a/components/omnibox/browser/document_suggestions_service_unittest.cc b/components/omnibox/browser/document_suggestions_service_unittest.cc
index 84db799..09a2deb8 100644
--- a/components/omnibox/browser/document_suggestions_service_unittest.cc
+++ b/components/omnibox/browser/document_suggestions_service_unittest.cc
@@ -79,8 +79,7 @@
}));
document_suggestions_service_->CreateDocumentSuggestionsRequest(
- base::ASCIIToUTF16(""), false,
- base::BindOnce(OnDocumentSuggestionsLoaderAvailable),
+ u"", false, base::BindOnce(OnDocumentSuggestionsLoaderAvailable),
base::BindOnce(OnURLLoadComplete));
base::RunLoop().RunUntilIdle();
diff --git a/components/omnibox/browser/history_quick_provider_unittest.cc b/components/omnibox/browser/history_quick_provider_unittest.cc
index ba82327a..26ee153 100644
--- a/components/omnibox/browser/history_quick_provider_unittest.cc
+++ b/components/omnibox/browser/history_quick_provider_unittest.cc
@@ -413,9 +413,8 @@
TEST_F(HistoryQuickProviderTest, SimpleSingleMatch) {
std::vector<std::string> expected_urls;
expected_urls.push_back("http://slashdot.org/favorite_page.html");
- RunTest(ASCIIToUTF16("slashdot"), false, expected_urls, true,
- ASCIIToUTF16("slashdot.org/favorite_page.html"),
- ASCIIToUTF16(".org/favorite_page.html"));
+ RunTest(u"slashdot", false, expected_urls, true,
+ u"slashdot.org/favorite_page.html", u".org/favorite_page.html");
}
TEST_F(HistoryQuickProviderTest, SingleMatchWithCursor) {
@@ -423,9 +422,8 @@
expected_urls.push_back("http://slashdot.org/favorite_page.html");
// With cursor after "slash", we should retrieve the desired result but it
// should not be allowed to be the default match.
- RunTestWithCursor(
- ASCIIToUTF16("slashfavorite_page.html"), 5, false, expected_urls, false,
- ASCIIToUTF16("slashdot.org/favorite_page.html"), std::u16string());
+ RunTestWithCursor(u"slashfavorite_page.html", 5, false, expected_urls, false,
+ u"slashdot.org/favorite_page.html", std::u16string());
}
TEST_F(HistoryQuickProviderTest, MatchWithAndWithoutCursorWordBreak) {
@@ -434,22 +432,21 @@
// the default match.
std::vector<std::string> expected_urls;
expected_urls.push_back("https://twitter.com/fungoodtimes");
- RunTestWithCursor(
- ASCIIToUTF16("twitter.com/fungootime"), 18, true, expected_urls, false,
- ASCIIToUTF16("https://twitter.com/fungoodtimes"), std::u16string());
+ RunTestWithCursor(u"twitter.com/fungootime", 18, true, expected_urls, false,
+ u"https://twitter.com/fungoodtimes", std::u16string());
// The input 'twitter.com/fungood|times' matches both with and without a
// cursor word break. We should retrieve both suggestions but neither should
// be allowed to be the default match.
- RunTestWithCursor(
- ASCIIToUTF16("twitter.com/fungoodtime"), 19, true, expected_urls, false,
- ASCIIToUTF16("https://twitter.com/fungoodtimes"), std::u16string(), true);
+ RunTestWithCursor(u"twitter.com/fungoodtime", 19, true, expected_urls, false,
+ u"https://twitter.com/fungoodtimes", std::u16string(),
+ true);
// A suggestion with a cursor not at the input end can only be default if
// the input matches suggestion exactly.
- RunTestWithCursor(
- ASCIIToUTF16("twitter.com/fungoodtimes"), 19, true, expected_urls, true,
- ASCIIToUTF16("https://twitter.com/fungoodtimes"), std::u16string(), true);
+ RunTestWithCursor(u"twitter.com/fungoodtimes", 19, true, expected_urls, true,
+ u"https://twitter.com/fungoodtimes", std::u16string(),
+ true);
}
TEST_F(HistoryQuickProviderTest, MatchWithAndWithoutCursorWordBreak_Dedupe) {
@@ -460,9 +457,9 @@
// as long as it's not at the start or the end.
expected_urls.push_back("https://deduping-test.com/high-scoring");
expected_urls.push_back("https://deduping-test.com/med-scoring");
- RunTestWithCursor(
- ASCIIToUTF16("deduping-test"), 1, true, expected_urls, false,
- ASCIIToUTF16("https://deduping-test.com/high-scoring"), std::u16string());
+ RunTestWithCursor(u"deduping-test", 1, true, expected_urls, false,
+ u"https://deduping-test.com/high-scoring",
+ std::u16string());
}
TEST_F(HistoryQuickProviderTest,
@@ -477,9 +474,8 @@
expected_urls.push_back("https://suffix.com/prefixsuffix3");
// Get scores for 'prefixsuffix'
- RunTestWithCursor(ASCIIToUTF16("prefixsuffix"), std::string::npos, false,
- expected_urls, false,
- ASCIIToUTF16("https://suffix.com/prefixsuffix1"),
+ RunTestWithCursor(u"prefixsuffix", std::string::npos, false, expected_urls,
+ false, u"https://suffix.com/prefixsuffix1",
std::u16string());
std::vector<int> unbroken_scores(3);
std::transform(ac_matches().begin(), ac_matches().end(),
@@ -487,9 +483,8 @@
[](const auto& match) { return match.relevance; });
// Get scores for 'prefix suffix'
- RunTestWithCursor(ASCIIToUTF16("prefix suffix"), std::string::npos, false,
- expected_urls, false,
- ASCIIToUTF16("https://suffix.com/prefixsuffix1"),
+ RunTestWithCursor(u"prefix suffix", std::string::npos, false, expected_urls,
+ false, u"https://suffix.com/prefixsuffix1",
std::u16string());
std::vector<int> broken_scores(3);
std::transform(ac_matches().begin(), ac_matches().end(),
@@ -501,9 +496,8 @@
// Get scores for 'prefix|suffix', which will create duplicate
// ScoredHistoryMatches.
- RunTestWithCursor(ASCIIToUTF16("prefixsuffix"), 6, true, expected_urls, false,
- ASCIIToUTF16("https://suffix.com/prefixsuffix1"),
- std::u16string());
+ RunTestWithCursor(u"prefixsuffix", 6, true, expected_urls, false,
+ u"https://suffix.com/prefixsuffix1", std::u16string());
// Ensure the higher scored ScoredHistoryMatches are promoted to suggestions
// during deduping.
for (size_t i = 0; i < 3; ++i)
@@ -513,26 +507,24 @@
TEST_F(HistoryQuickProviderTest, WordBoundariesWithPunctuationMatch) {
std::vector<std::string> expected_urls;
expected_urls.push_back("http://popularsitewithpathonly.com/moo");
- RunTest(ASCIIToUTF16("/moo"), false, expected_urls, false,
- ASCIIToUTF16("popularsitewithpathonly.com/moo"), std::u16string());
+ RunTest(u"/moo", false, expected_urls, false,
+ u"popularsitewithpathonly.com/moo", std::u16string());
}
TEST_F(HistoryQuickProviderTest, MultiTermTitleMatch) {
std::vector<std::string> expected_urls;
expected_urls.push_back(
"http://cda.com/Dogs%20Cats%20Gorillas%20Sea%20Slugs%20and%20Mice");
- RunTest(ASCIIToUTF16("mice other animals"), false, expected_urls, false,
- ASCIIToUTF16("cda.com/Dogs Cats Gorillas Sea Slugs and Mice"),
- std::u16string());
+ RunTest(u"mice other animals", false, expected_urls, false,
+ u"cda.com/Dogs Cats Gorillas Sea Slugs and Mice", std::u16string());
}
TEST_F(HistoryQuickProviderTest, NonWordLastCharacterMatch) {
std::string expected_url("http://slashdot.org/favorite_page.html");
std::vector<std::string> expected_urls;
expected_urls.push_back(expected_url);
- RunTest(ASCIIToUTF16("slashdot.org/"), false, expected_urls, true,
- ASCIIToUTF16("slashdot.org/favorite_page.html"),
- ASCIIToUTF16("favorite_page.html"));
+ RunTest(u"slashdot.org/", false, expected_urls, true,
+ u"slashdot.org/favorite_page.html", u"favorite_page.html");
}
TEST_F(HistoryQuickProviderTest, MultiMatch) {
@@ -543,24 +535,21 @@
expected_urls.push_back("http://foo.com/dir/another/");
// Scores high because of high visit count.
expected_urls.push_back("http://foo.com/dir/another/again/");
- RunTest(ASCIIToUTF16("foo"), false, expected_urls, true,
- ASCIIToUTF16("foo.com"), ASCIIToUTF16(".com"));
+ RunTest(u"foo", false, expected_urls, true, u"foo.com", u".com");
}
TEST_F(HistoryQuickProviderTest, StartRelativeMatch) {
std::vector<std::string> expected_urls;
expected_urls.push_back("http://xyzabcdefghijklmnopqrstuvw.com/a");
- RunTest(ASCIIToUTF16("xyza"), false, expected_urls, true,
- ASCIIToUTF16("xyzabcdefghijklmnopqrstuvw.com/a"),
- ASCIIToUTF16("bcdefghijklmnopqrstuvw.com/a"));
+ RunTest(u"xyza", false, expected_urls, true,
+ u"xyzabcdefghijklmnopqrstuvw.com/a", u"bcdefghijklmnopqrstuvw.com/a");
}
TEST_F(HistoryQuickProviderTest, EncodingMatch) {
std::vector<std::string> expected_urls;
expected_urls.push_back("http://spaces.com/path%20with%20spaces/foo.html");
- RunTest(ASCIIToUTF16("path with spaces"), false, expected_urls, false,
- ASCIIToUTF16("spaces.com/path with spaces/foo.html"),
- std::u16string());
+ RunTest(u"path with spaces", false, expected_urls, false,
+ u"spaces.com/path with spaces/foo.html", std::u16string());
}
TEST_F(HistoryQuickProviderTest, ContentsClass) {
@@ -600,9 +589,8 @@
expected_urls.push_back("http://visitedest.com/y/a");
expected_urls.push_back("http://visitedest.com/y/b");
expected_urls.push_back("http://visitedest.com/x/c");
- RunTest(ASCIIToUTF16("visitedest"), false, expected_urls, true,
- ASCIIToUTF16("visitedest.com/y/a"),
- ASCIIToUTF16(".com/y/a"));
+ RunTest(u"visitedest", false, expected_urls, true, u"visitedest.com/y/a",
+ u".com/y/a");
}
TEST_F(HistoryQuickProviderTest, TypedCountMatches) {
@@ -610,9 +598,8 @@
expected_urls.push_back("http://typeredest.com/y/a");
expected_urls.push_back("http://typeredest.com/y/b");
expected_urls.push_back("http://typeredest.com/x/c");
- RunTest(ASCIIToUTF16("typeredest"), false, expected_urls, true,
- ASCIIToUTF16("typeredest.com/y/a"),
- ASCIIToUTF16(".com/y/a"));
+ RunTest(u"typeredest", false, expected_urls, true, u"typeredest.com/y/a",
+ u".com/y/a");
}
TEST_F(HistoryQuickProviderTest, DaysAgoMatches) {
@@ -620,9 +607,8 @@
expected_urls.push_back("http://daysagoest.com/y/a");
expected_urls.push_back("http://daysagoest.com/y/b");
expected_urls.push_back("http://daysagoest.com/x/c");
- RunTest(ASCIIToUTF16("daysagoest"), false, expected_urls, true,
- ASCIIToUTF16("daysagoest.com/y/a"),
- ASCIIToUTF16(".com/y/a"));
+ RunTest(u"daysagoest", false, expected_urls, true, u"daysagoest.com/y/a",
+ u".com/y/a");
}
TEST_F(HistoryQuickProviderTest, EncodingLimitMatch) {
@@ -630,15 +616,13 @@
std::string url(
"http://cda.com/Dogs%20Cats%20Gorillas%20Sea%20Slugs%20and%20Mice");
// First check that a mid-word match yield no results.
- RunTest(ASCIIToUTF16("ice"), false, expected_urls, false,
- ASCIIToUTF16("cda.com/Dogs Cats Gorillas Sea Slugs and Mice"),
- std::u16string());
+ RunTest(u"ice", false, expected_urls, false,
+ u"cda.com/Dogs Cats Gorillas Sea Slugs and Mice", std::u16string());
// Then check that we get results when the match is at a word start
// that is present because of an encoded separate (%20 = space).
expected_urls.push_back(url);
- RunTest(ASCIIToUTF16("Mice"), false, expected_urls, false,
- ASCIIToUTF16("cda.com/Dogs Cats Gorillas Sea Slugs and Mice"),
- std::u16string());
+ RunTest(u"Mice", false, expected_urls, false,
+ u"cda.com/Dogs Cats Gorillas Sea Slugs and Mice", std::u16string());
// Verify that the matches' ACMatchClassifications offsets are in range.
ACMatchClassifications content(ac_matches()[0].contents_class);
// The max offset accounts for 6 occurrences of '%20' plus the 'http://'.
@@ -709,9 +693,8 @@
std::vector<std::string> expected_urls;
expected_urls.push_back(test_url.spec());
// Fill up ac_matches_; we don't really care about the test yet.
- RunTest(ASCIIToUTF16("slashdot"), false, expected_urls, true,
- ASCIIToUTF16("slashdot.org/favorite_page.html"),
- ASCIIToUTF16(".org/favorite_page.html"));
+ RunTest(u"slashdot", false, expected_urls, true,
+ u"slashdot.org/favorite_page.html", u".org/favorite_page.html");
EXPECT_EQ(1U, ac_matches().size());
EXPECT_TRUE(GetURLProxy(test_url));
provider().DeleteMatch(ac_matches()[0]);
@@ -728,8 +711,8 @@
// Just to be on the safe side, explicitly verify that we have deleted enough
// data so that we will not be serving the same result again.
expected_urls.clear();
- RunTest(ASCIIToUTF16("slashdot"), false, expected_urls, true,
- ASCIIToUTF16("NONE EXPECTED"), std::u16string());
+ RunTest(u"slashdot", false, expected_urls, true, u"NONE EXPECTED",
+ std::u16string());
}
TEST_F(HistoryQuickProviderTest, PreventBeatingURLWhatYouTypedMatch) {
@@ -741,16 +724,15 @@
// before, we should make sure that all HistoryQuickProvider results
// have scores less than what HistoryURLProvider will assign the
// URL-what-you-typed match.
- RunTest(ASCIIToUTF16("popularsitewithroot.com"), false, expected_urls, true,
- ASCIIToUTF16("popularsitewithroot.com"), std::u16string());
+ RunTest(u"popularsitewithroot.com", false, expected_urls, true,
+ u"popularsitewithroot.com", std::u16string());
EXPECT_LT(ac_matches()[0].relevance,
HistoryURLProvider::kScoreForBestInlineableResult);
// Check that if the user didn't quite enter the full hostname, this
// hostname would've normally scored above the URL-what-you-typed match.
- RunTest(ASCIIToUTF16("popularsitewithroot.c"), false, expected_urls, true,
- ASCIIToUTF16("popularsitewithroot.com"),
- ASCIIToUTF16("om"));
+ RunTest(u"popularsitewithroot.c", false, expected_urls, true,
+ u"popularsitewithroot.com", u"om");
EXPECT_GE(ac_matches()[0].relevance,
HistoryURLProvider::kScoreForWhatYouTypedResult);
@@ -760,36 +742,30 @@
// but never visited the root page of, we should make sure that all
// HistoryQuickProvider results have scores less than what the
// HistoryURLProvider will assign the URL-what-you-typed match.
- RunTest(ASCIIToUTF16("popularsitewithpathonly.com"), false, expected_urls,
- true,
- ASCIIToUTF16("popularsitewithpathonly.com/moo"),
- ASCIIToUTF16("/moo"));
+ RunTest(u"popularsitewithpathonly.com", false, expected_urls, true,
+ u"popularsitewithpathonly.com/moo", u"/moo");
EXPECT_LT(ac_matches()[0].relevance,
HistoryURLProvider::kScoreForUnvisitedIntranetResult);
// Verify the same thing happens if the user adds a / to end of the
// hostname.
- RunTest(ASCIIToUTF16("popularsitewithpathonly.com/"), false, expected_urls,
- true, ASCIIToUTF16("popularsitewithpathonly.com/moo"),
- ASCIIToUTF16("moo"));
+ RunTest(u"popularsitewithpathonly.com/", false, expected_urls, true,
+ u"popularsitewithpathonly.com/moo", u"moo");
EXPECT_LT(ac_matches()[0].relevance,
HistoryURLProvider::kScoreForUnvisitedIntranetResult);
// Check that if the user didn't quite enter the full hostname, this
// page would've normally scored above the URL-what-you-typed match.
- RunTest(ASCIIToUTF16("popularsitewithpathonly.co"), false, expected_urls,
- true, ASCIIToUTF16("popularsitewithpathonly.com/moo"),
- ASCIIToUTF16("m/moo"));
+ RunTest(u"popularsitewithpathonly.co", false, expected_urls, true,
+ u"popularsitewithpathonly.com/moo", u"m/moo");
EXPECT_GE(ac_matches()[0].relevance,
HistoryURLProvider::kScoreForWhatYouTypedResult);
// If the user enters a hostname + path that they have not visited
// before (but visited other things on the host), we can allow
// inline autocompletions.
- RunTest(ASCIIToUTF16("popularsitewithpathonly.com/mo"), false, expected_urls,
- true,
- ASCIIToUTF16("popularsitewithpathonly.com/moo"),
- ASCIIToUTF16("o"));
+ RunTest(u"popularsitewithpathonly.com/mo", false, expected_urls, true,
+ u"popularsitewithpathonly.com/moo", u"o");
EXPECT_GE(ac_matches()[0].relevance,
HistoryURLProvider::kScoreForWhatYouTypedResult);
@@ -797,9 +773,8 @@
// before, we should make sure that all HistoryQuickProvider results
// have scores less than what the HistoryURLProvider will assign
// the URL-what-you-typed match.
- RunTest(ASCIIToUTF16("popularsitewithpathonly.com/moo"), false, expected_urls,
- true, ASCIIToUTF16("popularsitewithpathonly.com/moo"),
- std::u16string());
+ RunTest(u"popularsitewithpathonly.com/moo", false, expected_urls, true,
+ u"popularsitewithpathonly.com/moo", std::u16string());
EXPECT_LT(ac_matches()[0].relevance,
HistoryURLProvider::kScoreForBestInlineableResult);
}
@@ -810,30 +785,27 @@
// Check that the desired URL is normally allowed to be the default match
// against input that is a prefex of the URL.
- RunTest(ASCIIToUTF16("popularsitewithr"), false, expected_urls, true,
- ASCIIToUTF16("popularsitewithroot.com"),
- ASCIIToUTF16("oot.com"));
+ RunTest(u"popularsitewithr", false, expected_urls, true,
+ u"popularsitewithroot.com", u"oot.com");
// Check that it's not allowed to be the default match if
// prevent_inline_autocomplete is true.
- RunTest(ASCIIToUTF16("popularsitewithr"), true, expected_urls, false,
- ASCIIToUTF16("popularsitewithroot.com"),
- ASCIIToUTF16("oot.com"));
+ RunTest(u"popularsitewithr", true, expected_urls, false,
+ u"popularsitewithroot.com", u"oot.com");
// But the exact hostname can still match even if prevent inline autocomplete
// is true. i.e., there's no autocompletion necessary; this is effectively
// URL-what-you-typed.
- RunTest(ASCIIToUTF16("popularsitewithroot.com"), true, expected_urls, true,
- ASCIIToUTF16("popularsitewithroot.com"), std::u16string());
+ RunTest(u"popularsitewithroot.com", true, expected_urls, true,
+ u"popularsitewithroot.com", std::u16string());
// The above still holds even with an extra trailing slash.
- RunTest(ASCIIToUTF16("popularsitewithroot.com/"), true, expected_urls, true,
- ASCIIToUTF16("popularsitewithroot.com"), std::u16string());
+ RunTest(u"popularsitewithroot.com/", true, expected_urls, true,
+ u"popularsitewithroot.com", std::u16string());
}
TEST_F(HistoryQuickProviderTest, DoesNotProvideMatchesOnFocus) {
- AutocompleteInput input(ASCIIToUTF16("popularsite"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"popularsite", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
input.set_focus_type(OmniboxFocusType::ON_FOCUS);
provider().Start(input, false);
@@ -851,35 +823,33 @@
// Trim the http:// scheme from the contents in the general case.
TEST_F(HistoryQuickProviderTest, DoTrimHttpScheme) {
- AutocompleteInput input(ASCIIToUTF16("face"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"face", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
provider().Start(input, false);
ScoredHistoryMatch history_match =
BuildScoredHistoryMatch("http://www.facebook.com", "face");
AutocompleteMatch match = provider().QuickMatchToACMatch(history_match, 100);
- EXPECT_EQ(ASCIIToUTF16("facebook.com"), match.contents);
+ EXPECT_EQ(u"facebook.com", match.contents);
}
// Don't trim the http:// scheme from the match contents if
// the user input included a scheme.
TEST_F(HistoryQuickProviderTest, DontTrimHttpSchemeIfInputHasScheme) {
- AutocompleteInput input(ASCIIToUTF16("http://face"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"http://face", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
provider().Start(input, false);
ScoredHistoryMatch history_match =
BuildScoredHistoryMatch("http://www.facebook.com", "http://face");
AutocompleteMatch match = provider().QuickMatchToACMatch(history_match, 100);
- EXPECT_EQ(ASCIIToUTF16("http://facebook.com"), match.contents);
+ EXPECT_EQ(u"http://facebook.com", match.contents);
}
// Don't trim the http:// scheme from the match contents if
// the user input matched it.
TEST_F(HistoryQuickProviderTest, DontTrimHttpSchemeIfInputMatches) {
- AutocompleteInput input(ASCIIToUTF16("ht"), metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"ht", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
provider().Start(input, false);
ScoredHistoryMatch history_match =
@@ -887,49 +857,45 @@
history_match.match_in_scheme = true;
AutocompleteMatch match = provider().QuickMatchToACMatch(history_match, 100);
- EXPECT_EQ(ASCIIToUTF16("http://facebook.com"), match.contents);
+ EXPECT_EQ(u"http://facebook.com", match.contents);
}
// Don't trim the https:// scheme from the match contents if the user input
// included a scheme.
TEST_F(HistoryQuickProviderTest, DontTrimHttpsSchemeIfInputHasScheme) {
- AutocompleteInput input(ASCIIToUTF16("https://face"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"https://face", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
provider().Start(input, false);
ScoredHistoryMatch history_match =
BuildScoredHistoryMatch("https://www.facebook.com", "https://face");
AutocompleteMatch match = provider().QuickMatchToACMatch(history_match, 100);
- EXPECT_EQ(ASCIIToUTF16("https://facebook.com"), match.contents);
+ EXPECT_EQ(u"https://facebook.com", match.contents);
}
// Trim the https:// scheme from the match contents if nothing prevents it.
TEST_F(HistoryQuickProviderTest, DoTrimHttpsScheme) {
- AutocompleteInput input(ASCIIToUTF16("face"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"face", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
provider().Start(input, false);
ScoredHistoryMatch history_match =
BuildScoredHistoryMatch("https://www.facebook.com", "face");
AutocompleteMatch match = provider().QuickMatchToACMatch(history_match, 100);
- EXPECT_EQ(ASCIIToUTF16("facebook.com"), match.contents);
+ EXPECT_EQ(u"facebook.com", match.contents);
}
TEST_F(HistoryQuickProviderTest, CorrectAutocompleteWithTrailingSlash) {
provider().autocomplete_input_ = AutocompleteInput(
- base::ASCIIToUTF16("cr/"), metrics::OmniboxEventProto::OTHER,
- TestSchemeClassifier());
+ u"cr/", metrics::OmniboxEventProto::OTHER, TestSchemeClassifier());
RowWordStarts word_starts;
word_starts.url_word_starts_ = {0};
ScoredHistoryMatch sh_match(history::URLRow(GURL("http://cr/")),
- VisitInfoVector(), ASCIIToUTF16("cr/"),
- {ASCIIToUTF16("cr")}, {0}, word_starts, false, 0,
- base::Time());
+ VisitInfoVector(), u"cr/", {u"cr"}, {0},
+ word_starts, false, 0, base::Time());
AutocompleteMatch ac_match(provider().QuickMatchToACMatch(sh_match, 0));
- EXPECT_EQ(base::ASCIIToUTF16("cr/"), ac_match.fill_into_edit);
- EXPECT_EQ(base::ASCIIToUTF16(""), ac_match.inline_autocompletion);
+ EXPECT_EQ(u"cr/", ac_match.fill_into_edit);
+ EXPECT_EQ(u"", ac_match.inline_autocompletion);
EXPECT_TRUE(ac_match.allowed_to_be_default_match);
}
@@ -993,9 +959,7 @@
expected_urls.push_back("http://techmeme.com/");
expected_urls.push_back("http://www.teamliquid.net/");
expected_urls.push_back("http://www.teamliquid.net/tlpd");
- RunTest(ASCIIToUTF16("te"), false, expected_urls, true,
- ASCIIToUTF16("techmeme.com"),
- ASCIIToUTF16("chmeme.com"));
+ RunTest(u"te", false, expected_urls, true, u"techmeme.com", u"chmeme.com");
}
TEST_F(HQPOrderingTest, TEAMatch) {
@@ -1003,7 +967,6 @@
expected_urls.push_back("http://www.teamliquid.net/");
expected_urls.push_back("http://www.teamliquid.net/tlpd");
expected_urls.push_back("http://teamliquid.net/");
- RunTest(ASCIIToUTF16("tea"), false, expected_urls, true,
- ASCIIToUTF16("www.teamliquid.net"),
- ASCIIToUTF16("mliquid.net"));
+ RunTest(u"tea", false, expected_urls, true, u"www.teamliquid.net",
+ u"mliquid.net");
}
diff --git a/components/omnibox/browser/history_url_provider_unittest.cc b/components/omnibox/browser/history_url_provider_unittest.cc
index a29948f..f23b1b13 100644
--- a/components/omnibox/browser/history_url_provider_unittest.cc
+++ b/components/omnibox/browser/history_url_provider_unittest.cc
@@ -341,7 +341,7 @@
std::sort(matches_.begin(), matches_.end(),
&AutocompleteMatch::MoreRelevant);
}
- SCOPED_TRACE(ASCIIToUTF16("input = ") + text);
+ SCOPED_TRACE(u"input = " + text);
ASSERT_EQ(num_results, matches_.size()) << "Input text: " << text
<< "\nTLD: \"" << desired_tld << "\"";
for (size_t i = 0; i < num_results; ++i) {
@@ -361,8 +361,7 @@
ASSERT_FALSE(expected_match_contents_string.empty());
SCOPED_TRACE("input = " + input_text);
- SCOPED_TRACE(ASCIIToUTF16("expected_match_contents = ") +
- expected_match_contents_string);
+ SCOPED_TRACE(u"expected_match_contents = " + expected_match_contents_string);
AutocompleteInput input(ASCIIToUTF16(input_text),
metrics::OmniboxEventProto::OTHER,
@@ -406,7 +405,7 @@
{ "http://slashdot.org/favorite_page.html", false },
{ "http://slashdot.org/", false }
};
- RunTest(ASCIIToUTF16("slash"), std::string(), true, expected_nonsynth,
+ RunTest(u"slash", std::string(), true, expected_nonsynth,
base::size(expected_nonsynth));
// Test that hosts get synthesized above less popular pages.
@@ -414,11 +413,11 @@
{ "http://kerneltrap.org/", false },
{ "http://kerneltrap.org/not_very_popular.html", false }
};
- RunTest(ASCIIToUTF16("kernel"), std::string(), true, expected_synth,
+ RunTest(u"kernel", std::string(), true, expected_synth,
base::size(expected_synth));
// Test that unpopular pages are ignored completely.
- RunTest(ASCIIToUTF16("fresh"), std::string(), true, nullptr, 0);
+ RunTest(u"fresh", std::string(), true, nullptr, 0);
// Test that if we create or promote shorter suggestions that would not
// normally be inline autocompletable, we make them inline autocompletable if
@@ -428,14 +427,14 @@
{ "http://synthesisatest.com/", true },
{ "http://synthesisatest.com/foo/", true }
};
- RunTest(ASCIIToUTF16("synthesisa"), std::string(), false, expected_synthesisa,
+ RunTest(u"synthesisa", std::string(), false, expected_synthesisa,
base::size(expected_synthesisa));
EXPECT_LT(matches_.front().relevance, 1200);
const UrlAndLegalDefault expected_synthesisb[] = {
{ "http://synthesisbtest.com/foo/", true },
{ "http://synthesisbtest.com/foo/bar.html", true }
};
- RunTest(ASCIIToUTF16("synthesisb"), std::string(), false, expected_synthesisb,
+ RunTest(u"synthesisb", std::string(), false, expected_synthesisb,
base::size(expected_synthesisb));
EXPECT_GE(matches_.front().relevance, 1410);
@@ -445,12 +444,12 @@
{ "http://news.google.com/", false },
{ "http://news.google.com/?ned=us&topic=n", false },
};
- ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16("news"), std::string(), true,
+ ASSERT_NO_FATAL_FAILURE(RunTest(u"news", std::string(), true,
expected_combine,
base::size(expected_combine)));
// The title should also have gotten set properly on the host for the
// synthesized one, since it was also in the results.
- EXPECT_EQ(ASCIIToUTF16("Google News"), matches_.front().description);
+ EXPECT_EQ(u"Google News", matches_.front().description);
// Test that short URL matching works correctly as the user types more
// (several tests):
@@ -460,8 +459,7 @@
{ "http://foo.com/dir/another/again/myfile.html", false },
{ "http://foo.com/dir/", false }
};
- RunTest(ASCIIToUTF16("foo"), std::string(), true, short_1,
- base::size(short_1));
+ RunTest(u"foo", std::string(), true, short_1, base::size(short_1));
// When the user types the whole host, make sure we don't get two results for
// it.
@@ -471,10 +469,8 @@
{ "http://foo.com/dir/", false },
{ "http://foo.com/dir/another/", false }
};
- RunTest(ASCIIToUTF16("foo.com"), std::string(), true, short_2,
- base::size(short_2));
- RunTest(ASCIIToUTF16("foo.com/"), std::string(), true, short_2,
- base::size(short_2));
+ RunTest(u"foo.com", std::string(), true, short_2, base::size(short_2));
+ RunTest(u"foo.com/", std::string(), true, short_2, base::size(short_2));
// The filename is the second best of the foo.com* entries, but there is a
// shorter URL that's "good enough". The host doesn't match the user input
@@ -485,8 +481,7 @@
{ "http://foo.com/dir/another/again/myfile.html", false },
{ "http://foo.com/dir/", false }
};
- RunTest(ASCIIToUTF16("foo.com/d"), std::string(), true, short_3,
- base::size(short_3));
+ RunTest(u"foo.com/d", std::string(), true, short_3, base::size(short_3));
// If prevent_inline_autocomplete is false, we won't bother creating the
// URL-what-you-typed match because we have promoted inline autocompletions.
const UrlAndLegalDefault short_3_allow_inline[] = {
@@ -494,7 +489,7 @@
{ "http://foo.com/dir/another/again/myfile.html", true },
{ "http://foo.com/dir/", true }
};
- RunTest(ASCIIToUTF16("foo.com/d"), std::string(), false, short_3_allow_inline,
+ RunTest(u"foo.com/d", std::string(), false, short_3_allow_inline,
base::size(short_3_allow_inline));
// We shouldn't promote shorter URLs than the best if they're not good
@@ -504,7 +499,7 @@
{ "http://foo.com/dir/another/a", true },
{ "http://foo.com/dir/another/again/", false }
};
- RunTest(ASCIIToUTF16("foo.com/dir/another/a"), std::string(), true, short_4,
+ RunTest(u"foo.com/dir/another/a", std::string(), true, short_4,
base::size(short_4));
// If prevent_inline_autocomplete is false, we won't bother creating the
// URL-what-you-typed match because we have promoted inline autocompletions.
@@ -512,8 +507,8 @@
{ "http://foo.com/dir/another/again/myfile.html", true },
{ "http://foo.com/dir/another/again/", true }
};
- RunTest(ASCIIToUTF16("foo.com/dir/another/a"), std::string(), false,
- short_4_allow_inline, base::size(short_4_allow_inline));
+ RunTest(u"foo.com/dir/another/a", std::string(), false, short_4_allow_inline,
+ base::size(short_4_allow_inline));
// Exact matches should always be best no matter how much more another match
// has been typed.
@@ -529,10 +524,8 @@
};
// Note that there is an http://g/ URL that is marked as hidden. It shouldn't
// show up at all. This test implicitly tests this fact too.
- RunTest(ASCIIToUTF16("g"), std::string(), false, short_5a,
- base::size(short_5a));
- RunTest(ASCIIToUTF16("go"), std::string(), false, short_5b,
- base::size(short_5b));
+ RunTest(u"g", std::string(), false, short_5a, base::size(short_5a));
+ RunTest(u"go", std::string(), false, short_5b, base::size(short_5b));
}
TEST_F(HistoryURLProviderTest, CullRedirects) {
@@ -550,7 +543,7 @@
};
for (size_t i = 0; i < base::size(test_cases); ++i) {
client_->GetHistoryService()->AddPageWithDetails(
- GURL(test_cases[i].url), ASCIIToUTF16("Title"), test_cases[i].count,
+ GURL(test_cases[i].url), u"Title", test_cases[i].count,
test_cases[i].count, Time::Now(), false, history::SOURCE_BROWSED);
}
@@ -569,7 +562,7 @@
// Because all the results are part of a redirect chain with other results,
// all but the first one (A) should be culled. We should get the default
// "what you typed" result, plus this one.
- const std::u16string typing(ASCIIToUTF16("http://redirects/"));
+ const std::u16string typing(u"http://redirects/");
const UrlAndLegalDefault expected_results[] = {
{ test_cases[0].url, false },
{ base::UTF16ToUTF8(typing), true }
@@ -595,69 +588,64 @@
const UrlAndLegalDefault results_1[] = {
{ "http://wytmatch/", true }
};
- RunTest(ASCIIToUTF16("wytmatch"), std::string(), false, results_1,
- base::size(results_1));
+ RunTest(u"wytmatch", std::string(), false, results_1, base::size(results_1));
- RunTest(ASCIIToUTF16("wytmatch foo bar"), std::string(), false, nullptr, 0);
- RunTest(ASCIIToUTF16("wytmatch+foo+bar"), std::string(), false, nullptr, 0);
+ RunTest(u"wytmatch foo bar", std::string(), false, nullptr, 0);
+ RunTest(u"wytmatch+foo+bar", std::string(), false, nullptr, 0);
const UrlAndLegalDefault results_2[] = {
{ "http://wytmatch+foo+bar.com/", true }
};
- RunTest(ASCIIToUTF16("wytmatch+foo+bar.com"), std::string(), false, results_2,
+ RunTest(u"wytmatch+foo+bar.com", std::string(), false, results_2,
base::size(results_2));
}
TEST_F(HistoryURLProviderTest, WhatYouTyped) {
// Make sure we suggest a What You Typed match at the right times.
- RunTest(ASCIIToUTF16("wytmatch"), std::string(), false, nullptr, 0);
- RunTest(ASCIIToUTF16("wytmatch foo bar"), std::string(), false, nullptr, 0);
- RunTest(ASCIIToUTF16("wytmatch+foo+bar"), std::string(), false, nullptr, 0);
- RunTest(ASCIIToUTF16("wytmatch+foo+bar.com"), std::string(), false, nullptr,
- 0);
+ RunTest(u"wytmatch", std::string(), false, nullptr, 0);
+ RunTest(u"wytmatch foo bar", std::string(), false, nullptr, 0);
+ RunTest(u"wytmatch+foo+bar", std::string(), false, nullptr, 0);
+ RunTest(u"wytmatch+foo+bar.com", std::string(), false, nullptr, 0);
const UrlAndLegalDefault results_1[] = {
{ "http://www.wytmatch.com/", true }
};
- RunTest(ASCIIToUTF16("wytmatch"), "com", false, results_1,
- base::size(results_1));
+ RunTest(u"wytmatch", "com", false, results_1, base::size(results_1));
const UrlAndLegalDefault results_2[] = {
{ "http://wytmatch%20foo%20bar/", false }
};
- RunTest(ASCIIToUTF16("http://wytmatch foo bar"), std::string(), false,
- results_2, base::size(results_2));
+ RunTest(u"http://wytmatch foo bar", std::string(), false, results_2,
+ base::size(results_2));
const UrlAndLegalDefault results_3[] = {
{ "https://wytmatch%20foo%20bar/", false }
};
- RunTest(ASCIIToUTF16("https://wytmatch foo bar"), std::string(), false,
- results_3, base::size(results_3));
+ RunTest(u"https://wytmatch foo bar", std::string(), false, results_3,
+ base::size(results_3));
const UrlAndLegalDefault results_4[] = {{"https://wytih/", true},
{"https://www.wytih/file", true},
{"ftp://wytih/file", true},
{"https://www.wytih/page", true}};
- RunTest(ASCIIToUTF16("wytih"), std::string(), false, results_4,
- base::size(results_4));
+ RunTest(u"wytih", std::string(), false, results_4, base::size(results_4));
const UrlAndLegalDefault results_5[] = {{"https://www.wytih/", true},
{"https://www.wytih/file", true},
{"https://www.wytih/page", true}};
- RunTest(ASCIIToUTF16("www.wytih"), std::string(), false, results_5,
- base::size(results_5));
+ RunTest(u"www.wytih", std::string(), false, results_5, base::size(results_5));
const UrlAndLegalDefault results_6[] = {{"ftp://wytih/file", true},
{"https://www.wytih/file", true}};
- RunTest(ASCIIToUTF16("wytih/file"), std::string(), false, results_6,
+ RunTest(u"wytih/file", std::string(), false, results_6,
base::size(results_6));
}
TEST_F(HistoryURLProviderTest, Fixup) {
// Test for various past crashes we've had.
- RunTest(ASCIIToUTF16("\\"), std::string(), false, nullptr, 0);
- RunTest(ASCIIToUTF16("#"), std::string(), false, nullptr, 0);
- RunTest(ASCIIToUTF16("%20"), std::string(), false, nullptr, 0);
+ RunTest(u"\\", std::string(), false, nullptr, 0);
+ RunTest(u"#", std::string(), false, nullptr, 0);
+ RunTest(u"%20", std::string(), false, nullptr, 0);
const UrlAndLegalDefault fixup_crash[] = {
{ "http://%EF%BD%A5@s/", false }
};
@@ -667,18 +655,17 @@
// Fixing up "file:" should result in an inline autocomplete offset of just
// after "file:", not just after "file://".
- const std::u16string input_1(ASCIIToUTF16("file:"));
+ const std::u16string input_1(u"file:");
const UrlAndLegalDefault fixup_1[] = {
{ "file:///C:/foo.txt", true }
};
ASSERT_NO_FATAL_FAILURE(
RunTest(input_1, std::string(), false, fixup_1, base::size(fixup_1)));
- EXPECT_EQ(ASCIIToUTF16("///C:/foo.txt"),
- matches_.front().inline_autocompletion);
+ EXPECT_EQ(u"///C:/foo.txt", matches_.front().inline_autocompletion);
// Fixing up "http:/" should result in an inline autocomplete offset of just
// after "http:/", not just after "http:".
- const std::u16string input_2(ASCIIToUTF16("http:/"));
+ const std::u16string input_2(u"http:/");
const UrlAndLegalDefault fixup_2[] = {
{ "http://bogussite.com/a", true },
{ "http://bogussite.com/b", true },
@@ -686,30 +673,27 @@
};
ASSERT_NO_FATAL_FAILURE(
RunTest(input_2, std::string(), false, fixup_2, base::size(fixup_2)));
- EXPECT_EQ(ASCIIToUTF16("/bogussite.com/a"),
- matches_.front().inline_autocompletion);
+ EXPECT_EQ(u"/bogussite.com/a", matches_.front().inline_autocompletion);
// Adding a TLD to a small number like "56" should result in "www.56.com"
// rather than "0.0.0.56.com".
const UrlAndLegalDefault fixup_3[] = {
{ "http://www.56.com/", true }
};
- RunTest(ASCIIToUTF16("56"), "com", true, fixup_3, base::size(fixup_3));
+ RunTest(u"56", "com", true, fixup_3, base::size(fixup_3));
// An input looks like a IP address like "127.0.0.1" should result in
// "http://127.0.0.1/".
const UrlAndLegalDefault fixup_4[] = {
{ "http://127.0.0.1/", true }
};
- RunTest(ASCIIToUTF16("127.0.0.1"), std::string(), false, fixup_4,
- base::size(fixup_4));
+ RunTest(u"127.0.0.1", std::string(), false, fixup_4, base::size(fixup_4));
// An number "17173" should result in "http://www.17173.com/" in db.
const UrlAndLegalDefault fixup_5[] = {
{ "http://www.17173.com/", true }
};
- RunTest(ASCIIToUTF16("17173"), std::string(), false, fixup_5,
- base::size(fixup_5));
+ RunTest(u"17173", std::string(), false, fixup_5, base::size(fixup_5));
}
// Make sure the results for the input 'p' don't change between the first and
@@ -719,7 +703,7 @@
history::BlockUntilHistoryProcessesPendingRequests(
client_->GetHistoryService());
- AutocompleteInput input(ASCIIToUTF16("pa"), metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"pa", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
autocomplete_->Start(input, false);
// HistoryURLProvider shouldn't be done (waiting on async results).
@@ -746,16 +730,16 @@
UrlAndLegalDefault navigation_1[] = {
{ "http://test.com/", true }
};
- RunTest(ASCIIToUTF16("test.com"), std::string(), false, navigation_1,
+ RunTest(u"test.com", std::string(), false, navigation_1,
base::size(navigation_1));
UrlAndLegalDefault navigation_2[] = {
{ "http://slash/", false }
};
- RunTest(ASCIIToUTF16("slash"), std::string(), false, navigation_2,
+ RunTest(u"slash", std::string(), false, navigation_2,
base::size(navigation_2));
- RunTest(ASCIIToUTF16("this is a query"), std::string(), false, nullptr, 0);
+ RunTest(u"this is a query", std::string(), false, nullptr, 0);
}
TEST_F(HistoryURLProviderTest, AutocompleteOnTrailingWhitespace) {
@@ -848,8 +832,8 @@
const UrlAndLegalDefault expected[] = {
{ "http://[email protected]/", false }
};
- ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16("[email protected]"), std::string(),
- false, expected, base::size(expected)));
+ ASSERT_NO_FATAL_FAILURE(RunTest(u"[email protected]", std::string(), false,
+ expected, base::size(expected)));
EXPECT_LE(1200, matches_[0].relevance);
EXPECT_LT(matches_[0].relevance, 1210);
}
@@ -898,8 +882,8 @@
{ "http://intra/three", true },
{ "http://intra/two", true }
};
- ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16("intra/t"), std::string(), false,
- expected1, base::size(expected1)));
+ ASSERT_NO_FATAL_FAILURE(RunTest(u"intra/t", std::string(), false, expected1,
+ base::size(expected1)));
EXPECT_LE(1410, matches_[0].relevance);
EXPECT_LT(matches_[0].relevance, 1420);
// It uses the default scoring.
@@ -909,8 +893,8 @@
{ "http://moo/b", true },
{ "http://moo/bar", true }
};
- ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16("moo/b"), std::string(), false,
- expected2, base::size(expected2)));
+ ASSERT_NO_FATAL_FAILURE(RunTest(u"moo/b", std::string(), false, expected2,
+ base::size(expected2)));
// The url what you typed match should be around 1400, otherwise the
// search what you typed match is going to be first.
EXPECT_LE(1400, matches_[0].relevance);
@@ -919,43 +903,40 @@
const UrlAndLegalDefault expected3[] = {{"http://intra/three", true},
{"http://intra/one", true},
{"http://intra/two", true}};
- RunTest(ASCIIToUTF16("intra"), std::string(), false, expected3,
- base::size(expected3));
+ RunTest(u"intra", std::string(), false, expected3, base::size(expected3));
const UrlAndLegalDefault expected4[] = {{"http://intra/three", true},
{"http://intra/one", true},
{"http://intra/two", true}};
- RunTest(ASCIIToUTF16("intra/"), std::string(), false, expected4,
- base::size(expected4));
+ RunTest(u"intra/", std::string(), false, expected4, base::size(expected4));
const UrlAndLegalDefault expected5[] = {
{ "http://intra/one", true }
};
- ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16("intra/o"), std::string(), false,
- expected5, base::size(expected5)));
+ ASSERT_NO_FATAL_FAILURE(RunTest(u"intra/o", std::string(), false, expected5,
+ base::size(expected5)));
EXPECT_LE(1410, matches_[0].relevance);
EXPECT_LT(matches_[0].relevance, 1420);
const UrlAndLegalDefault expected6[] = {
{ "http://intra/x", true }
};
- ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16("intra/x"), std::string(), false,
- expected6, base::size(expected6)));
+ ASSERT_NO_FATAL_FAILURE(RunTest(u"intra/x", std::string(), false, expected6,
+ base::size(expected6)));
EXPECT_LE(1400, matches_[0].relevance);
EXPECT_LT(matches_[0].relevance, 1410);
const UrlAndLegalDefault expected7[] = {
{ "http://typedhost/untypedpath", true }
};
- ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16("typedhost/untypedpath"),
- std::string(), false, expected7,
- base::size(expected7)));
+ ASSERT_NO_FATAL_FAILURE(RunTest(u"typedhost/untypedpath", std::string(),
+ false, expected7, base::size(expected7)));
EXPECT_LE(1400, matches_[0].relevance);
EXPECT_LT(matches_[0].relevance, 1410);
const UrlAndLegalDefault expected8[] = {{"https://www.prefixintra/x", true}};
- ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16("prefixintra/x"), std::string(),
- false, expected8, base::size(expected8)));
+ ASSERT_NO_FATAL_FAILURE(RunTest(u"prefixintra/x", std::string(), false,
+ expected8, base::size(expected8)));
}
TEST_F(HistoryURLProviderTest, CrashDueToFixup) {
@@ -976,8 +957,7 @@
}
TEST_F(HistoryURLProviderTest, DoesNotProvideMatchesOnFocus) {
- AutocompleteInput input(ASCIIToUTF16("foo"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"foo", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
input.set_focus_type(OmniboxFocusType::ON_FOCUS);
autocomplete_->Start(input, false);
@@ -990,22 +970,22 @@
const UrlAndLegalDefault expected1_true[] = {
{ "http://puny.xn--h2by8byc123p.in/", true },
};
- RunTest(ASCIIToUTF16("pun"), std::string(), false, expected1_true,
+ RunTest(u"pun", std::string(), false, expected1_true,
base::size(expected1_true));
- RunTest(ASCIIToUTF16("puny."), std::string(), false, expected1_true,
+ RunTest(u"puny.", std::string(), false, expected1_true,
base::size(expected1_true));
- RunTest(ASCIIToUTF16("puny.x"), std::string(), false, expected1_true,
+ RunTest(u"puny.x", std::string(), false, expected1_true,
base::size(expected1_true));
- RunTest(ASCIIToUTF16("puny.xn"), std::string(), false, expected1_true,
+ RunTest(u"puny.xn", std::string(), false, expected1_true,
base::size(expected1_true));
- RunTest(ASCIIToUTF16("puny.xn--"), std::string(), false, expected1_true,
+ RunTest(u"puny.xn--", std::string(), false, expected1_true,
base::size(expected1_true));
- RunTest(ASCIIToUTF16("puny.xn--h2"), std::string(), false, expected1_true,
+ RunTest(u"puny.xn--h2", std::string(), false, expected1_true,
base::size(expected1_true));
- RunTest(ASCIIToUTF16("puny.xn--h2by8byc123p"), std::string(), false,
- expected1_true, base::size(expected1_true));
- RunTest(ASCIIToUTF16("puny.xn--h2by8byc123p."), std::string(), false,
- expected1_true, base::size(expected1_true));
+ RunTest(u"puny.xn--h2by8byc123p", std::string(), false, expected1_true,
+ base::size(expected1_true));
+ RunTest(u"puny.xn--h2by8byc123p.", std::string(), false, expected1_true,
+ base::size(expected1_true));
// When the punycode part of the URL is rendered as international characters,
// this match should not be allowed to be the default match if the inline
@@ -1016,29 +996,29 @@
const UrlAndLegalDefault expected2_false[] = {
{ "http://two_puny.xn--1lq90ic7f1rc.cn/", false },
};
- RunTest(ASCIIToUTF16("two"), std::string(), false, expected2_true,
+ RunTest(u"two", std::string(), false, expected2_true,
base::size(expected2_true));
- RunTest(ASCIIToUTF16("two_puny."), std::string(), false, expected2_true,
+ RunTest(u"two_puny.", std::string(), false, expected2_true,
base::size(expected2_true));
- RunTest(ASCIIToUTF16("two_puny.x"), std::string(), false, expected2_false,
+ RunTest(u"two_puny.x", std::string(), false, expected2_false,
base::size(expected2_false));
- RunTest(ASCIIToUTF16("two_puny.xn"), std::string(), false, expected2_false,
+ RunTest(u"two_puny.xn", std::string(), false, expected2_false,
base::size(expected2_false));
- RunTest(ASCIIToUTF16("two_puny.xn--"), std::string(), false, expected2_false,
+ RunTest(u"two_puny.xn--", std::string(), false, expected2_false,
base::size(expected2_false));
- RunTest(ASCIIToUTF16("two_puny.xn--1l"), std::string(), false,
- expected2_false, base::size(expected2_false));
- RunTest(ASCIIToUTF16("two_puny.xn--1lq90ic7f1rc"), std::string(), false,
- expected2_true, base::size(expected2_true));
- RunTest(ASCIIToUTF16("two_puny.xn--1lq90ic7f1rc."), std::string(), false,
- expected2_true, base::size(expected2_true));
+ RunTest(u"two_puny.xn--1l", std::string(), false, expected2_false,
+ base::size(expected2_false));
+ RunTest(u"two_puny.xn--1lq90ic7f1rc", std::string(), false, expected2_true,
+ base::size(expected2_true));
+ RunTest(u"two_puny.xn--1lq90ic7f1rc.", std::string(), false, expected2_true,
+ base::size(expected2_true));
}
TEST_F(HistoryURLProviderTest, CullSearchResults) {
// Set up a default search engine.
TemplateURLData data;
- data.SetShortName(ASCIIToUTF16("TestEngine"));
- data.SetKeyword(ASCIIToUTF16("TestEngine"));
+ data.SetShortName(u"TestEngine");
+ data.SetKeyword(u"TestEngine");
data.SetURL("http://testsearch.com/?q={searchTerms}");
TemplateURLService* template_url_service = client_->GetTemplateURLService();
TemplateURL* template_url =
@@ -1068,16 +1048,14 @@
const UrlAndLegalDefault expected_when_searching_query[] = {
{ test_cases[2].url, false }
};
- RunTest(ASCIIToUTF16("foobar"), std::string(), true,
- expected_when_searching_query,
+ RunTest(u"foobar", std::string(), true, expected_when_searching_query,
base::size(expected_when_searching_query));
// We should not see search URLs when typing the search engine name.
const UrlAndLegalDefault expected_when_searching_site[] = {
{ test_cases[0].url, false }
};
- RunTest(ASCIIToUTF16("testsearch"), std::string(), true,
- expected_when_searching_site,
+ RunTest(u"testsearch", std::string(), true, expected_when_searching_site,
base::size(expected_when_searching_site));
}
@@ -1329,7 +1307,7 @@
BuildHistoryURLProviderParams("face", "http://www.facebook.com", false);
AutocompleteMatch match = autocomplete_->HistoryMatchToACMatch(*params, 0, 0);
- EXPECT_EQ(ASCIIToUTF16("facebook.com"), match.contents);
+ EXPECT_EQ(u"facebook.com", match.contents);
}
// Make sure "http://" scheme is not trimmed if input has a scheme too.
@@ -1338,7 +1316,7 @@
"http://www.facebook.com", false);
AutocompleteMatch match = autocomplete_->HistoryMatchToACMatch(*params, 0, 0);
- EXPECT_EQ(ASCIIToUTF16("http://facebook.com"), match.contents);
+ EXPECT_EQ(u"http://facebook.com", match.contents);
}
// Make sure "http://" scheme is not trimmed if input matches in scheme.
@@ -1347,7 +1325,7 @@
BuildHistoryURLProviderParams("ht face", "http://www.facebook.com", true);
AutocompleteMatch match = autocomplete_->HistoryMatchToACMatch(*params, 0, 0);
- EXPECT_EQ(ASCIIToUTF16("http://facebook.com"), match.contents);
+ EXPECT_EQ(u"http://facebook.com", match.contents);
}
// Make sure "https://" scheme is not trimmed if the input has a scheme.
@@ -1356,7 +1334,7 @@
"https://face", "https://www.facebook.com", false);
AutocompleteMatch match = autocomplete_->HistoryMatchToACMatch(*params, 0, 0);
- EXPECT_EQ(ASCIIToUTF16("https://facebook.com"), match.contents);
+ EXPECT_EQ(u"https://facebook.com", match.contents);
}
// Make sure "https://" scheme is trimmed if nothing prevents it.
@@ -1365,7 +1343,7 @@
BuildHistoryURLProviderParams("face", "https://www.facebook.com", false);
AutocompleteMatch match = autocomplete_->HistoryMatchToACMatch(*params, 0, 0);
- EXPECT_EQ(ASCIIToUTF16("facebook.com"), match.contents);
+ EXPECT_EQ(u"facebook.com", match.contents);
}
class VisitTransitionHelper : public history::HistoryDBTask {
@@ -1433,8 +1411,8 @@
const UrlAndLegalDefault expected[] = {{"http://recentuntyped.com/", true},
{"http://recentuntyped.com/x", true}};
const GURL url("http://recentuntyped.com/x");
- ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16("recentunt"), std::string(),
- false, expected, base::size(expected)));
+ ASSERT_NO_FATAL_FAILURE(RunTest(u"recentunt", std::string(), false, expected,
+ base::size(expected)));
ASSERT_TRUE(VisitTransitionHelper::MakeVisitsHaveApiTransition(
client_->GetHistoryService(), url, ui::PAGE_TRANSITION_FROM_API_2));
@@ -1446,5 +1424,5 @@
// returned earlier is because of the query string and how HistoryURLProvider
// works.
ASSERT_NO_FATAL_FAILURE(
- RunTest(ASCIIToUTF16("recentunt"), std::string(), false, nullptr, 0));
+ RunTest(u"recentunt", std::string(), false, nullptr, 0));
}
diff --git a/components/omnibox/browser/in_memory_url_index_types_unittest.cc b/components/omnibox/browser/in_memory_url_index_types_unittest.cc
index 58fd088..899c3f04 100644
--- a/components/omnibox/browser/in_memory_url_index_types_unittest.cc
+++ b/components/omnibox/browser/in_memory_url_index_types_unittest.cc
@@ -90,8 +90,7 @@
actual_starts_d));
// Test String16SetFromString16
- std::u16string string_e(
- base::ASCIIToUTF16("http://web.google.com/search Google Web Search"));
+ std::u16string string_e(u"http://web.google.com/search Google Web Search");
WordStarts actual_starts_e;
String16Set string_set = String16SetFromString16(string_e, &actual_starts_e);
EXPECT_EQ(5U, string_set.size());
diff --git a/components/omnibox/browser/in_memory_url_index_unittest.cc b/components/omnibox/browser/in_memory_url_index_unittest.cc
index e6f7620d..d180f60d 100644
--- a/components/omnibox/browser/in_memory_url_index_unittest.cc
+++ b/components/omnibox/browser/in_memory_url_index_unittest.cc
@@ -83,7 +83,7 @@
*lower_string = base::i18n::ToLower(ASCIIToUTF16(search_string));
if ((cursor_position != kInvalid) &&
(cursor_position < lower_string->length()) && (cursor_position > 0)) {
- lower_string->insert(cursor_position, base::ASCIIToUTF16(" "));
+ lower_string->insert(cursor_position, u" ");
}
*lower_terms = base::SplitString(*lower_string, base::kWhitespaceUTF16,
@@ -487,62 +487,58 @@
new_row.set_hidden(true);
EXPECT_FALSE(UpdateURL(new_row));
- EXPECT_EQ(
- 0U, url_index_
- ->HistoryItemsForTerms(ASCIIToUTF16("hidden"),
- std::u16string::npos, kProviderMaxMatches)
- .size());
+ EXPECT_EQ(0U, url_index_
+ ->HistoryItemsForTerms(u"hidden", std::u16string::npos,
+ kProviderMaxMatches)
+ .size());
}
TEST_F(InMemoryURLIndexTest, DISABLED_Retrieval) {
// See if a very specific term gives a single result.
ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("DrudgeReport"), std::u16string::npos, kProviderMaxMatches);
+ u"DrudgeReport", std::u16string::npos, kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
// Verify that we got back the result we expected.
EXPECT_EQ(5, matches[0].url_info.id());
EXPECT_EQ("http://drudgereport.com/", matches[0].url_info.url().spec());
- EXPECT_EQ(ASCIIToUTF16("DRUDGE REPORT 2010"), matches[0].url_info.title());
+ EXPECT_EQ(u"DRUDGE REPORT 2010", matches[0].url_info.title());
// Make sure a trailing space still results in the expected result.
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("DrudgeReport "), std::u16string::npos, kProviderMaxMatches);
+ u"DrudgeReport ", std::u16string::npos, kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
EXPECT_EQ(5, matches[0].url_info.id());
EXPECT_EQ("http://drudgereport.com/", matches[0].url_info.url().spec());
- EXPECT_EQ(ASCIIToUTF16("DRUDGE REPORT 2010"), matches[0].url_info.title());
+ EXPECT_EQ(u"DRUDGE REPORT 2010", matches[0].url_info.title());
// Search which should result in multiple results.
- matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("drudge"), std::u16string::npos, kProviderMaxMatches);
+ matches = url_index_->HistoryItemsForTerms(u"drudge", std::u16string::npos,
+ kProviderMaxMatches);
ASSERT_EQ(2U, matches.size());
// The results should be in descending score order.
EXPECT_GE(matches[0].raw_score, matches[1].raw_score);
// Search which should result in nearly perfect result.
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("Nearly Perfect Result"), std::u16string::npos,
- kProviderMaxMatches);
+ u"Nearly Perfect Result", std::u16string::npos, kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
// The results should have a very high score.
EXPECT_GT(matches[0].raw_score, 900);
EXPECT_EQ(32, matches[0].url_info.id());
EXPECT_EQ("https://nearlyperfectresult.com/",
matches[0].url_info.url().spec()); // Note: URL gets lowercased.
- EXPECT_EQ(ASCIIToUTF16("Practically Perfect Search Result"),
- matches[0].url_info.title());
+ EXPECT_EQ(u"Practically Perfect Search Result", matches[0].url_info.title());
// Search which should result in very poor result. (It's a mid-word match
// in a hostname.) No results since it will be suppressed by default scoring.
- matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("heinqui"), std::u16string::npos, kProviderMaxMatches);
+ matches = url_index_->HistoryItemsForTerms(u"heinqui", std::u16string::npos,
+ kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
// But if the user adds a term that matches well against the same result,
// the result should be returned.
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("heinqui microprocessor"), std::u16string::npos,
- kProviderMaxMatches);
+ u"heinqui microprocessor", std::u16string::npos, kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
EXPECT_EQ(18, matches[0].url_info.id());
EXPECT_EQ("http://www.theinquirer.net/", matches[0].url_info.url().spec());
@@ -551,77 +547,75 @@
matches[0].url_info.title());
// A URL that comes from the default search engine should not be returned.
- matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("query"), std::u16string::npos, kProviderMaxMatches);
+ matches = url_index_->HistoryItemsForTerms(u"query", std::u16string::npos,
+ kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
// But if it's not from the default search engine, it should be returned.
TemplateURL* template_url = template_url_service_->GetTemplateURLForKeyword(
base::ASCIIToUTF16(kNonDefaultTemplateURLKeyword));
template_url_service_->SetUserSelectedDefaultSearchProvider(template_url);
- matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("query"), std::u16string::npos, kProviderMaxMatches);
+ matches = url_index_->HistoryItemsForTerms(u"query", std::u16string::npos,
+ kProviderMaxMatches);
EXPECT_EQ(1U, matches.size());
// Search which will match at the end of an URL with encoded characters.
- matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("Mice"), std::u16string::npos, kProviderMaxMatches);
+ matches = url_index_->HistoryItemsForTerms(u"Mice", std::u16string::npos,
+ kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
EXPECT_EQ(30, matches[0].url_info.id());
// Check that URLs are not escaped an extra time.
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("1% wikipedia"), std::u16string::npos, kProviderMaxMatches);
+ u"1% wikipedia", std::u16string::npos, kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
EXPECT_EQ(35, matches[0].url_info.id());
EXPECT_EQ("http://en.wikipedia.org/wiki/1%25_rule_(Internet_culture)",
matches[0].url_info.url().spec());
// Verify that a single term can appear multiple times in the URL.
- matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("fubar"), std::u16string::npos, kProviderMaxMatches);
+ matches = url_index_->HistoryItemsForTerms(u"fubar", std::u16string::npos,
+ kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
EXPECT_EQ(34, matches[0].url_info.id());
EXPECT_EQ("http://fubarfubarandfubar.com/", matches[0].url_info.url().spec());
- EXPECT_EQ(ASCIIToUTF16("Situation Normal -- FUBARED"),
- matches[0].url_info.title());
+ EXPECT_EQ(u"Situation Normal -- FUBARED", matches[0].url_info.title());
}
TEST_F(InMemoryURLIndexTest, CursorPositionRetrieval) {
// See if a very specific term with no cursor gives an empty result.
ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("DrudReport"), std::u16string::npos, kProviderMaxMatches);
+ u"DrudReport", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
// The same test with the cursor at the end should give an empty result.
- matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("DrudReport"), 10u,
- kProviderMaxMatches);
+ matches =
+ url_index_->HistoryItemsForTerms(u"DrudReport", 10u, kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
// If the cursor is between Drud and Report, we should find the desired
// result.
- matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("DrudReport"), 4u,
- kProviderMaxMatches);
+ matches =
+ url_index_->HistoryItemsForTerms(u"DrudReport", 4u, kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
EXPECT_EQ("http://drudgereport.com/", matches[0].url_info.url().spec());
- EXPECT_EQ(ASCIIToUTF16("DRUDGE REPORT 2010"), matches[0].url_info.title());
+ EXPECT_EQ(u"DRUDGE REPORT 2010", matches[0].url_info.title());
// Now check multi-word inputs. No cursor should fail to find a
// result on this input.
- matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("MORTGAGERATE DROPS"),
- std::u16string::npos,
- kProviderMaxMatches);
+ matches = url_index_->HistoryItemsForTerms(
+ u"MORTGAGERATE DROPS", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
// Ditto with cursor at end.
- matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("MORTGAGERATE DROPS"),
- 18u, kProviderMaxMatches);
+ matches = url_index_->HistoryItemsForTerms(u"MORTGAGERATE DROPS", 18u,
+ kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
// If the cursor is between MORTAGE And RATE, we should find the
// desired result.
- matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("MORTGAGERATE DROPS"),
- 8u, kProviderMaxMatches);
+ matches = url_index_->HistoryItemsForTerms(u"MORTGAGERATE DROPS", 8u,
+ kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
EXPECT_EQ("http://www.reuters.com/article/idUSN0839880620100708",
matches[0].url_info.url().spec());
@@ -633,54 +627,53 @@
TEST_F(InMemoryURLIndexTest, URLPrefixMatching) {
// "drudgere" - found
ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("drudgere"), std::u16string::npos, kProviderMaxMatches);
+ u"drudgere", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(1U, matches.size());
// "www.atdmt" - not found
- matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("www.atdmt"), std::u16string::npos, kProviderMaxMatches);
+ matches = url_index_->HistoryItemsForTerms(u"www.atdmt", std::u16string::npos,
+ kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
// "atdmt" - found
- matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("atdmt"), std::u16string::npos, kProviderMaxMatches);
+ matches = url_index_->HistoryItemsForTerms(u"atdmt", std::u16string::npos,
+ kProviderMaxMatches);
EXPECT_EQ(1U, matches.size());
// "view.atdmt" - found
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("view.atdmt"), std::u16string::npos, kProviderMaxMatches);
+ u"view.atdmt", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(1U, matches.size());
// "view.atdmt" - found
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("view.atdmt"), std::u16string::npos, kProviderMaxMatches);
+ u"view.atdmt", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(1U, matches.size());
// "cnn.com" - found
- matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("cnn.com"), std::u16string::npos, kProviderMaxMatches);
+ matches = url_index_->HistoryItemsForTerms(u"cnn.com", std::u16string::npos,
+ kProviderMaxMatches);
EXPECT_EQ(2U, matches.size());
// "www.cnn.com" - found
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("www.cnn.com"), std::u16string::npos, kProviderMaxMatches);
+ u"www.cnn.com", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(1U, matches.size());
// "ww.cnn.com" - found because we suppress mid-term matches.
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("ww.cnn.com"), std::u16string::npos, kProviderMaxMatches);
+ u"ww.cnn.com", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
// "www.cnn.com" - found
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("www.cnn.com"), std::u16string::npos, kProviderMaxMatches);
+ u"www.cnn.com", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(1U, matches.size());
// "tp://www.cnn.com" - not found because we don't allow tp as a mid-term
// match
- matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("tp://www.cnn.com"),
- std::u16string::npos,
- kProviderMaxMatches);
+ matches = url_index_->HistoryItemsForTerms(
+ u"tp://www.cnn.com", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
}
@@ -688,7 +681,7 @@
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(omnibox::kHideVisitsFromCct);
ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("QuiteUseless"), std::u16string::npos, kProviderMaxMatches);
+ u"QuiteUseless", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(1U, matches.size());
sql::Statement s(GetDB().GetUniqueStatement(
@@ -697,7 +690,7 @@
ASSERT_TRUE(s.Run());
RebuildFromHistory();
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("QuiteUseless"), std::u16string::npos, kProviderMaxMatches);
+ u"QuiteUseless", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
}
@@ -705,7 +698,7 @@
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(omnibox::kHideVisitsFromCct);
ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("urlnotindb"), std::u16string::npos, kProviderMaxMatches);
+ u"urlnotindb", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
// Do this history::kLowQualityMatchVisitLimit times to ensure the visit
@@ -724,7 +717,7 @@
}
}
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("urlnotindb"), std::u16string::npos, kProviderMaxMatches);
+ u"urlnotindb", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
}
@@ -732,7 +725,7 @@
base::test::ScopedFeatureList feature_list;
feature_list.InitAndEnableFeature(omnibox::kHideVisitsFromCct);
ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("urlnotindb"), std::u16string::npos, kProviderMaxMatches);
+ u"urlnotindb", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
// Add the history::kLowQualityMatchVisitLimit visits to ensure the visit
@@ -753,12 +746,11 @@
// There should not be an entry.
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("urlnotindb"), std::u16string::npos, kProviderMaxMatches);
+ u"urlnotindb", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
// Change the title.
- history_service_->SetPageTitle(GURL("http://urlnotindb.com"),
- ASCIIToUTF16("urlnotindb"));
+ history_service_->SetPageTitle(GURL("http://urlnotindb.com"), u"urlnotindb");
// Flush twice as the first ensures HistoryServiceObservers are run, and
// the second for the task scheduled by URLIndexPrivateData.
for (int j = 0; j < 2; ++j) {
@@ -769,7 +761,7 @@
// Entry should still not have been added.
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("urlnotindb"), std::u16string::npos, kProviderMaxMatches);
+ u"urlnotindb", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
}
@@ -779,13 +771,13 @@
// "atdmt.view" - not found
// "view.atdmt" - found
ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("atdmt view"), std::u16string::npos, kProviderMaxMatches);
+ u"atdmt view", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(1U, matches.size());
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("atdmt.view"), std::u16string::npos, kProviderMaxMatches);
+ u"atdmt.view", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("view.atdmt"), std::u16string::npos, kProviderMaxMatches);
+ u"view.atdmt", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(1U, matches.size());
}
@@ -899,7 +891,7 @@
}
ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("b"), std::u16string::npos, kProviderMaxMatches);
+ u"b", std::u16string::npos, kProviderMaxMatches);
EXPECT_EQ(kProviderMaxMatches, matches.size());
}
@@ -909,8 +901,7 @@
// Ensure title is being searched.
ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("MORTGAGE RATE DROPS"), std::u16string::npos,
- kProviderMaxMatches);
+ u"MORTGAGE RATE DROPS", std::u16string::npos, kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
// Verify that we got back the result we expected.
@@ -924,8 +915,7 @@
TEST_F(InMemoryURLIndexTest, TitleChange) {
// Verify current title terms retrieves desired item.
- std::u16string original_terms =
- ASCIIToUTF16("lebronomics could high taxes influence");
+ std::u16string original_terms = u"lebronomics could high taxes influence";
ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
original_terms, std::u16string::npos, kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
@@ -941,13 +931,13 @@
history::URLRow old_row(matches[0].url_info);
// Verify new title terms retrieves nothing.
- std::u16string new_terms = ASCIIToUTF16("does eat oats little lambs ivy");
+ std::u16string new_terms = u"does eat oats little lambs ivy";
matches = url_index_->HistoryItemsForTerms(new_terms, std::u16string::npos,
kProviderMaxMatches);
EXPECT_EQ(0U, matches.size());
// Update the row.
- old_row.set_title(ASCIIToUTF16("Does eat oats and little lambs eat ivy"));
+ old_row.set_title(u"Does eat oats and little lambs eat ivy");
EXPECT_TRUE(UpdateURL(old_row));
// Verify we get the row using the new terms but not the original terms.
@@ -964,29 +954,29 @@
// The presence of duplicate characters should succeed. Exercise by cycling
// through a string with several duplicate characters.
ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("ABRA"), std::u16string::npos, kProviderMaxMatches);
+ u"ABRA", std::u16string::npos, kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
EXPECT_EQ(28, matches[0].url_info.id());
EXPECT_EQ("http://www.ddj.com/windows/184416623",
matches[0].url_info.url().spec());
- matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("ABRACAD"), std::u16string::npos, kProviderMaxMatches);
+ matches = url_index_->HistoryItemsForTerms(u"ABRACAD", std::u16string::npos,
+ kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
EXPECT_EQ(28, matches[0].url_info.id());
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("ABRACADABRA"), std::u16string::npos, kProviderMaxMatches);
+ u"ABRACADABRA", std::u16string::npos, kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
EXPECT_EQ(28, matches[0].url_info.id());
matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("ABRACADABR"), std::u16string::npos, kProviderMaxMatches);
+ u"ABRACADABR", std::u16string::npos, kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
EXPECT_EQ(28, matches[0].url_info.id());
- matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("ABRACA"), std::u16string::npos, kProviderMaxMatches);
+ matches = url_index_->HistoryItemsForTerms(u"ABRACA", std::u16string::npos,
+ kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
EXPECT_EQ(28, matches[0].url_info.id());
}
@@ -1007,48 +997,48 @@
// Simulate typing "r" giving "r" in the simulated omnibox. The results for
// 'r' will be not cached because it is only 1 character long.
- url_index_->HistoryItemsForTerms(ASCIIToUTF16("r"), std::u16string::npos,
+ url_index_->HistoryItemsForTerms(u"r", std::u16string::npos,
kProviderMaxMatches);
EXPECT_EQ(0U, cache.size());
// Simulate typing "re" giving "r re" in the simulated omnibox.
// 're' should be cached at this point but not 'r' as it is a single
// character.
- url_index_->HistoryItemsForTerms(ASCIIToUTF16("r re"), std::u16string::npos,
+ url_index_->HistoryItemsForTerms(u"r re", std::u16string::npos,
kProviderMaxMatches);
ASSERT_EQ(1U, cache.size());
- CheckTerm(cache, ASCIIToUTF16("re"));
+ CheckTerm(cache, u"re");
// Simulate typing "reco" giving "r re reco" in the simulated omnibox.
// 're' and 'reco' should be cached at this point but not 'r' as it is a
// single character.
- url_index_->HistoryItemsForTerms(ASCIIToUTF16("r re reco"),
- std::u16string::npos, kProviderMaxMatches);
+ url_index_->HistoryItemsForTerms(u"r re reco", std::u16string::npos,
+ kProviderMaxMatches);
ASSERT_EQ(2U, cache.size());
- CheckTerm(cache, ASCIIToUTF16("re"));
- CheckTerm(cache, ASCIIToUTF16("reco"));
+ CheckTerm(cache, u"re");
+ CheckTerm(cache, u"reco");
// Simulate typing "mort".
// Since we now have only one search term, the cached results for 're' and
// 'reco' should be purged, giving us only 1 item in the cache (for 'mort').
- url_index_->HistoryItemsForTerms(ASCIIToUTF16("mort"), std::u16string::npos,
+ url_index_->HistoryItemsForTerms(u"mort", std::u16string::npos,
kProviderMaxMatches);
ASSERT_EQ(1U, cache.size());
- CheckTerm(cache, ASCIIToUTF16("mort"));
+ CheckTerm(cache, u"mort");
// Simulate typing "reco" giving "mort reco" in the simulated omnibox.
- url_index_->HistoryItemsForTerms(ASCIIToUTF16("mort reco"),
- std::u16string::npos, kProviderMaxMatches);
+ url_index_->HistoryItemsForTerms(u"mort reco", std::u16string::npos,
+ kProviderMaxMatches);
ASSERT_EQ(2U, cache.size());
- CheckTerm(cache, ASCIIToUTF16("mort"));
- CheckTerm(cache, ASCIIToUTF16("reco"));
+ CheckTerm(cache, u"mort");
+ CheckTerm(cache, u"reco");
// Simulate a <DELETE> by removing the 'reco' and adding back the 'rec'.
- url_index_->HistoryItemsForTerms(ASCIIToUTF16("mort rec"),
- std::u16string::npos, kProviderMaxMatches);
+ url_index_->HistoryItemsForTerms(u"mort rec", std::u16string::npos,
+ kProviderMaxMatches);
ASSERT_EQ(2U, cache.size());
- CheckTerm(cache, ASCIIToUTF16("mort"));
- CheckTerm(cache, ASCIIToUTF16("rec"));
+ CheckTerm(cache, u"mort");
+ CheckTerm(cache, u"rec");
}
TEST_F(InMemoryURLIndexTest, DISABLED_AddNewRows) {
@@ -1058,8 +1048,7 @@
// should
// qualify as a quick result candidate.
EXPECT_TRUE(url_index_
- ->HistoryItemsForTerms(ASCIIToUTF16("brokeandalone"),
- std::u16string::npos,
+ ->HistoryItemsForTerms(u"brokeandalone", std::u16string::npos,
kProviderMaxMatches)
.empty());
@@ -1070,20 +1059,20 @@
EXPECT_TRUE(UpdateURL(new_row));
// Verify that we can retrieve it.
- EXPECT_EQ(
- 1U, url_index_
- ->HistoryItemsForTerms(ASCIIToUTF16("brokeandalone"),
- std::u16string::npos, kProviderMaxMatches)
- .size());
+ EXPECT_EQ(1U,
+ url_index_
+ ->HistoryItemsForTerms(u"brokeandalone", std::u16string::npos,
+ kProviderMaxMatches)
+ .size());
// Add it again just to be sure that is harmless and that it does not update
// the index.
EXPECT_FALSE(UpdateURL(new_row));
- EXPECT_EQ(
- 1U, url_index_
- ->HistoryItemsForTerms(ASCIIToUTF16("brokeandalone"),
- std::u16string::npos, kProviderMaxMatches)
- .size());
+ EXPECT_EQ(1U,
+ url_index_
+ ->HistoryItemsForTerms(u"brokeandalone", std::u16string::npos,
+ kProviderMaxMatches)
+ .size());
// Make up an URL that does not qualify and try to add it.
history::URLRow unqualified_row(
@@ -1093,14 +1082,13 @@
TEST_F(InMemoryURLIndexTest, DeleteRows) {
ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("DrudgeReport"), std::u16string::npos, kProviderMaxMatches);
+ u"DrudgeReport", std::u16string::npos, kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
// Delete the URL then search again.
EXPECT_TRUE(DeleteURL(matches[0].url_info.url()));
EXPECT_TRUE(url_index_
- ->HistoryItemsForTerms(ASCIIToUTF16("DrudgeReport"),
- std::u16string::npos,
+ ->HistoryItemsForTerms(u"DrudgeReport", std::u16string::npos,
kProviderMaxMatches)
.empty());
@@ -1111,7 +1099,7 @@
TEST_F(InMemoryURLIndexTest, ExpireRow) {
ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
- ASCIIToUTF16("DrudgeReport"), std::u16string::npos, kProviderMaxMatches);
+ u"DrudgeReport", std::u16string::npos, kProviderMaxMatches);
ASSERT_EQ(1U, matches.size());
// Determine the row id for the result, remember that id, broadcast a
@@ -1121,8 +1109,7 @@
url_index_->OnURLsDeleted(
nullptr, history::DeletionInfo::ForUrls(deleted_rows, std::set<GURL>()));
EXPECT_TRUE(url_index_
- ->HistoryItemsForTerms(ASCIIToUTF16("DrudgeReport"),
- std::u16string::npos,
+ ->HistoryItemsForTerms(u"DrudgeReport", std::u16string::npos,
kProviderMaxMatches)
.empty());
}
diff --git a/components/omnibox/browser/keyword_provider.cc b/components/omnibox/browser/keyword_provider.cc
index 19f594e..23393a1 100644
--- a/components/omnibox/browser/keyword_provider.cc
+++ b/components/omnibox/browser/keyword_provider.cc
@@ -570,7 +570,7 @@
if (template_url_service->GetTemplateURLForKeyword(result) != nullptr)
return result;
// Many schemes usually have "//" after them, so strip it too.
- const std::u16string after_scheme(base::ASCIIToUTF16("//"));
+ const std::u16string after_scheme(u"//");
if (result.compare(0, after_scheme.length(), after_scheme) == 0)
result.erase(0, after_scheme.length());
if (template_url_service->GetTemplateURLForKeyword(result) != nullptr)
@@ -581,7 +581,7 @@
// The 'www.' stripping is done directly here instead of calling
// url_formatter::StripWWW because we're not assuming that the keyword is a
// hostname.
- const std::u16string kWww(base::ASCIIToUTF16("www."));
+ const std::u16string kWww(u"www.");
constexpr size_t kWwwLength = 4;
result = base::StartsWith(result, kWww, base::CompareCase::SENSITIVE)
? result.substr(kWwwLength)
diff --git a/components/omnibox/browser/keyword_provider_unittest.cc b/components/omnibox/browser/keyword_provider_unittest.cc
index f98dd2df..3fd5882 100644
--- a/components/omnibox/browser/keyword_provider_unittest.cc
+++ b/components/omnibox/browser/keyword_provider_unittest.cc
@@ -164,102 +164,72 @@
const MatchType<std::u16string> kEmptyMatch = {std::u16string(), false};
TestData<std::u16string> edit_cases[] = {
// Searching for a nonexistent prefix should give nothing.
- {ASCIIToUTF16("Not Found"), 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("aaaaaNot Found"),
- 0,
- {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
+ {u"Not Found", 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
+ {u"aaaaaNot Found", 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
// Check that tokenization only collapses whitespace between first tokens,
// no-query-input cases have a space appended, and action is not escaped.
- {ASCIIToUTF16("z"),
- 1,
- {{ASCIIToUTF16("z "), true}, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("z \t"),
- 1,
- {{ASCIIToUTF16("z "), true}, kEmptyMatch, kEmptyMatch}},
+ {u"z", 1, {{u"z ", true}, kEmptyMatch, kEmptyMatch}},
+ {u"z \t", 1, {{u"z ", true}, kEmptyMatch, kEmptyMatch}},
// Check that exact, substituting keywords with a verbatim search term
// don't generate a result. (These are handled by SearchProvider.)
- {ASCIIToUTF16("z foo"), 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("z a b c++"),
- 0,
- {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
+ {u"z foo", 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
+ {u"z a b c++", 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
// Matches should be limited to three, and sorted in quality order, not
// alphabetical.
- {ASCIIToUTF16("aaa"),
- 2,
- {{ASCIIToUTF16("aaaa "), false},
- {ASCIIToUTF16("aaaaa "), false},
- kEmptyMatch}},
- {ASCIIToUTF16("a 1 2 3"),
+ {u"aaa", 2, {{u"aaaa ", false}, {u"aaaaa ", false}, kEmptyMatch}},
+ {u"a 1 2 3",
3,
- {{ASCIIToUTF16("aa 1 2 3"), false},
- {ASCIIToUTF16("ab 1 2 3"), false},
- {ASCIIToUTF16("aaaa 1 2 3"), false}}},
- {ASCIIToUTF16("www.a"),
- 3,
- {{ASCIIToUTF16("aa "), false},
- {ASCIIToUTF16("ab "), false},
- {ASCIIToUTF16("aaaa "), false}}},
- {ASCIIToUTF16("foo hello"),
+ {{u"aa 1 2 3", false}, {u"ab 1 2 3", false}, {u"aaaa 1 2 3", false}}},
+ {u"www.a", 3, {{u"aa ", false}, {u"ab ", false}, {u"aaaa ", false}}},
+ {u"foo hello",
2,
- {{ASCIIToUTF16("fooshort.com hello"), false},
- {ASCIIToUTF16("foolong.co.uk hello"), false},
+ {{u"fooshort.com hello", false},
+ {u"foolong.co.uk hello", false},
kEmptyMatch}},
// Exact matches should prevent returning inexact matches. Also, the
// verbatim query for this keyword match should not be returned. (It's
// returned by SearchProvider.)
- {ASCIIToUTF16("aaaa foo"), 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("www.aaaa foo"),
- 0,
- {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
+ {u"aaaa foo", 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
+ {u"www.aaaa foo", 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
// Matches should be retrieved by typing the prefix of the keyword, not
// the
// domain name.
- {ASCIIToUTF16("host foo"),
+ {u"host foo",
1,
- {{ASCIIToUTF16("host.site.com foo"), false}, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("host.site foo"),
+ {{u"host.site.com foo", false}, kEmptyMatch, kEmptyMatch}},
+ {u"host.site foo",
1,
- {{ASCIIToUTF16("host.site.com foo"), false}, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("site foo"), 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
+ {{u"host.site.com foo", false}, kEmptyMatch, kEmptyMatch}},
+ {u"site foo", 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
// Clean up keyword input properly. "http" and "https" are the only
// allowed schemes.
- {ASCIIToUTF16("www"),
- 1,
- {{ASCIIToUTF16("www "), true}, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("www."), 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
+ {u"www", 1, {{u"www ", true}, kEmptyMatch, kEmptyMatch}},
+ {u"www.", 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
// In this particular example, stripping the "www." from "www.FOO" means
// we can allow matching against keywords that explicitly start with
// "FOO", even if "FOO" happens to be "www". It's a little odd yet it
// seems reasonable.
- {ASCIIToUTF16("www.w w"),
+ {u"www.w w",
3,
- {{ASCIIToUTF16("www w"), false},
- {ASCIIToUTF16("weasel w"), false},
- {ASCIIToUTF16("www.cleantestv2.com w"), false}}},
- {ASCIIToUTF16("http://www"),
- 1,
- {{ASCIIToUTF16("www "), true}, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("http://www."), 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("ftp: blah"), 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("mailto:z"), 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("ftp://z"), 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("https://z"),
- 1,
- {{ASCIIToUTF16("z "), true}, kEmptyMatch, kEmptyMatch}},
+ {{u"www w", false},
+ {u"weasel w", false},
+ {u"www.cleantestv2.com w", false}}},
+ {u"http://www", 1, {{u"www ", true}, kEmptyMatch, kEmptyMatch}},
+ {u"http://www.", 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
+ {u"ftp: blah", 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
+ {u"mailto:z", 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
+ {u"ftp://z", 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
+ {u"https://z", 1, {{u"z ", true}, kEmptyMatch, kEmptyMatch}},
// Non-substituting keywords, whether typed fully or not
// should not add a space.
- {ASCIIToUTF16("nonsu"),
- 1,
- {{ASCIIToUTF16("nonsub"), false}, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("nonsub"),
- 1,
- {{ASCIIToUTF16("nonsub"), true}, kEmptyMatch, kEmptyMatch}},
+ {u"nonsu", 1, {{u"nonsub", false}, kEmptyMatch, kEmptyMatch}},
+ {u"nonsub", 1, {{u"nonsub", true}, kEmptyMatch, kEmptyMatch}},
};
SetUpClientAndKeywordProvider();
@@ -275,29 +245,19 @@
// result (sorted by keyword length sans registry). The "Edit" test case
// has this exact test for when not ignoring the registry to check that
// the other order (shorter full keyword) results there.
- {ASCIIToUTF16("foo hello"),
+ {u"foo hello",
2,
- {{ASCIIToUTF16("foolong.co.uk hello"), false},
- {ASCIIToUTF16("fooshort.com hello"), false},
+ {{u"foolong.co.uk hello", false},
+ {u"fooshort.com hello", false},
kEmptyMatch}},
// Keywords that don't have full hostnames should keep the same order
// as normal.
- {ASCIIToUTF16("aaa"),
- 2,
- {{ASCIIToUTF16("aaaa "), false},
- {ASCIIToUTF16("aaaaa "), false},
- kEmptyMatch}},
- {ASCIIToUTF16("a 1 2 3"),
+ {u"aaa", 2, {{u"aaaa ", false}, {u"aaaaa ", false}, kEmptyMatch}},
+ {u"a 1 2 3",
3,
- {{ASCIIToUTF16("aa 1 2 3"), false},
- {ASCIIToUTF16("ab 1 2 3"), false},
- {ASCIIToUTF16("aaaa 1 2 3"), false}}},
- {ASCIIToUTF16("www.a"),
- 3,
- {{ASCIIToUTF16("aa "), false},
- {ASCIIToUTF16("ab "), false},
- {ASCIIToUTF16("aaaa "), false}}},
+ {{u"aa 1 2 3", false}, {u"ab 1 2 3", false}, {u"aaaa 1 2 3", false}}},
+ {u"www.a", 3, {{u"aa ", false}, {u"ab ", false}, {u"aaaa ", false}}},
};
// Add a rule to make matching in the registry portion of a keyword
@@ -320,29 +280,29 @@
const MatchType<GURL> kEmptyMatch = { GURL(), false };
TestData<GURL> url_cases[] = {
// No query input -> empty destination URL.
- {ASCIIToUTF16("z"), 1, {{GURL(), true}, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("z \t"), 1, {{GURL(), true}, kEmptyMatch, kEmptyMatch}},
+ {u"z", 1, {{GURL(), true}, kEmptyMatch, kEmptyMatch}},
+ {u"z \t", 1, {{GURL(), true}, kEmptyMatch, kEmptyMatch}},
// Check that tokenization only collapses whitespace between first tokens
// and query input, but not rest of URL, is escaped.
- {ASCIIToUTF16("w bar +baz"),
+ {u"w bar +baz",
3,
{{GURL(" +%2B?=bar+%2Bbazfoo "), false},
{GURL("bar+%2Bbaz=z"), false},
{GURL("http://www.cleantestv2.com/?q=bar+%2Bbaz"), false}}},
// Substitution should work with various locations of the "%s".
- {ASCIIToUTF16("aaa 1a2b"),
+ {u"aaa 1a2b",
2,
{{GURL("http://aaaa/?aaaa=1&b=1a2b&c"), false},
{GURL("1a2b"), false},
kEmptyMatch}},
- {ASCIIToUTF16("a 1 2 3"),
+ {u"a 1 2 3",
3,
{{GURL("aa.com?foo=1+2+3"), false},
{GURL("bogus URL 1+2+3"), false},
{GURL("http://aaaa/?aaaa=1&b=1+2+3&c"), false}}},
- {ASCIIToUTF16("www.w w"),
+ {u"www.w w",
3,
{{GURL(" +%2B?=wfoo "), false},
{GURL("weaselwweasel"), false},
@@ -358,18 +318,14 @@
const MatchType<std::u16string> kEmptyMatch = {std::u16string(), false};
TestData<std::u16string> contents_cases[] = {
// No query input -> substitute "<Type search term>" into contents.
- {ASCIIToUTF16("z"),
+ {u"z", 1, {{u"<Type search term>", true}, kEmptyMatch, kEmptyMatch}},
+ {u"z \t",
1,
- {{ASCIIToUTF16("<Type search term>"), true}, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("z \t"),
- 1,
- {{ASCIIToUTF16("<Type search term>"), true}, kEmptyMatch, kEmptyMatch}},
+ {{u"<Type search term>", true}, kEmptyMatch, kEmptyMatch}},
// Exact keyword matches with remaining text should return nothing.
- {ASCIIToUTF16("www.www www"), 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
- {ASCIIToUTF16("z a b c++"),
- 0,
- {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
+ {u"www.www www", 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
+ {u"z a b c++", 0, {kEmptyMatch, kEmptyMatch, kEmptyMatch}},
// Exact keyword matches with remaining text when the keyword is an
// extension keyword should return something. This is tested in
@@ -380,24 +336,18 @@
// disambiguated by the description. We do not test the description value
// here because KeywordProvider doesn't set descriptions; these are
// populated later by AutocompleteController.
- {ASCIIToUTF16("aaa"),
+ {u"aaa",
2,
- {{ASCIIToUTF16("<Type search term>"), false},
- {ASCIIToUTF16("<Type search term>"), false},
+ {{u"<Type search term>", false},
+ {u"<Type search term>", false},
kEmptyMatch}},
// When there is a search string, simply display it.
- {ASCIIToUTF16("www.w w"),
- 3,
- {{ASCIIToUTF16("w"), false},
- {ASCIIToUTF16("w"), false},
- {ASCIIToUTF16("w"), false}}},
+ {u"www.w w", 3, {{u"w", false}, {u"w", false}, {u"w", false}}},
// Also, check that tokenization only collapses whitespace between first
// tokens and contents are not escaped or unescaped.
- {ASCIIToUTF16("a 1 2+ 3"),
+ {u"a 1 2+ 3",
3,
- {{ASCIIToUTF16("1 2+ 3"), false},
- {ASCIIToUTF16("1 2+ 3"), false},
- {ASCIIToUTF16("1 2+ 3"), false}}},
+ {{u"1 2+ 3", false}, {u"1 2+ 3", false}, {u"1 2+ 3", false}}},
};
SetUpClientAndKeywordProvider();
@@ -408,8 +358,8 @@
TEST_F(KeywordProviderTest, AddKeyword) {
SetUpClientAndKeywordProvider();
TemplateURLData data;
- data.SetShortName(ASCIIToUTF16("Test"));
- std::u16string keyword(ASCIIToUTF16("foo"));
+ data.SetShortName(u"Test");
+ std::u16string keyword(u"foo");
data.SetKeyword(keyword);
data.SetURL("http://www.google.com/foo?q={searchTerms}");
TemplateURL* template_url = client_->GetTemplateURLService()->Add(
@@ -422,66 +372,50 @@
TEST_F(KeywordProviderTest, RemoveKeyword) {
SetUpClientAndKeywordProvider();
TemplateURLService* template_url_service = client_->GetTemplateURLService();
- std::u16string url(ASCIIToUTF16("http://aaaa/?aaaa=1&b={searchTerms}&c"));
+ std::u16string url(u"http://aaaa/?aaaa=1&b={searchTerms}&c");
template_url_service->Remove(
- template_url_service->GetTemplateURLForKeyword(ASCIIToUTF16("aaaa")));
- ASSERT_TRUE(template_url_service->GetTemplateURLForKeyword(
- ASCIIToUTF16("aaaa")) == nullptr);
+ template_url_service->GetTemplateURLForKeyword(u"aaaa"));
+ ASSERT_TRUE(template_url_service->GetTemplateURLForKeyword(u"aaaa") ==
+ nullptr);
}
TEST_F(KeywordProviderTest, GetKeywordForInput) {
SetUpClientAndKeywordProvider();
- EXPECT_EQ(ASCIIToUTF16("aa"),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("aa")));
+ EXPECT_EQ(u"aa", kw_provider_->GetKeywordForText(u"aa"));
+ EXPECT_EQ(std::u16string(), kw_provider_->GetKeywordForText(u"aafoo"));
+ EXPECT_EQ(std::u16string(), kw_provider_->GetKeywordForText(u"aa foo"));
+ EXPECT_EQ(u"cleantestv1.com",
+ kw_provider_->GetKeywordForText(u"http://cleantestv1.com"));
+ EXPECT_EQ(u"cleantestv1.com",
+ kw_provider_->GetKeywordForText(u"www.cleantestv1.com"));
+ EXPECT_EQ(u"cleantestv1.com",
+ kw_provider_->GetKeywordForText(u"cleantestv1.com/"));
+ EXPECT_EQ(u"cleantestv1.com",
+ kw_provider_->GetKeywordForText(u"https://www.cleantestv1.com/"));
+ EXPECT_EQ(u"cleantestv2.com",
+ kw_provider_->GetKeywordForText(u"cleantestv2.com"));
+ EXPECT_EQ(u"www.cleantestv2.com",
+ kw_provider_->GetKeywordForText(u"www.cleantestv2.com"));
+ EXPECT_EQ(u"cleantestv2.com",
+ kw_provider_->GetKeywordForText(u"cleantestv2.com/"));
+ EXPECT_EQ(u"www.cleantestv3.com",
+ kw_provider_->GetKeywordForText(u"www.cleantestv3.com"));
EXPECT_EQ(std::u16string(),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("aafoo")));
+ kw_provider_->GetKeywordForText(u"cleantestv3.com"));
+ EXPECT_EQ(u"http://cleantestv4.com",
+ kw_provider_->GetKeywordForText(u"http://cleantestv4.com"));
EXPECT_EQ(std::u16string(),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("aa foo")));
- EXPECT_EQ(
- ASCIIToUTF16("cleantestv1.com"),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("http://cleantestv1.com")));
- EXPECT_EQ(
- ASCIIToUTF16("cleantestv1.com"),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("www.cleantestv1.com")));
- EXPECT_EQ(ASCIIToUTF16("cleantestv1.com"),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("cleantestv1.com/")));
- EXPECT_EQ(ASCIIToUTF16("cleantestv1.com"),
- kw_provider_->GetKeywordForText(
- ASCIIToUTF16("https://www.cleantestv1.com/")));
- EXPECT_EQ(ASCIIToUTF16("cleantestv2.com"),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("cleantestv2.com")));
- EXPECT_EQ(
- ASCIIToUTF16("www.cleantestv2.com"),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("www.cleantestv2.com")));
- EXPECT_EQ(ASCIIToUTF16("cleantestv2.com"),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("cleantestv2.com/")));
- EXPECT_EQ(
- ASCIIToUTF16("www.cleantestv3.com"),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("www.cleantestv3.com")));
- EXPECT_EQ(std::u16string(),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("cleantestv3.com")));
- EXPECT_EQ(
- ASCIIToUTF16("http://cleantestv4.com"),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("http://cleantestv4.com")));
- EXPECT_EQ(std::u16string(),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("cleantestv4.com")));
- EXPECT_EQ(ASCIIToUTF16("cleantestv5.com"),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("cleantestv5.com")));
- EXPECT_EQ(
- ASCIIToUTF16("http://cleantestv5.com"),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("http://cleantestv5.com")));
- EXPECT_EQ(ASCIIToUTF16("cleantestv6:"),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("cleantestv6:")));
- EXPECT_EQ(std::u16string(),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("cleantestv6")));
- EXPECT_EQ(ASCIIToUTF16("cleantestv7/"),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("cleantestv7/")));
- EXPECT_EQ(std::u16string(),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("cleantestv7")));
- EXPECT_EQ(ASCIIToUTF16("cleantestv8/"),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("cleantestv8/")));
- EXPECT_EQ(ASCIIToUTF16("cleantestv8"),
- kw_provider_->GetKeywordForText(ASCIIToUTF16("cleantestv8")));
+ kw_provider_->GetKeywordForText(u"cleantestv4.com"));
+ EXPECT_EQ(u"cleantestv5.com",
+ kw_provider_->GetKeywordForText(u"cleantestv5.com"));
+ EXPECT_EQ(u"http://cleantestv5.com",
+ kw_provider_->GetKeywordForText(u"http://cleantestv5.com"));
+ EXPECT_EQ(u"cleantestv6:", kw_provider_->GetKeywordForText(u"cleantestv6:"));
+ EXPECT_EQ(std::u16string(), kw_provider_->GetKeywordForText(u"cleantestv6"));
+ EXPECT_EQ(u"cleantestv7/", kw_provider_->GetKeywordForText(u"cleantestv7/"));
+ EXPECT_EQ(std::u16string(), kw_provider_->GetKeywordForText(u"cleantestv7"));
+ EXPECT_EQ(u"cleantestv8/", kw_provider_->GetKeywordForText(u"cleantestv8/"));
+ EXPECT_EQ(u"cleantestv8", kw_provider_->GetKeywordForText(u"cleantestv8"));
}
TEST_F(KeywordProviderTest, GetSubstitutingTemplateURLForInput) {
@@ -550,10 +484,11 @@
switches::kExtraSearchQueryParams, "a=b");
TestData<GURL> url_cases[] = {
- { ASCIIToUTF16("a 1 2 3"), 3,
- { { GURL("aa.com?a=b&foo=1+2+3"), false },
- { GURL("bogus URL 1+2+3"), false },
- { GURL("http://aaaa/?aaaa=1&b=1+2+3&c"), false } } },
+ {u"a 1 2 3",
+ 3,
+ {{GURL("aa.com?a=b&foo=1+2+3"), false},
+ {GURL("bogus URL 1+2+3"), false},
+ {GURL("http://aaaa/?aaaa=1&b=1+2+3&c"), false}}},
};
SetUpClientAndKeywordProvider();
@@ -563,8 +498,7 @@
TEST_F(KeywordProviderTest, DoesNotProvideMatchesOnFocus) {
SetUpClientAndKeywordProvider();
- AutocompleteInput input(ASCIIToUTF16("aaa"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"aaa", metrics::OmniboxEventProto::OTHER,
TestingSchemeClassifier());
input.set_focus_type(OmniboxFocusType::ON_FOCUS);
kw_provider_->Start(input, false);
diff --git a/components/omnibox/browser/local_history_zero_suggest_provider_unittest.cc b/components/omnibox/browser/local_history_zero_suggest_provider_unittest.cc
index f591ba9..da86b80 100644
--- a/components/omnibox/browser/local_history_zero_suggest_provider_unittest.cc
+++ b/components/omnibox/browser/local_history_zero_suggest_provider_unittest.cc
@@ -569,12 +569,12 @@
default_search_provider()->id(),
GetLocalHistoryZeroSuggestAgeThreshold());
EXPECT_EQ(1U, visits.size());
- EXPECT_EQ(base::ASCIIToUTF16("not to be deleted"), visits[0].normalized_term);
+ EXPECT_EQ(u"not to be deleted", visits[0].normalized_term);
// Make sure search terms from other search providers that would produce the
// deleted match are not deleted.
visits = url_db->GetMostRecentNormalizedKeywordSearchTerms(
other_search_provider->id(), GetLocalHistoryZeroSuggestAgeThreshold());
EXPECT_EQ(1U, visits.size());
- EXPECT_EQ(base::ASCIIToUTF16("hello world"), visits[0].normalized_term);
+ EXPECT_EQ(u"hello world", visits[0].normalized_term);
}
diff --git a/components/omnibox/browser/location_bar_model_impl_unittest.cc b/components/omnibox/browser/location_bar_model_impl_unittest.cc
index 813d858e..03a820c1 100644
--- a/components/omnibox/browser/location_bar_model_impl_unittest.cc
+++ b/components/omnibox/browser/location_bar_model_impl_unittest.cc
@@ -43,7 +43,7 @@
std::u16string FormattedStringWithEquivalentMeaning(
const GURL& url,
const std::u16string& formatted_url) const override {
- return formatted_url + base::ASCIIToUTF16("/TestSuffix");
+ return formatted_url + u"/TestSuffix";
}
bool GetURL(GURL* url) const override {
@@ -156,24 +156,23 @@
TEST_F(LocationBarModelImplRevealOnHoverTest, DisplayUrl) {
delegate()->SetURL(GURL("http://www.example.test/foo"));
#if defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("http://www.example.test/TestSuffix"),
- model()->GetURLForDisplay());
+ EXPECT_EQ(u"http://www.example.test/TestSuffix", model()->GetURLForDisplay());
#else // #!defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("http://www.example.test/foo/TestSuffix"),
+ EXPECT_EQ(u"http://www.example.test/foo/TestSuffix",
model()->GetURLForDisplay());
#endif // #!defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("http://www.example.test/foo/TestSuffix"),
+ EXPECT_EQ(u"http://www.example.test/foo/TestSuffix",
model()->GetFormattedFullURL());
delegate()->SetURL(GURL("https://www.example.test/foo"));
#if defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("https://www.example.test/TestSuffix"),
+ EXPECT_EQ(u"https://www.example.test/TestSuffix",
model()->GetURLForDisplay());
#else // #!defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("https://www.example.test/foo/TestSuffix"),
+ EXPECT_EQ(u"https://www.example.test/foo/TestSuffix",
model()->GetURLForDisplay());
#endif // #!defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("https://www.example.test/foo/TestSuffix"),
+ EXPECT_EQ(u"https://www.example.test/foo/TestSuffix",
model()->GetFormattedFullURL());
}
@@ -183,24 +182,23 @@
TEST_F(LocationBarModelImplHideOnInteractionTest, DisplayUrl) {
delegate()->SetURL(GURL("http://www.example.test/foo"));
#if defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("http://www.example.test/TestSuffix"),
- model()->GetURLForDisplay());
+ EXPECT_EQ(u"http://www.example.test/TestSuffix", model()->GetURLForDisplay());
#else // #!defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("http://www.example.test/foo/TestSuffix"),
+ EXPECT_EQ(u"http://www.example.test/foo/TestSuffix",
model()->GetURLForDisplay());
#endif // #!defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("http://www.example.test/foo/TestSuffix"),
+ EXPECT_EQ(u"http://www.example.test/foo/TestSuffix",
model()->GetFormattedFullURL());
delegate()->SetURL(GURL("https://www.example.test/foo"));
#if defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("https://www.example.test/TestSuffix"),
+ EXPECT_EQ(u"https://www.example.test/TestSuffix",
model()->GetURLForDisplay());
#else // #!defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("https://www.example.test/foo/TestSuffix"),
+ EXPECT_EQ(u"https://www.example.test/foo/TestSuffix",
model()->GetURLForDisplay());
#endif // #!defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("https://www.example.test/foo/TestSuffix"),
+ EXPECT_EQ(u"https://www.example.test/foo/TestSuffix",
model()->GetFormattedFullURL());
}
@@ -210,10 +208,8 @@
// Verify that both the full formatted URL and the display URL add the test
// suffix.
- EXPECT_EQ(base::ASCIIToUTF16("www.google.com/TestSuffix"),
- model()->GetFormattedFullURL());
- EXPECT_EQ(base::ASCIIToUTF16("google.com/TestSuffix"),
- model()->GetURLForDisplay());
+ EXPECT_EQ(u"www.google.com/TestSuffix", model()->GetFormattedFullURL());
+ EXPECT_EQ(u"google.com/TestSuffix", model()->GetURLForDisplay());
}
TEST_F(LocationBarModelImplTest, FormatsReaderModeUrls) {
@@ -225,12 +221,11 @@
// We expect that they don't start with "http://." We want the reader mode
// URL shown to the user to be the same as this original URL.
#if defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("example.com/TestSuffix"), originalDisplayUrl);
+ EXPECT_EQ(u"example.com/TestSuffix", originalDisplayUrl);
#else // #!defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("example.com/article.html/TestSuffix"),
- originalDisplayUrl);
+ EXPECT_EQ(u"example.com/article.html/TestSuffix", originalDisplayUrl);
#endif // #defined (OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("www.example.com/article.html/TestSuffix"),
+ EXPECT_EQ(u"www.example.com/article.html/TestSuffix",
originalFormattedFullUrl);
GURL distilled = dom_distiller::url_utils::GetDistillerViewUrlFromUrl(
@@ -251,24 +246,20 @@
dom_distiller::kDomDistillerScheme, https_url, "title");
delegate()->SetURL(distilled);
EXPECT_EQ(originalDisplayUrl, model()->GetURLForDisplay());
- EXPECT_EQ(
- base::ASCIIToUTF16("https://www.example.com/article.html/TestSuffix"),
- model()->GetFormattedFullURL());
+ EXPECT_EQ(u"https://www.example.com/article.html/TestSuffix",
+ model()->GetFormattedFullURL());
// Invalid dom-distiller:// URLs should be shown, because they do not
// correspond to any article.
delegate()->SetURL(GURL(("chrome-distiller://abc/?url=invalid")));
#if defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("chrome-distiller://abc/TestSuffix"),
- model()->GetURLForDisplay());
+ EXPECT_EQ(u"chrome-distiller://abc/TestSuffix", model()->GetURLForDisplay());
#else // #!defined(OS_IOS)
- EXPECT_EQ(
- base::ASCIIToUTF16("chrome-distiller://abc/?url=invalid/TestSuffix"),
- model()->GetURLForDisplay());
+ EXPECT_EQ(u"chrome-distiller://abc/?url=invalid/TestSuffix",
+ model()->GetURLForDisplay());
#endif // #defined (OS_IOS)
- EXPECT_EQ(
- base::ASCIIToUTF16("chrome-distiller://abc/?url=invalid/TestSuffix"),
- model()->GetFormattedFullURL());
+ EXPECT_EQ(u"chrome-distiller://abc/?url=invalid/TestSuffix",
+ model()->GetFormattedFullURL());
}
// TODO(https://crbug.com/1010418): Fix flakes on linux_chromium_asan_rel_ng and
@@ -315,8 +306,7 @@
// iOS.
TEST_F(LocationBarModelImplTest, BlobDisplayURLIOS) {
delegate()->SetURL(GURL("blob:http://example.test/foo"));
- EXPECT_EQ(base::ASCIIToUTF16("example.test/TestSuffix"),
- model()->GetURLForDisplay());
+ EXPECT_EQ(u"example.test/TestSuffix", model()->GetURLForDisplay());
}
#endif // defined(OS_IOS)
diff --git a/components/omnibox/browser/most_visited_sites_provider_unittest.cc b/components/omnibox/browser/most_visited_sites_provider_unittest.cc
index ae6a7cf..56f95a9 100644
--- a/components/omnibox/browser/most_visited_sites_provider_unittest.cc
+++ b/components/omnibox/browser/most_visited_sites_provider_unittest.cc
@@ -196,8 +196,7 @@
input.set_current_url(GURL(current_url));
input.set_focus_type(OmniboxFocusType::ON_FOCUS);
history::MostVisitedURLList urls;
- history::MostVisitedURL url(GURL("http://foo.com/"),
- base::ASCIIToUTF16("Foo"));
+ history::MostVisitedURL url(GURL("http://foo.com/"), u"Foo");
urls.push_back(url);
provider_->Start(input, false);
@@ -216,10 +215,8 @@
EXPECT_TRUE(provider_->matches().empty());
history::MostVisitedURLList urls2;
- urls2.push_back(history::MostVisitedURL(GURL("http://bar.com/"),
- base::ASCIIToUTF16("Bar")));
- urls2.push_back(history::MostVisitedURL(GURL("http://zinga.com/"),
- base::ASCIIToUTF16("Zinga")));
+ urls2.push_back(history::MostVisitedURL(GURL("http://bar.com/"), u"Bar"));
+ urls2.push_back(history::MostVisitedURL(GURL("http://zinga.com/"), u"Zinga"));
provider_->Start(input, false);
provider_->Stop(false, false);
provider_->Start(input, false);
@@ -240,8 +237,7 @@
input.set_current_url(GURL(current_url));
input.set_focus_type(OmniboxFocusType::ON_FOCUS);
history::MostVisitedURLList urls;
- history::MostVisitedURL url(GURL("http://foo.com/"),
- base::ASCIIToUTF16("Foo"));
+ history::MostVisitedURL url(GURL("http://foo.com/"), u"Foo");
urls.push_back(url);
provider_->Start(input, false);
diff --git a/components/omnibox/browser/omnibox_edit_model.cc b/components/omnibox/browser/omnibox_edit_model.cc
index f40c34f..78a3576 100644
--- a/components/omnibox/browser/omnibox_edit_model.cc
+++ b/components/omnibox/browser/omnibox_edit_model.cc
@@ -1102,9 +1102,9 @@
// typed one.
std::u16string prefix;
if (keyword_mode_entry_method_ == OmniboxEventProto::QUESTION_MARK)
- prefix = base::ASCIIToUTF16("?");
+ prefix = u"?";
else if (keyword_mode_entry_method_ != OmniboxEventProto::KEYBOARD_SHORTCUT)
- prefix = keyword_ + base::ASCIIToUTF16(" ");
+ prefix = keyword_ + u" ";
keyword_.clear();
is_keyword_hint_ = false;
diff --git a/components/omnibox/browser/omnibox_edit_model_unittest.cc b/components/omnibox/browser/omnibox_edit_model_unittest.cc
index b426afb..384e168 100644
--- a/components/omnibox/browser/omnibox_edit_model_unittest.cc
+++ b/components/omnibox/browser/omnibox_edit_model_unittest.cc
@@ -216,41 +216,41 @@
TEST_F(OmniboxEditModelTest, DISABLED_InlineAutocompleteText) {
// Test if the model updates the inline autocomplete text in the view.
EXPECT_EQ(std::u16string(), view()->inline_autocompletion());
- model()->SetUserText(base::ASCIIToUTF16("he"));
+ model()->SetUserText(u"he");
model()->OnPopupDataChanged(std::u16string(),
- /*is_temporary_text=*/false,
- base::ASCIIToUTF16("llo"), std::u16string(), {},
- std::u16string(), false, std::u16string());
- EXPECT_EQ(base::ASCIIToUTF16("hello"), view()->GetText());
- EXPECT_EQ(base::ASCIIToUTF16("llo"), view()->inline_autocompletion());
+ /*is_temporary_text=*/false, u"llo",
+ std::u16string(), {}, std::u16string(), false,
+ std::u16string());
+ EXPECT_EQ(u"hello", view()->GetText());
+ EXPECT_EQ(u"llo", view()->inline_autocompletion());
- std::u16string text_before = base::ASCIIToUTF16("he");
- std::u16string text_after = base::ASCIIToUTF16("hel");
+ std::u16string text_before = u"he";
+ std::u16string text_after = u"hel";
OmniboxView::StateChanges state_changes{
&text_before, &text_after, 3, 3, false, true, false, false};
model()->OnAfterPossibleChange(state_changes, true);
EXPECT_EQ(std::u16string(), view()->inline_autocompletion());
model()->OnPopupDataChanged(std::u16string(),
- /*is_temporary_text=*/false,
- base::ASCIIToUTF16("lo"), std::u16string(), {},
- std::u16string(), false, std::u16string());
- EXPECT_EQ(base::ASCIIToUTF16("hello"), view()->GetText());
- EXPECT_EQ(base::ASCIIToUTF16("lo"), view()->inline_autocompletion());
+ /*is_temporary_text=*/false, u"lo",
+ std::u16string(), {}, std::u16string(), false,
+ std::u16string());
+ EXPECT_EQ(u"hello", view()->GetText());
+ EXPECT_EQ(u"lo", view()->inline_autocompletion());
model()->Revert();
EXPECT_EQ(std::u16string(), view()->GetText());
EXPECT_EQ(std::u16string(), view()->inline_autocompletion());
- model()->SetUserText(base::ASCIIToUTF16("he"));
+ model()->SetUserText(u"he");
model()->OnPopupDataChanged(std::u16string(),
- /*is_temporary_text=*/false,
- base::ASCIIToUTF16("llo"), std::u16string(), {},
- std::u16string(), false, std::u16string());
- EXPECT_EQ(base::ASCIIToUTF16("hello"), view()->GetText());
- EXPECT_EQ(base::ASCIIToUTF16("llo"), view()->inline_autocompletion());
+ /*is_temporary_text=*/false, u"llo",
+ std::u16string(), {}, std::u16string(), false,
+ std::u16string());
+ EXPECT_EQ(u"hello", view()->GetText());
+ EXPECT_EQ(u"llo", view()->inline_autocompletion());
model()->AcceptTemporaryTextAsUserText();
- EXPECT_EQ(base::ASCIIToUTF16("hello"), view()->GetText());
+ EXPECT_EQ(u"hello", view()->GetText());
EXPECT_EQ(std::u16string(), view()->inline_autocompletion());
}
@@ -258,15 +258,15 @@
#if !defined(OS_IOS)
TEST_F(OmniboxEditModelTest, RespectUnelisionInZeroSuggest) {
location_bar_model()->set_url(GURL("https://www.example.com/"));
- location_bar_model()->set_url_for_display(base::ASCIIToUTF16("example.com"));
+ location_bar_model()->set_url_for_display(u"example.com");
EXPECT_TRUE(model()->ResetDisplayTexts());
model()->Revert();
// Set up view with unelided text.
- EXPECT_EQ(base::ASCIIToUTF16("example.com"), view()->GetText());
+ EXPECT_EQ(u"example.com", view()->GetText());
EXPECT_TRUE(model()->Unelide());
- EXPECT_EQ(base::ASCIIToUTF16("https://www.example.com/"), view()->GetText());
+ EXPECT_EQ(u"https://www.example.com/", view()->GetText());
EXPECT_FALSE(model()->user_input_in_progress());
EXPECT_TRUE(view()->IsSelectAll());
@@ -276,7 +276,7 @@
model()->OnPopupDataChanged(std::u16string(), /*is_temporary_text=*/false,
std::u16string(), std::u16string(), {},
std::u16string(), false, std::u16string());
- EXPECT_EQ(base::ASCIIToUTF16("https://www.example.com/"), view()->GetText());
+ EXPECT_EQ(u"https://www.example.com/", view()->GetText());
EXPECT_FALSE(model()->user_input_in_progress());
EXPECT_TRUE(view()->IsSelectAll());
}
@@ -284,8 +284,7 @@
TEST_F(OmniboxEditModelTest, RevertZeroSuggestTemporaryText) {
location_bar_model()->set_url(GURL("https://www.example.com/"));
- location_bar_model()->set_url_for_display(
- base::ASCIIToUTF16("https://www.example.com/"));
+ location_bar_model()->set_url_for_display(u"https://www.example.com/");
EXPECT_TRUE(model()->ResetDisplayTexts());
model()->Revert();
@@ -293,14 +292,14 @@
// Simulate getting ZeroSuggestions and arrowing to a different match.
view()->SelectAll(true);
model()->StartZeroSuggestRequest();
- model()->OnPopupDataChanged(base::ASCIIToUTF16("fake_temporary_text"),
+ model()->OnPopupDataChanged(u"fake_temporary_text",
/*is_temporary_text=*/true, std::u16string(),
std::u16string(), {}, std::u16string(), false,
std::u16string());
// Test that reverting brings back the original input text.
EXPECT_TRUE(model()->OnEscapeKeyPressed());
- EXPECT_EQ(base::ASCIIToUTF16("https://www.example.com/"), view()->GetText());
+ EXPECT_EQ(u"https://www.example.com/", view()->GetText());
EXPECT_FALSE(model()->user_input_in_progress());
EXPECT_TRUE(view()->IsSelectAll());
}
@@ -319,13 +318,13 @@
const GURL alternate_nav_url("http://abcd/");
model()->OnSetFocus(false); // Avoids DCHECK in OpenMatch().
- model()->SetUserText(base::ASCIIToUTF16("http://abcd"));
+ model()->SetUserText(u"http://abcd");
model()->OpenMatch(match, WindowOpenDisposition::CURRENT_TAB,
alternate_nav_url, std::u16string(), 0);
EXPECT_TRUE(AutocompleteInput::HasHTTPScheme(
client->alternate_nav_match().fill_into_edit));
- model()->SetUserText(base::ASCIIToUTF16("abcd"));
+ model()->SetUserText(u"abcd");
model()->OpenMatch(match, WindowOpenDisposition::CURRENT_TAB,
alternate_nav_url, std::u16string(), 0);
EXPECT_TRUE(AutocompleteInput::HasHTTPScheme(
@@ -336,16 +335,15 @@
// Test the HTTP case.
{
location_bar_model()->set_url(GURL("http://www.example.com/"));
- location_bar_model()->set_url_for_display(
- base::ASCIIToUTF16("example.com"));
+ location_bar_model()->set_url_for_display(u"example.com");
model()->ResetDisplayTexts();
model()->Revert();
// iOS doesn't do elision in the textfield view.
#if defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("http://www.example.com/"), view()->GetText());
+ EXPECT_EQ(u"http://www.example.com/", view()->GetText());
#else
- EXPECT_EQ(base::ASCIIToUTF16("example.com"), view()->GetText());
+ EXPECT_EQ(u"example.com", view()->GetText());
#endif
AutocompleteMatch match = model()->CurrentMatch(nullptr);
@@ -358,15 +356,15 @@
// secure scheme.
{
location_bar_model()->set_url(GURL("https://www.google.com/"));
- location_bar_model()->set_url_for_display(base::ASCIIToUTF16("google.com"));
+ location_bar_model()->set_url_for_display(u"google.com");
model()->ResetDisplayTexts();
model()->Revert();
// iOS doesn't do elision in the textfield view.
#if defined(OS_IOS)
- EXPECT_EQ(base::ASCIIToUTF16("https://www.google.com/"), view()->GetText());
+ EXPECT_EQ(u"https://www.google.com/", view()->GetText());
#else
- EXPECT_EQ(base::ASCIIToUTF16("google.com"), view()->GetText());
+ EXPECT_EQ(u"google.com", view()->GetText());
#endif
AutocompleteMatch match = model()->CurrentMatch(nullptr);
@@ -380,7 +378,7 @@
TEST_F(OmniboxEditModelTest, DisplayText) {
location_bar_model()->set_url(GURL("https://www.example.com/"));
- location_bar_model()->set_url_for_display(base::ASCIIToUTF16("example.com"));
+ location_bar_model()->set_url_for_display(u"example.com");
EXPECT_TRUE(model()->ResetDisplayTexts());
model()->Revert();
@@ -390,46 +388,42 @@
#if defined(OS_IOS)
// iOS OmniboxEditModel always provides the full URL as the OmniboxView
// permanent display text. Unelision should return false.
- EXPECT_EQ(base::ASCIIToUTF16("https://www.example.com/"),
- model()->GetPermanentDisplayText());
- EXPECT_EQ(base::ASCIIToUTF16("https://www.example.com/"), view()->GetText());
+ EXPECT_EQ(u"https://www.example.com/", model()->GetPermanentDisplayText());
+ EXPECT_EQ(u"https://www.example.com/", view()->GetText());
EXPECT_FALSE(model()->Unelide());
EXPECT_FALSE(model()->user_input_in_progress());
EXPECT_FALSE(view()->IsSelectAll());
#else
// Verify we can unelide and show the full URL properly.
- EXPECT_EQ(base::ASCIIToUTF16("example.com"),
- model()->GetPermanentDisplayText());
- EXPECT_EQ(base::ASCIIToUTF16("example.com"), view()->GetText());
+ EXPECT_EQ(u"example.com", model()->GetPermanentDisplayText());
+ EXPECT_EQ(u"example.com", view()->GetText());
EXPECT_TRUE(model()->Unelide());
EXPECT_FALSE(model()->user_input_in_progress());
EXPECT_TRUE(view()->IsSelectAll());
#endif
- EXPECT_EQ(base::ASCIIToUTF16("https://www.example.com/"), view()->GetText());
+ EXPECT_EQ(u"https://www.example.com/", view()->GetText());
EXPECT_TRUE(model()->CurrentTextIsURL());
// We should still show the current page's icon until the URL is modified.
EXPECT_TRUE(model()->ShouldShowCurrentPageIcon());
- view()->SetUserText(base::ASCIIToUTF16("something else"));
+ view()->SetUserText(u"something else");
EXPECT_FALSE(model()->ShouldShowCurrentPageIcon());
}
TEST_F(OmniboxEditModelTest, UnelideDoesNothingWhenFullURLAlreadyShown) {
location_bar_model()->set_url(GURL("https://www.example.com/"));
- location_bar_model()->set_url_for_display(
- base::ASCIIToUTF16("https://www.example.com/"));
+ location_bar_model()->set_url_for_display(u"https://www.example.com/");
EXPECT_TRUE(model()->ResetDisplayTexts());
model()->Revert();
- EXPECT_EQ(base::ASCIIToUTF16("https://www.example.com/"),
- model()->GetPermanentDisplayText());
+ EXPECT_EQ(u"https://www.example.com/", model()->GetPermanentDisplayText());
EXPECT_TRUE(model()->CurrentTextIsURL());
// Verify Unelide does nothing.
EXPECT_FALSE(model()->Unelide());
- EXPECT_EQ(base::ASCIIToUTF16("https://www.example.com/"), view()->GetText());
+ EXPECT_EQ(u"https://www.example.com/", view()->GetText());
EXPECT_FALSE(model()->user_input_in_progress());
EXPECT_FALSE(view()->IsSelectAll());
EXPECT_TRUE(model()->CurrentTextIsURL());
@@ -550,7 +544,7 @@
// But if it's the temporary text, the View text should be used.
view()->SetUserText(u"foo");
model()->StartAutocomplete(false, false);
- model()->OnPopupDataChanged(base::ASCIIToUTF16("foobar"),
+ model()->OnPopupDataChanged(u"foobar",
/*is_temporary_text=*/true, std::u16string(),
std::u16string(), {}, std::u16string(), false,
std::u16string());
@@ -565,7 +559,7 @@
TEST_F(OmniboxEditModelTest,
CtrlEnterNavigatesToDesiredTLDSteadyStateElisions) {
location_bar_model()->set_url(GURL("https://www.example.com/"));
- location_bar_model()->set_url_for_display(base::ASCIIToUTF16("example.com"));
+ location_bar_model()->set_url_for_display(u"example.com");
EXPECT_TRUE(model()->ResetDisplayTexts());
model()->Revert();
diff --git a/components/omnibox/browser/omnibox_pedal_implementations_unittest.cc b/components/omnibox/browser/omnibox_pedal_implementations_unittest.cc
index 896115c..fbbf33e 100644
--- a/components/omnibox/browser/omnibox_pedal_implementations_unittest.cc
+++ b/components/omnibox/browser/omnibox_pedal_implementations_unittest.cc
@@ -31,8 +31,7 @@
feature_list.InitAndEnableFeature(omnibox::kOmniboxPedalsBatch2);
MockAutocompleteProviderClient client;
OmniboxPedalProvider provider(client);
- const OmniboxPedal* pedal =
- provider.FindPedalMatch(base::ASCIIToUTF16("clear browser data"));
+ const OmniboxPedal* pedal = provider.FindPedalMatch(u"clear browser data");
base::TimeTicks match_selection_timestamp;
OmniboxPedal::ExecutionContext context(
*omnibox_client_, *omnibox_edit_controller_, match_selection_timestamp);
diff --git a/components/omnibox/browser/omnibox_pedal_provider.cc b/components/omnibox/browser/omnibox_pedal_provider.cc
index bbf614fb..fa6e614 100644
--- a/components/omnibox/browser/omnibox_pedal_provider.cc
+++ b/components/omnibox/browser/omnibox_pedal_provider.cc
@@ -179,9 +179,9 @@
DCHECK_LT(max_tokens_, size_t{64});
if (concept_data->FindKey("tokenize_each_character")->GetBool()) {
- tokenize_characters_ = base::ASCIIToUTF16("");
+ tokenize_characters_ = u"";
} else {
- tokenize_characters_ = base::ASCIIToUTF16(" -");
+ tokenize_characters_ = u" -";
}
const auto& dictionary = concept_data->FindKey("dictionary")->GetList();
diff --git a/components/omnibox/browser/omnibox_pedal_provider_unittest.cc b/components/omnibox/browser/omnibox_pedal_provider_unittest.cc
index b2a71494..a3e7b63 100644
--- a/components/omnibox/browser/omnibox_pedal_provider_unittest.cc
+++ b/components/omnibox/browser/omnibox_pedal_provider_unittest.cc
@@ -18,11 +18,9 @@
TEST_F(OmniboxPedalProviderTest, QueriesTriggerPedals) {
MockAutocompleteProviderClient client;
OmniboxPedalProvider provider(client);
- EXPECT_EQ(provider.FindPedalMatch(base::ASCIIToUTF16("")), nullptr);
- EXPECT_EQ(provider.FindPedalMatch(base::ASCIIToUTF16("clear histor")),
- nullptr);
- EXPECT_NE(provider.FindPedalMatch(base::ASCIIToUTF16("clear history")),
- nullptr);
+ EXPECT_EQ(provider.FindPedalMatch(u""), nullptr);
+ EXPECT_EQ(provider.FindPedalMatch(u"clear histor"), nullptr);
+ EXPECT_NE(provider.FindPedalMatch(u"clear history"), nullptr);
}
TEST_F(OmniboxPedalProviderTest, MemoryUsageIsModerate) {
diff --git a/components/omnibox/browser/omnibox_popup_model_unittest.cc b/components/omnibox/browser/omnibox_popup_model_unittest.cc
index 3d29c11d..76563730 100644
--- a/components/omnibox/browser/omnibox_popup_model_unittest.cc
+++ b/components/omnibox/browser/omnibox_popup_model_unittest.cc
@@ -142,7 +142,7 @@
for (size_t i = 0; i < 2; ++i) {
AutocompleteMatch match(nullptr, 1000, false,
AutocompleteMatchType::URL_WHAT_YOU_TYPED);
- match.keyword = base::ASCIIToUTF16("match");
+ match.keyword = u"match";
match.allowed_to_be_default_match = true;
matches.push_back(match);
}
@@ -165,7 +165,7 @@
for (size_t i = 0; i < 2; ++i) {
AutocompleteMatch match(nullptr, 1000, false,
AutocompleteMatchType::URL_WHAT_YOU_TYPED);
- match.keyword = base::ASCIIToUTF16("match");
+ match.keyword = u"match";
matches.push_back(match);
}
auto* result = &model()->autocomplete_controller()->result_;
@@ -196,7 +196,7 @@
for (size_t i = 0; i < 3; ++i) {
AutocompleteMatch match(nullptr, 1000, false,
AutocompleteMatchType::URL_WHAT_YOU_TYPED);
- match.keyword = base::ASCIIToUTF16("match");
+ match.keyword = u"match";
match.allowed_to_be_default_match = true;
matches.push_back(match);
}
@@ -224,7 +224,7 @@
for (size_t i = 0; i < 4; ++i) {
AutocompleteMatch match(nullptr, 1000, false,
AutocompleteMatchType::URL_WHAT_YOU_TYPED);
- match.keyword = base::ASCIIToUTF16("match");
+ match.keyword = u"match";
match.allowed_to_be_default_match = true;
matches.push_back(match);
}
@@ -309,7 +309,7 @@
for (size_t i = 0; i < 4; ++i) {
AutocompleteMatch match(nullptr, 1000, false,
AutocompleteMatchType::URL_WHAT_YOU_TYPED);
- match.keyword = base::ASCIIToUTF16("match");
+ match.keyword = u"match";
match.allowed_to_be_default_match = true;
matches.push_back(match);
}
@@ -381,7 +381,7 @@
for (size_t i = 0; i < 4; ++i) {
AutocompleteMatch match(nullptr, 1000, false,
AutocompleteMatchType::URL_WHAT_YOU_TYPED);
- match.keyword = base::ASCIIToUTF16("match");
+ match.keyword = u"match";
match.allowed_to_be_default_match = true;
matches.push_back(match);
}
@@ -474,7 +474,7 @@
for (size_t i = 0; i < 5; ++i) {
AutocompleteMatch match(nullptr, 1000, false,
AutocompleteMatchType::URL_WHAT_YOU_TYPED);
- match.keyword = base::ASCIIToUTF16("match");
+ match.keyword = u"match";
match.allowed_to_be_default_match = true;
matches.push_back(match);
}
@@ -790,7 +790,7 @@
ACMatches matches;
AutocompleteMatch match(nullptr, 1000, false,
AutocompleteMatchType::URL_WHAT_YOU_TYPED);
- match.contents = base::ASCIIToUTF16("match1.com");
+ match.contents = u"match1.com";
match.destination_url = GURL("http://match1.com");
match.allowed_to_be_default_match = true;
match.has_tab_match = true;
@@ -817,7 +817,7 @@
// shouldn't change focused state.
matches[0].relevance = 999;
// Give it a different name so not deduped.
- matches[0].contents = base::ASCIIToUTF16("match2.com");
+ matches[0].contents = u"match2.com";
matches[0].destination_url = GURL("http://match2.com");
result->AppendMatches(input, matches);
result->SortAndCull(input, nullptr);
@@ -834,7 +834,7 @@
popup_model()->SetSelectedLineState(
OmniboxPopupModel::FOCUSED_BUTTON_TAB_SWITCH);
matches[0].relevance = 999;
- matches[0].contents = base::ASCIIToUTF16("match3.com");
+ matches[0].contents = u"match3.com";
matches[0].destination_url = GURL("http://match3.com");
result->AppendMatches(input, matches);
result->SortAndCull(input, nullptr);
@@ -847,7 +847,7 @@
popup_model()->SetSelectedLineState(
OmniboxPopupModel::FOCUSED_BUTTON_TAB_SWITCH);
matches[0].relevance = 1100;
- matches[0].contents = base::ASCIIToUTF16("match4.com");
+ matches[0].contents = u"match4.com";
matches[0].destination_url = GURL("http://match4.com");
result->AppendMatches(input, matches);
result->SortAndCull(input, nullptr);
diff --git a/components/omnibox/browser/omnibox_view.cc b/components/omnibox/browser/omnibox_view.cc
index 7483059..1b9fce9 100644
--- a/components/omnibox/browser/omnibox_view.cc
+++ b/components/omnibox/browser/omnibox_view.cc
@@ -49,7 +49,7 @@
// static
std::u16string OmniboxView::StripJavascriptSchemas(const std::u16string& text) {
const std::u16string kJsPrefix(base::ASCIIToUTF16(url::kJavaScriptScheme) +
- base::ASCIIToUTF16(":"));
+ u":");
bool found_JavaScript = false;
size_t i = 0;
@@ -86,7 +86,7 @@
size_t end = text.find_first_not_of(base::kWhitespaceUTF16);
if (end == std::u16string::npos)
- return base::ASCIIToUTF16(" "); // Convert all-whitespace to single space.
+ return u" "; // Convert all-whitespace to single space.
// Because |end| points at the first non-whitespace character, the loop
// below will skip leading whitespace.
diff --git a/components/omnibox/browser/omnibox_view_unittest.cc b/components/omnibox/browser/omnibox_view_unittest.cc
index c35e2d8..630420c 100644
--- a/components/omnibox/browser/omnibox_view_unittest.cc
+++ b/components/omnibox/browser/omnibox_view_unittest.cc
@@ -110,22 +110,22 @@
} kTestcases[] = {
// No whitespace: leave unchanged.
{std::u16string(), std::u16string()},
- {ASCIIToUTF16("a"), ASCIIToUTF16("a")},
- {ASCIIToUTF16("abc"), ASCIIToUTF16("abc")},
+ {u"a", u"a"},
+ {u"abc", u"abc"},
// Leading/trailing whitespace: remove.
- {ASCIIToUTF16(" abc"), ASCIIToUTF16("abc")},
- {ASCIIToUTF16(" \n abc"), ASCIIToUTF16("abc")},
- {ASCIIToUTF16("abc "), ASCIIToUTF16("abc")},
- {ASCIIToUTF16("abc\t \t"), ASCIIToUTF16("abc")},
- {ASCIIToUTF16("\nabc\n"), ASCIIToUTF16("abc")},
+ {u" abc", u"abc"},
+ {u" \n abc", u"abc"},
+ {u"abc ", u"abc"},
+ {u"abc\t \t", u"abc"},
+ {u"\nabc\n", u"abc"},
// All whitespace: Convert to single space.
- {ASCIIToUTF16(" "), ASCIIToUTF16(" ")},
- {ASCIIToUTF16("\n"), ASCIIToUTF16(" ")},
- {ASCIIToUTF16(" "), ASCIIToUTF16(" ")},
- {ASCIIToUTF16("\n\n\n"), ASCIIToUTF16(" ")},
- {ASCIIToUTF16(" \n\t"), ASCIIToUTF16(" ")},
+ {u" ", u" "},
+ {u"\n", u" "},
+ {u" ", u" "},
+ {u"\n\n\n", u" "},
+ {u" \n\t", u" "},
// Broken URL has newlines stripped.
{ASCIIToUTF16("http://www.chromium.org/developers/testing/chromium-\n"
@@ -134,22 +134,20 @@
"build-infrastructure/tour-of-the-chromium-buildbot")},
// Multi-line address is converted to a single-line address.
- {ASCIIToUTF16("1600 Amphitheatre Parkway\nMountain View, CA"),
- ASCIIToUTF16("1600 Amphitheatre Parkway Mountain View, CA")},
+ {u"1600 Amphitheatre Parkway\nMountain View, CA",
+ u"1600 Amphitheatre Parkway Mountain View, CA"},
// Line-breaking the JavaScript scheme with no other whitespace results in
// a
// dangerous URL that is sanitized by dropping the scheme.
- {ASCIIToUTF16("java\x0d\x0ascript:alert(0)"), ASCIIToUTF16("alert(0)")},
+ {u"java\x0d\x0ascript:alert(0)", u"alert(0)"},
// Line-breaking the JavaScript scheme with whitespace elsewhere in the
// string results in a safe string with a space replacing the line break.
- {ASCIIToUTF16("java\x0d\x0ascript: alert(0)"),
- ASCIIToUTF16("java script: alert(0)")},
+ {u"java\x0d\x0ascript: alert(0)", u"java script: alert(0)"},
// Unusual URL with multiple internal spaces is preserved as-is.
- {ASCIIToUTF16("http://foo.com/a. b"),
- ASCIIToUTF16("http://foo.com/a. b")},
+ {u"http://foo.com/a. b", u"http://foo.com/a. b"},
// URL with unicode whitespace is also preserved as-is.
{u"http://foo.com/a\x3000"
@@ -186,7 +184,7 @@
model()->SetCurrentMatchForTest(match);
bookmark_model()->AddURL(bookmark_model()->bookmark_bar_node(), 0,
- base::ASCIIToUTF16("a bookmark"), kUrl);
+ u"a bookmark", kUrl);
ui::ImageModel expected_icon = ui::ImageModel::FromVectorIcon(
omnibox::kBookmarkIcon, gfx::kPlaceholderColor, gfx::kFaviconSize);
diff --git a/components/omnibox/browser/scored_history_match_unittest.cc b/components/omnibox/browser/scored_history_match_unittest.cc
index 59791da..e49a300 100644
--- a/components/omnibox/browser/scored_history_match_unittest.cc
+++ b/components/omnibox/browser/scored_history_match_unittest.cc
@@ -150,9 +150,8 @@
VisitInfoVector visits_a = CreateVisitInfoVector(3, 30, now);
// Mark one visit as typed.
visits_a[0].second = ui::PAGE_TRANSITION_TYPED;
- ScoredHistoryMatch scored_a(row_a, visits_a, ASCIIToUTF16("abc"),
- Make1Term("abc"), one_word_no_offset,
- word_starts_a, false, 1, now);
+ ScoredHistoryMatch scored_a(row_a, visits_a, u"abc", Make1Term("abc"),
+ one_word_no_offset, word_starts_a, false, 1, now);
// Test scores based on visit_count.
history::URLRow row_b(MakeURLRow("http://abcdef", "abcd bcd", 10, 30, 1));
@@ -160,9 +159,8 @@
PopulateWordStarts(row_b, &word_starts_b);
VisitInfoVector visits_b = CreateVisitInfoVector(10, 30, now);
visits_b[0].second = ui::PAGE_TRANSITION_TYPED;
- ScoredHistoryMatch scored_b(row_b, visits_b, ASCIIToUTF16("abc"),
- Make1Term("abc"), one_word_no_offset,
- word_starts_b, false, 1, now);
+ ScoredHistoryMatch scored_b(row_b, visits_b, u"abc", Make1Term("abc"),
+ one_word_no_offset, word_starts_b, false, 1, now);
EXPECT_GT(scored_b.raw_score, scored_a.raw_score);
// Test scores based on last_visit.
@@ -171,9 +169,8 @@
PopulateWordStarts(row_c, &word_starts_c);
VisitInfoVector visits_c = CreateVisitInfoVector(3, 10, now);
visits_c[0].second = ui::PAGE_TRANSITION_TYPED;
- ScoredHistoryMatch scored_c(row_c, visits_c, ASCIIToUTF16("abc"),
- Make1Term("abc"), one_word_no_offset,
- word_starts_c, false, 1, now);
+ ScoredHistoryMatch scored_c(row_c, visits_c, u"abc", Make1Term("abc"),
+ one_word_no_offset, word_starts_c, false, 1, now);
EXPECT_GT(scored_c.raw_score, scored_a.raw_score);
// Test scores based on typed_count.
@@ -184,9 +181,8 @@
visits_d[0].second = ui::PAGE_TRANSITION_TYPED;
visits_d[1].second = ui::PAGE_TRANSITION_TYPED;
visits_d[2].second = ui::PAGE_TRANSITION_TYPED;
- ScoredHistoryMatch scored_d(row_d, visits_d, ASCIIToUTF16("abc"),
- Make1Term("abc"), one_word_no_offset,
- word_starts_d, false, 1, now);
+ ScoredHistoryMatch scored_d(row_d, visits_d, u"abc", Make1Term("abc"),
+ one_word_no_offset, word_starts_d, false, 1, now);
EXPECT_GT(scored_d.raw_score, scored_a.raw_score);
// Test scores based on a terms appearing multiple times.
@@ -196,16 +192,14 @@
RowWordStarts word_starts_e;
PopulateWordStarts(row_e, &word_starts_e);
const VisitInfoVector visits_e = visits_d;
- ScoredHistoryMatch scored_e(row_e, visits_e, ASCIIToUTF16("csi"),
- Make1Term("csi"), one_word_no_offset,
- word_starts_e, false, 1, now);
+ ScoredHistoryMatch scored_e(row_e, visits_e, u"csi", Make1Term("csi"),
+ one_word_no_offset, word_starts_e, false, 1, now);
EXPECT_LT(scored_e.raw_score, 1400);
// Test that a result with only a mid-term match (i.e., not at a word
// boundary) scores 0.
- ScoredHistoryMatch scored_f(row_a, visits_a, ASCIIToUTF16("cd"),
- Make1Term("cd"), one_word_no_offset,
- word_starts_a, false, 1, now);
+ ScoredHistoryMatch scored_f(row_a, visits_a, u"cd", Make1Term("cd"),
+ one_word_no_offset, word_starts_a, false, 1, now);
EXPECT_EQ(scored_f.raw_score, 0);
}
@@ -221,13 +215,13 @@
PopulateWordStarts(row, &word_starts);
WordStarts one_word_no_offset(1, 0u);
VisitInfoVector visits = CreateVisitInfoVector(8, 3, now);
- ScoredHistoryMatch scored(row, visits, ASCIIToUTF16("abc"), Make1Term("abc"),
+ ScoredHistoryMatch scored(row, visits, u"abc", Make1Term("abc"),
one_word_no_offset, word_starts, false, 1, now);
// Now check that if URL is bookmarked then its score increases.
base::AutoReset<float> reset(&ScoredHistoryMatch::bookmark_value_, 5);
- ScoredHistoryMatch scored_with_bookmark(row, visits, ASCIIToUTF16("abc"),
- Make1Term("abc"), one_word_no_offset,
- word_starts, true, 1, now);
+ ScoredHistoryMatch scored_with_bookmark(row, visits, u"abc", Make1Term("abc"),
+ one_word_no_offset, word_starts, true,
+ 1, now);
EXPECT_GT(scored_with_bookmark.raw_score, scored.raw_score);
}
@@ -244,16 +238,15 @@
PopulateWordStarts(row, &word_starts);
WordStarts two_words_no_offsets(2, 0u);
VisitInfoVector visits = CreateVisitInfoVector(8, 3, now);
- ScoredHistoryMatch scored(row, visits, ASCIIToUTF16("fed com"),
- Make2Terms("fed", "com"), two_words_no_offsets,
- word_starts, false, 1, now);
+ ScoredHistoryMatch scored(row, visits, u"fed com", Make2Terms("fed", "com"),
+ two_words_no_offsets, word_starts, false, 1, now);
EXPECT_GT(scored.raw_score, 0);
// Now allow credit for the match in the TLD.
base::AutoReset<bool> reset(&ScoredHistoryMatch::allow_tld_matches_, true);
ScoredHistoryMatch scored_with_tld(
- row, visits, ASCIIToUTF16("fed com"), Make2Terms("fed", "com"),
- two_words_no_offsets, word_starts, false, 1, now);
+ row, visits, u"fed com", Make2Terms("fed", "com"), two_words_no_offsets,
+ word_starts, false, 1, now);
EXPECT_GT(scored_with_tld.raw_score, 0);
EXPECT_GT(scored_with_tld.raw_score, scored.raw_score);
@@ -272,16 +265,15 @@
PopulateWordStarts(row, &word_starts);
WordStarts two_words_no_offsets(2, 0u);
VisitInfoVector visits = CreateVisitInfoVector(8, 3, now);
- ScoredHistoryMatch scored(row, visits, ASCIIToUTF16("fed http"),
- Make2Terms("fed", "http"), two_words_no_offsets,
- word_starts, false, 1, now);
+ ScoredHistoryMatch scored(row, visits, u"fed http", Make2Terms("fed", "http"),
+ two_words_no_offsets, word_starts, false, 1, now);
EXPECT_GT(scored.raw_score, 0);
// Now allow credit for the match in the scheme.
base::AutoReset<bool> reset(&ScoredHistoryMatch::allow_scheme_matches_, true);
ScoredHistoryMatch scored_with_scheme(
- row, visits, ASCIIToUTF16("fed http"), Make2Terms("fed", "http"),
- two_words_no_offsets, word_starts, false, 1, now);
+ row, visits, u"fed http", Make2Terms("fed", "http"), two_words_no_offsets,
+ word_starts, false, 1, now);
EXPECT_GT(scored_with_scheme.raw_score, 0);
EXPECT_GT(scored_with_scheme.raw_score, scored.raw_score);
@@ -299,19 +291,19 @@
history::URLRow row(
MakeURLRow("http://www.google.com", "abcdef", 3, 30, 1));
PopulateWordStarts(row, &word_starts);
- ScoredHistoryMatch scored_a(row, visits, ASCIIToUTF16("g"), Make1Term("g"),
+ ScoredHistoryMatch scored_a(row, visits, u"g", Make1Term("g"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_a.match_in_scheme);
EXPECT_FALSE(scored_a.match_in_subdomain);
- ScoredHistoryMatch scored_b(row, visits, ASCIIToUTF16("w"), Make1Term("w"),
+ ScoredHistoryMatch scored_b(row, visits, u"w", Make1Term("w"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_b.match_in_scheme);
EXPECT_TRUE(scored_b.match_in_subdomain);
- ScoredHistoryMatch scored_c(row, visits, ASCIIToUTF16("h"), Make1Term("h"),
+ ScoredHistoryMatch scored_c(row, visits, u"h", Make1Term("h"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_TRUE(scored_c.match_in_scheme);
EXPECT_FALSE(scored_c.match_in_subdomain);
- ScoredHistoryMatch scored_d(row, visits, ASCIIToUTF16("o"), Make1Term("o"),
+ ScoredHistoryMatch scored_d(row, visits, u"o", Make1Term("o"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_d.match_in_scheme);
EXPECT_FALSE(scored_d.match_in_subdomain);
@@ -320,15 +312,15 @@
{
history::URLRow row(MakeURLRow("http://teams.foo.com", "abcdef", 3, 30, 1));
PopulateWordStarts(row, &word_starts);
- ScoredHistoryMatch scored_a(row, visits, ASCIIToUTF16("t"), Make1Term("t"),
+ ScoredHistoryMatch scored_a(row, visits, u"t", Make1Term("t"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_a.match_in_scheme);
EXPECT_TRUE(scored_a.match_in_subdomain);
- ScoredHistoryMatch scored_b(row, visits, ASCIIToUTF16("f"), Make1Term("f"),
+ ScoredHistoryMatch scored_b(row, visits, u"f", Make1Term("f"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_b.match_in_scheme);
EXPECT_FALSE(scored_b.match_in_subdomain);
- ScoredHistoryMatch scored_c(row, visits, ASCIIToUTF16("o"), Make1Term("o"),
+ ScoredHistoryMatch scored_c(row, visits, u"o", Make1Term("o"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_c.match_in_scheme);
EXPECT_FALSE(scored_c.match_in_subdomain);
@@ -337,15 +329,15 @@
{
history::URLRow row(MakeURLRow("http://en.m.foo.com", "abcdef", 3, 30, 1));
PopulateWordStarts(row, &word_starts);
- ScoredHistoryMatch scored_a(row, visits, ASCIIToUTF16("e"), Make1Term("e"),
+ ScoredHistoryMatch scored_a(row, visits, u"e", Make1Term("e"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_a.match_in_scheme);
EXPECT_TRUE(scored_a.match_in_subdomain);
- ScoredHistoryMatch scored_b(row, visits, ASCIIToUTF16("m"), Make1Term("m"),
+ ScoredHistoryMatch scored_b(row, visits, u"m", Make1Term("m"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_b.match_in_scheme);
EXPECT_TRUE(scored_b.match_in_subdomain);
- ScoredHistoryMatch scored_c(row, visits, ASCIIToUTF16("f"), Make1Term("f"),
+ ScoredHistoryMatch scored_c(row, visits, u"f", Make1Term("f"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_c.match_in_scheme);
EXPECT_FALSE(scored_c.match_in_subdomain);
@@ -355,42 +347,41 @@
history::URLRow row(
MakeURLRow("https://www.testing.com/xxx?yyy#zzz", "abcdef", 3, 30, 1));
PopulateWordStarts(row, &word_starts);
- ScoredHistoryMatch scored_a(row, visits, ASCIIToUTF16("t"), Make1Term("t"),
+ ScoredHistoryMatch scored_a(row, visits, u"t", Make1Term("t"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_a.match_in_scheme);
EXPECT_FALSE(scored_a.match_in_subdomain);
- ScoredHistoryMatch scored_b(row, visits, ASCIIToUTF16("h"), Make1Term("h"),
+ ScoredHistoryMatch scored_b(row, visits, u"h", Make1Term("h"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_TRUE(scored_b.match_in_scheme);
EXPECT_FALSE(scored_b.match_in_subdomain);
- ScoredHistoryMatch scored_c(row, visits, ASCIIToUTF16("w"), Make1Term("w"),
+ ScoredHistoryMatch scored_c(row, visits, u"w", Make1Term("w"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_c.match_in_scheme);
EXPECT_TRUE(scored_c.match_in_subdomain);
- ScoredHistoryMatch scored_d(row, visits, ASCIIToUTF16("x"), Make1Term("x"),
+ ScoredHistoryMatch scored_d(row, visits, u"x", Make1Term("x"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_d.match_in_scheme);
EXPECT_FALSE(scored_d.match_in_subdomain);
- ScoredHistoryMatch scored_e(row, visits, ASCIIToUTF16("y"), Make1Term("y"),
+ ScoredHistoryMatch scored_e(row, visits, u"y", Make1Term("y"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_e.match_in_scheme);
EXPECT_FALSE(scored_e.match_in_subdomain);
- ScoredHistoryMatch scored_f(row, visits, ASCIIToUTF16("z"), Make1Term("z"),
+ ScoredHistoryMatch scored_f(row, visits, u"z", Make1Term("z"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_f.match_in_scheme);
EXPECT_FALSE(scored_f.match_in_subdomain);
- ScoredHistoryMatch scored_g(row, visits, ASCIIToUTF16("https://www"),
+ ScoredHistoryMatch scored_g(row, visits, u"https://www",
Make1Term("https://www"), one_word_no_offset,
word_starts, false, 1, now);
EXPECT_TRUE(scored_g.match_in_scheme);
EXPECT_TRUE(scored_g.match_in_subdomain);
- ScoredHistoryMatch scored_h(row, visits, ASCIIToUTF16("testing.com/x"),
+ ScoredHistoryMatch scored_h(row, visits, u"testing.com/x",
Make1Term("testing.com/x"), one_word_no_offset,
word_starts, false, 1, now);
EXPECT_FALSE(scored_h.match_in_scheme);
EXPECT_FALSE(scored_h.match_in_subdomain);
- ScoredHistoryMatch scored_i(row, visits,
- ASCIIToUTF16("https://www.testing.com/x"),
+ ScoredHistoryMatch scored_i(row, visits, u"https://www.testing.com/x",
Make1Term("https://www.testing.com/x"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_TRUE(scored_i.match_in_scheme);
@@ -401,16 +392,15 @@
history::URLRow row(
MakeURLRow("http://www.xn--1lq90ic7f1rc.cn/xnblah", "abcd", 3, 30, 1));
PopulateWordStarts(row, &word_starts);
- ScoredHistoryMatch scored_a(row, visits, ASCIIToUTF16("x"), Make1Term("x"),
+ ScoredHistoryMatch scored_a(row, visits, u"x", Make1Term("x"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_a.match_in_scheme);
EXPECT_FALSE(scored_a.match_in_subdomain);
- ScoredHistoryMatch scored_b(row, visits, ASCIIToUTF16("xn"),
- Make1Term("xn"), one_word_no_offset,
- word_starts, false, 1, now);
+ ScoredHistoryMatch scored_b(row, visits, u"xn", Make1Term("xn"),
+ one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_b.match_in_scheme);
EXPECT_FALSE(scored_b.match_in_subdomain);
- ScoredHistoryMatch scored_c(row, visits, ASCIIToUTF16("w"), Make1Term("w"),
+ ScoredHistoryMatch scored_c(row, visits, u"w", Make1Term("w"),
one_word_no_offset, word_starts, false, 1, now);
EXPECT_FALSE(scored_c.match_in_scheme);
EXPECT_TRUE(scored_c.match_in_subdomain);
@@ -419,11 +409,9 @@
TEST_F(ScoredHistoryMatchTest, GetTopicalityScoreTrailingSlash) {
const float hostname = GetTopicalityScoreOfTermAgainstURLAndTitle(
- {"def"}, {0}, GURL("http://abc.def.com/"),
- ASCIIToUTF16("Non-Matching Title"));
+ {"def"}, {0}, GURL("http://abc.def.com/"), u"Non-Matching Title");
const float hostname_no_slash = GetTopicalityScoreOfTermAgainstURLAndTitle(
- {"def"}, {0}, GURL("http://abc.def.com"),
- ASCIIToUTF16("Non-Matching Title"));
+ {"def"}, {0}, GURL("http://abc.def.com"), u"Non-Matching Title");
EXPECT_EQ(hostname_no_slash, hostname);
}
@@ -572,8 +560,8 @@
PopulateWordStarts(row, &row_word_starts);
base::Time now(base::Time::Max());
VisitInfoVector visits;
- ScoredHistoryMatch match(row, visits, ASCIIToUTF16("foo"), Make1Term("foo"),
- WordStarts{0}, row_word_starts, false, 1, now);
+ ScoredHistoryMatch match(row, visits, u"foo", Make1Term("foo"), WordStarts{0},
+ row_word_starts, false, 1, now);
// Record the score for one untyped visit.
visits = {{now, ui::PAGE_TRANSITION_LINK}};
@@ -632,8 +620,8 @@
PopulateWordStarts(row, &row_word_starts);
base::Time now(base::Time::Max());
VisitInfoVector visits;
- ScoredHistoryMatch match(row, visits, ASCIIToUTF16("foo"), Make1Term("foo"),
- WordStarts{0}, row_word_starts, false, 1, now);
+ ScoredHistoryMatch match(row, visits, u"foo", Make1Term("foo"), WordStarts{0},
+ row_word_starts, false, 1, now);
EXPECT_EQ(3.0, match.GetDocumentSpecificityScore(1));
EXPECT_EQ(1.0, match.GetDocumentSpecificityScore(5));
@@ -659,7 +647,7 @@
// once somewhere in the URL or title.
TEST_F(ScoredHistoryMatchTest, GetTopicalityScore) {
GURL url("http://abc.def.com/path1/path2?arg1=val1&arg2=val2#hash_fragment");
- std::u16string title = ASCIIToUTF16("here is a - title");
+ std::u16string title = u"here is a - title";
auto Score = [&](const std::vector<std::string>& term_vector,
const WordStarts term_word_starts) {
return GetTopicalityScoreOfTermAgainstURLAndTitle(
@@ -731,7 +719,7 @@
TEST_F(ScoredHistoryMatchTest, GetTopicalityScore_MidwordMatching) {
GURL url("http://abc.def.com/path1/path2?arg1=val1&arg2=val2#hash_fragment");
- std::u16string title = ASCIIToUTF16("here is a - title");
+ std::u16string title = u"here is a - title";
auto Score = [&](const std::vector<std::string>& term_vector,
const WordStarts term_word_starts) {
return GetTopicalityScoreOfTermAgainstURLAndTitle(
diff --git a/components/omnibox/browser/search_suggestion_parser_unittest.cc b/components/omnibox/browser/search_suggestion_parser_unittest.cc
index 36cfa20..5ed3572 100644
--- a/components/omnibox/browser/search_suggestion_parser_unittest.cc
+++ b/components/omnibox/browser/search_suggestion_parser_unittest.cc
@@ -126,8 +126,8 @@
base::Optional<base::Value> root_val = base::JSONReader::Read(json_data);
ASSERT_TRUE(root_val);
TestSchemeClassifier scheme_classifier;
- AutocompleteInput input(base::ASCIIToUTF16("chris"),
- metrics::OmniboxEventProto::NTP, scheme_classifier);
+ AutocompleteInput input(u"chris", metrics::OmniboxEventProto::NTP,
+ scheme_classifier);
SearchSuggestionParser::Results results;
ASSERT_TRUE(SearchSuggestionParser::ParseSuggestResults(
*root_val, input, scheme_classifier, /*default_result_relevance=*/400,
@@ -140,18 +140,16 @@
ASSERT_EQ(851, results.verbatim_relevance);
{
const auto& suggestion_result = results.suggest_results[0];
- ASSERT_EQ(base::ASCIIToUTF16("christmas"), suggestion_result.suggestion());
- ASSERT_EQ(base::ASCIIToUTF16(""), suggestion_result.annotation());
+ ASSERT_EQ(u"christmas", suggestion_result.suggestion());
+ ASSERT_EQ(u"", suggestion_result.annotation());
// This entry has no image.
ASSERT_EQ("", suggestion_result.image_dominant_color());
ASSERT_EQ(GURL(), suggestion_result.image_url());
}
{
const auto& suggestion_result = results.suggest_results[1];
- ASSERT_EQ(base::ASCIIToUTF16("christopher doe"),
- suggestion_result.suggestion());
- ASSERT_EQ(base::ASCIIToUTF16("American author"),
- suggestion_result.annotation());
+ ASSERT_EQ(u"christopher doe", suggestion_result.suggestion());
+ ASSERT_EQ(u"American author", suggestion_result.annotation());
ASSERT_EQ("#424242", suggestion_result.image_dominant_color());
ASSERT_EQ(GURL("http://example.com/a.png"), suggestion_result.image_url());
}
@@ -159,8 +157,8 @@
TEST(SearchSuggestionParserTest, SuggestClassification) {
SearchSuggestionParser::SuggestResult result(
- base::ASCIIToUTF16("foobar"), AutocompleteMatchType::SEARCH_SUGGEST, {},
- false, 400, true, std::u16string());
+ u"foobar", AutocompleteMatchType::SEARCH_SUGGEST, {}, false, 400, true,
+ std::u16string());
AutocompleteMatch::ValidateClassifications(result.match_contents(),
result.match_contents_class());
@@ -173,7 +171,7 @@
EXPECT_EQ(kNone, result.match_contents_class());
// Test a simple case of bolding half the text.
- result.ClassifyMatchContents(false, base::ASCIIToUTF16("foo"));
+ result.ClassifyMatchContents(false, u"foo");
AutocompleteMatch::ValidateClassifications(result.match_contents(),
result.match_contents_class());
const ACMatchClassifications kHalfBolded = {
@@ -185,13 +183,13 @@
// would otherwise bold-all, we leave the existing classifications alone.
// This is weird, but it's in the function contract, and is useful for
// flicker-free search suggestions as the user types.
- result.ClassifyMatchContents(false, base::ASCIIToUTF16("apple"));
+ result.ClassifyMatchContents(false, u"apple");
AutocompleteMatch::ValidateClassifications(result.match_contents(),
result.match_contents_class());
EXPECT_EQ(kHalfBolded, result.match_contents_class());
// And finally, test the case where we do allow bolding-all.
- result.ClassifyMatchContents(true, base::ASCIIToUTF16("apple"));
+ result.ClassifyMatchContents(true, u"apple");
AutocompleteMatch::ValidateClassifications(result.match_contents(),
result.match_contents_class());
const ACMatchClassifications kBoldAll = {
@@ -204,7 +202,7 @@
SearchSuggestionParser::NavigationResult result(
scheme_classifier, GURL("https://news.google.com/"),
AutocompleteMatchType::Type::NAVSUGGEST, {}, std::u16string(),
- std::string(), false, 400, true, base::ASCIIToUTF16("google"));
+ std::string(), false, 400, true, u"google");
AutocompleteMatch::ValidateClassifications(result.match_contents(),
result.match_contents_class());
const ACMatchClassifications kBoldMiddle = {
@@ -216,13 +214,11 @@
// Reclassifying in a way that would cause bold-none if it's disallowed should
// do nothing.
- result.CalculateAndClassifyMatchContents(
- false, base::ASCIIToUTF16("term not found"));
+ result.CalculateAndClassifyMatchContents(false, u"term not found");
EXPECT_EQ(kBoldMiddle, result.match_contents_class());
// Test the allow bold-nothing case too.
- result.CalculateAndClassifyMatchContents(
- true, base::ASCIIToUTF16("term not found"));
+ result.CalculateAndClassifyMatchContents(true, u"term not found");
const ACMatchClassifications kAnnotateUrlOnly = {
{0, AutocompleteMatch::ACMatchClassification::URL}};
EXPECT_EQ(kAnnotateUrlOnly, result.match_contents_class());
@@ -273,8 +269,7 @@
base::Optional<base::Value> root_val = base::JSONReader::Read(json_data);
ASSERT_TRUE(root_val);
TestSchemeClassifier scheme_classifier;
- AutocompleteInput input(base::ASCIIToUTF16(""),
- metrics::OmniboxEventProto::NTP_REALBOX,
+ AutocompleteInput input(u"", metrics::OmniboxEventProto::NTP_REALBOX,
scheme_classifier);
SearchSuggestionParser::Results results;
ASSERT_TRUE(SearchSuggestionParser::ParseSuggestResults(
@@ -287,25 +282,23 @@
{
const auto& suggestion_result = results.suggest_results[0];
- ASSERT_EQ(base::ASCIIToUTF16("los angeles"),
- suggestion_result.suggestion());
+ ASSERT_EQ(u"los angeles", suggestion_result.suggestion());
// This suggestion does not belong to a group.
ASSERT_EQ(base::nullopt, suggestion_result.suggestion_group_id());
}
{
const auto& suggestion_result = results.suggest_results[1];
- ASSERT_EQ(base::ASCIIToUTF16("san diego"), suggestion_result.suggestion());
+ ASSERT_EQ(u"san diego", suggestion_result.suggestion());
ASSERT_EQ(40007, *suggestion_result.suggestion_group_id());
}
{
const auto& suggestion_result = results.suggest_results[2];
- ASSERT_EQ(base::ASCIIToUTF16("las vegas"), suggestion_result.suggestion());
+ ASSERT_EQ(u"las vegas", suggestion_result.suggestion());
ASSERT_EQ(40008, *suggestion_result.suggestion_group_id());
}
{
const auto& suggestion_result = results.suggest_results[3];
- ASSERT_EQ(base::ASCIIToUTF16("san francisco"),
- suggestion_result.suggestion());
+ ASSERT_EQ(u"san francisco", suggestion_result.suggestion());
ASSERT_EQ(40009, *suggestion_result.suggestion_group_id());
}
}
@@ -325,8 +318,7 @@
base::Optional<base::Value> root_val = base::JSONReader::Read(json_data);
ASSERT_TRUE(root_val);
TestSchemeClassifier scheme_classifier;
- AutocompleteInput input(base::ASCIIToUTF16(""),
- metrics::OmniboxEventProto::NTP_REALBOX,
+ AutocompleteInput input(u"", metrics::OmniboxEventProto::NTP_REALBOX,
scheme_classifier);
SearchSuggestionParser::Results results;
ASSERT_TRUE(SearchSuggestionParser::ParseSuggestResults(
@@ -335,22 +327,22 @@
{
const auto& suggestion_result = results.suggest_results[0];
- ASSERT_EQ(base::ASCIIToUTF16("one"), suggestion_result.suggestion());
+ ASSERT_EQ(u"one", suggestion_result.suggestion());
ASSERT_THAT(suggestion_result.subtypes(), testing::ElementsAre(1));
}
{
const auto& suggestion_result = results.suggest_results[1];
- ASSERT_EQ(base::ASCIIToUTF16("two"), suggestion_result.suggestion());
+ ASSERT_EQ(u"two", suggestion_result.suggestion());
ASSERT_THAT(suggestion_result.subtypes(), testing::ElementsAre(21, 22));
}
{
const auto& suggestion_result = results.suggest_results[2];
- ASSERT_EQ(base::ASCIIToUTF16("three"), suggestion_result.suggestion());
+ ASSERT_EQ(u"three", suggestion_result.suggestion());
ASSERT_THAT(suggestion_result.subtypes(), testing::ElementsAre(31, 32, 33));
}
{
const auto& suggestion_result = results.suggest_results[3];
- ASSERT_EQ(base::ASCIIToUTF16("four"), suggestion_result.suggestion());
+ ASSERT_EQ(u"four", suggestion_result.suggestion());
ASSERT_THAT(suggestion_result.subtypes(), testing::ElementsAre(44));
}
}
@@ -371,8 +363,7 @@
base::Optional<base::Value> root_val = base::JSONReader::Read(json_data);
ASSERT_TRUE(root_val);
TestSchemeClassifier scheme_classifier;
- AutocompleteInput input(base::ASCIIToUTF16(""),
- metrics::OmniboxEventProto::NTP_REALBOX,
+ AutocompleteInput input(u"", metrics::OmniboxEventProto::NTP_REALBOX,
scheme_classifier);
SearchSuggestionParser::Results results;
ASSERT_TRUE(SearchSuggestionParser::ParseSuggestResults(
@@ -399,8 +390,7 @@
base::Optional<base::Value> root_val = base::JSONReader::Read(json_data);
ASSERT_TRUE(root_val);
TestSchemeClassifier scheme_classifier;
- AutocompleteInput input(base::ASCIIToUTF16(""),
- metrics::OmniboxEventProto::NTP_REALBOX,
+ AutocompleteInput input(u"", metrics::OmniboxEventProto::NTP_REALBOX,
scheme_classifier);
SearchSuggestionParser::Results results;
ASSERT_TRUE(SearchSuggestionParser::ParseSuggestResults(
@@ -429,8 +419,7 @@
base::Optional<base::Value> root_val = base::JSONReader::Read(json_data);
ASSERT_TRUE(root_val);
TestSchemeClassifier scheme_classifier;
- AutocompleteInput input(base::ASCIIToUTF16(""),
- metrics::OmniboxEventProto::NTP_REALBOX,
+ AutocompleteInput input(u"", metrics::OmniboxEventProto::NTP_REALBOX,
scheme_classifier);
SearchSuggestionParser::Results results;
ASSERT_TRUE(SearchSuggestionParser::ParseSuggestResults(
@@ -460,8 +449,7 @@
base::Optional<base::Value> root_val = base::JSONReader::Read(json_data);
ASSERT_TRUE(root_val);
TestSchemeClassifier scheme_classifier;
- AutocompleteInput input(base::ASCIIToUTF16(""),
- metrics::OmniboxEventProto::NTP_REALBOX,
+ AutocompleteInput input(u"", metrics::OmniboxEventProto::NTP_REALBOX,
scheme_classifier);
SearchSuggestionParser::Results results;
ASSERT_TRUE(SearchSuggestionParser::ParseSuggestResults(
@@ -488,8 +476,7 @@
base::Optional<base::Value> root_val = base::JSONReader::Read(json_data);
ASSERT_TRUE(root_val);
TestSchemeClassifier scheme_classifier;
- AutocompleteInput input(base::ASCIIToUTF16(""),
- metrics::OmniboxEventProto::NTP_REALBOX,
+ AutocompleteInput input(u"", metrics::OmniboxEventProto::NTP_REALBOX,
scheme_classifier);
SearchSuggestionParser::Results results;
ASSERT_TRUE(SearchSuggestionParser::ParseSuggestResults(
diff --git a/components/omnibox/browser/shortcuts_backend_unittest.cc b/components/omnibox/browser/shortcuts_backend_unittest.cc
index a35c218..6711aaf 100644
--- a/components/omnibox/browser/shortcuts_backend_unittest.cc
+++ b/components/omnibox/browser/shortcuts_backend_unittest.cc
@@ -83,7 +83,7 @@
AutocompleteMatch::Type type) {
AutocompleteMatch match(nullptr, 0, 0, type);
match.destination_url = GURL(url);
- match.contents = base::ASCIIToUTF16("test");
+ match.contents = u"test";
match.contents_class =
AutocompleteMatch::ClassificationsFromString(contents_class);
match.description_class =
@@ -298,7 +298,7 @@
EXPECT_FALSE(changed_notified());
ShortcutsDatabase::Shortcut shortcut(
- "BD85DBA2-8C29-49F9-84AE-48E1E90880DF", base::ASCIIToUTF16("goog"),
+ "BD85DBA2-8C29-49F9-84AE-48E1E90880DF", u"goog",
MatchCoreForTesting("http://www.google.com"), base::Time::Now(), 100);
EXPECT_TRUE(AddShortcut(shortcut));
EXPECT_TRUE(changed_notified());
@@ -309,7 +309,7 @@
shortcut_iter->second.match_core.contents);
set_changed_notified(false);
- shortcut.match_core.contents = base::ASCIIToUTF16("Google Web Search");
+ shortcut.match_core.contents = u"Google Web Search";
EXPECT_TRUE(UpdateShortcut(shortcut));
EXPECT_TRUE(changed_notified());
shortcut_iter = shortcuts_map().find(shortcut.text);
@@ -322,22 +322,22 @@
TEST_F(ShortcutsBackendTest, DeleteShortcuts) {
InitBackend();
ShortcutsDatabase::Shortcut shortcut1(
- "BD85DBA2-8C29-49F9-84AE-48E1E90880DF", base::ASCIIToUTF16("goog"),
+ "BD85DBA2-8C29-49F9-84AE-48E1E90880DF", u"goog",
MatchCoreForTesting("http://www.google.com"), base::Time::Now(), 100);
EXPECT_TRUE(AddShortcut(shortcut1));
ShortcutsDatabase::Shortcut shortcut2(
- "BD85DBA2-8C29-49F9-84AE-48E1E90880E0", base::ASCIIToUTF16("gle"),
+ "BD85DBA2-8C29-49F9-84AE-48E1E90880E0", u"gle",
MatchCoreForTesting("http://www.google.com"), base::Time::Now(), 100);
EXPECT_TRUE(AddShortcut(shortcut2));
ShortcutsDatabase::Shortcut shortcut3(
- "BD85DBA2-8C29-49F9-84AE-48E1E90880E1", base::ASCIIToUTF16("sp"),
+ "BD85DBA2-8C29-49F9-84AE-48E1E90880E1", u"sp",
MatchCoreForTesting("http://www.sport.com"), base::Time::Now(), 10);
EXPECT_TRUE(AddShortcut(shortcut3));
ShortcutsDatabase::Shortcut shortcut4(
- "BD85DBA2-8C29-49F9-84AE-48E1E90880E2", base::ASCIIToUTF16("mov"),
+ "BD85DBA2-8C29-49F9-84AE-48E1E90880E2", u"mov",
MatchCoreForTesting("http://www.film.com"), base::Time::Now(), 10);
EXPECT_TRUE(AddShortcut(shortcut4));
diff --git a/components/omnibox/browser/shortcuts_database_unittest.cc b/components/omnibox/browser/shortcuts_database_unittest.cc
index 71d127c..1e0f493 100644
--- a/components/omnibox/browser/shortcuts_database_unittest.cc
+++ b/components/omnibox/browser/shortcuts_database_unittest.cc
@@ -209,7 +209,7 @@
AddAll();
ShortcutsDatabase::Shortcut shortcut(
ShortcutFromTestInfo(shortcut_test_db[1]));
- shortcut.match_core.contents = ASCIIToUTF16("gro.todhsals");
+ shortcut.match_core.contents = u"gro.todhsals";
EXPECT_TRUE(db_->UpdateShortcut(shortcut));
ShortcutsDatabase::GuidToShortcutMap shortcuts;
db_->LoadShortcuts(&shortcuts);
diff --git a/components/omnibox/browser/shortcuts_provider_unittest.cc b/components/omnibox/browser/shortcuts_provider_unittest.cc
index c9f57f4..296d00e 100644
--- a/components/omnibox/browser/shortcuts_provider_unittest.cc
+++ b/components/omnibox/browser/shortcuts_provider_unittest.cc
@@ -235,12 +235,12 @@
// Actual tests ---------------------------------------------------------------
TEST_F(ShortcutsProviderTest, SimpleSingleMatch) {
- std::u16string text(ASCIIToUTF16("go"));
+ std::u16string text(u"go");
std::string expected_url("http://www.google.com/");
ExpectedURLs expected_urls;
expected_urls.push_back(ExpectedURLAndAllowedToBeDefault(expected_url, true));
RunShortcutsProviderTest(provider_, text, false, expected_urls, expected_url,
- ASCIIToUTF16("ogle.com"));
+ u"ogle.com");
// Same test with prevent inline autocomplete.
expected_urls.clear();
@@ -249,12 +249,12 @@
// The match will have an |inline_autocompletion| set, but the value will not
// be used because |allowed_to_be_default_match| will be false.
RunShortcutsProviderTest(provider_, text, true, expected_urls, expected_url,
- ASCIIToUTF16("ogle.com"));
+ u"ogle.com");
// A pair of analogous tests where the shortcut ends at the end of
// |fill_into_edit|. This exercises the inline autocompletion and default
// match code.
- text = ASCIIToUTF16("abcdef.com");
+ text = u"abcdef.com";
expected_url = "http://abcdef.com/";
expected_urls.clear();
expected_urls.push_back(ExpectedURLAndAllowedToBeDefault(expected_url, true));
@@ -267,12 +267,12 @@
// Another test, simply for a query match type, not a navigation URL match
// type.
- text = ASCIIToUTF16("que");
+ text = u"que";
expected_url = "https://www.google.com/search?q=query";
expected_urls.clear();
expected_urls.push_back(ExpectedURLAndAllowedToBeDefault(expected_url, true));
RunShortcutsProviderTest(provider_, text, false, expected_urls, expected_url,
- ASCIIToUTF16("ry"));
+ u"ry");
// Same test with prevent inline autocomplete.
expected_urls.clear();
@@ -281,12 +281,12 @@
// The match will have an |inline_autocompletion| set, but the value will not
// be used because |allowed_to_be_default_match| will be false.
RunShortcutsProviderTest(provider_, text, true, expected_urls, expected_url,
- ASCIIToUTF16("ry"));
+ u"ry");
// A pair of analogous tests where the shortcut ends at the end of
// |fill_into_edit|. This exercises the inline autocompletion and default
// match code.
- text = ASCIIToUTF16("query");
+ text = u"query";
expected_urls.clear();
expected_urls.push_back(ExpectedURLAndAllowedToBeDefault(expected_url, true));
RunShortcutsProviderTest(provider_, text, false, expected_urls, expected_url,
@@ -299,7 +299,7 @@
// Now the shortcut ends at the end of |fill_into_edit| but has a
// non-droppable prefix. ("www.", for instance, is not droppable for
// queries.)
- text = ASCIIToUTF16("word");
+ text = u"word";
expected_url = "https://www.google.com/search?q=www.word";
expected_urls.clear();
expected_urls.push_back(
@@ -312,12 +312,12 @@
// involving URLs that need to be fixed up to match properly.
TEST_F(ShortcutsProviderTest, TrickySingleMatch) {
// Test that about: URLs are fixed up/transformed to chrome:// URLs.
- std::u16string text(ASCIIToUTF16("about:o"));
+ std::u16string text(u"about:o");
std::string expected_url("chrome://omnibox/");
ExpectedURLs expected_urls;
expected_urls.push_back(ExpectedURLAndAllowedToBeDefault(expected_url, true));
RunShortcutsProviderTest(provider_, text, false, expected_urls, expected_url,
- ASCIIToUTF16("mnibox"));
+ u"mnibox");
// Same test with prevent inline autocomplete.
expected_urls.clear();
@@ -326,16 +326,16 @@
// The match will have an |inline_autocompletion| set, but the value will not
// be used because |allowed_to_be_default_match| will be false.
RunShortcutsProviderTest(provider_, text, true, expected_urls, expected_url,
- ASCIIToUTF16("mnibox"));
+ u"mnibox");
// Test that an input with a space can match URLs with a (escaped) space.
// This would fail if we didn't try to lookup the un-fixed-up string.
- text = ASCIIToUTF16("www/real sp");
+ text = u"www/real sp";
expected_url = "http://www/real%20space/long-url-with-space.html";
expected_urls.clear();
expected_urls.push_back(ExpectedURLAndAllowedToBeDefault(expected_url, true));
RunShortcutsProviderTest(provider_, text, false, expected_urls, expected_url,
- ASCIIToUTF16("ace/long-url-with-space.html"));
+ u"ace/long-url-with-space.html");
// Same test with prevent inline autocomplete.
expected_urls.clear();
@@ -344,11 +344,11 @@
// The match will have an |inline_autocompletion| set, but the value will not
// be used because |allowed_to_be_default_match| will be false.
RunShortcutsProviderTest(provider_, text, true, expected_urls, expected_url,
- ASCIIToUTF16("ace/long-url-with-space.html"));
+ u"ace/long-url-with-space.html");
// Test when the user input has a typo that can be fixed up for matching
// fill_into_edit. This should still be allowed to be default.
- text = ASCIIToUTF16("http:///foo.com");
+ text = u"http:///foo.com";
expected_url = "http://foo.com/";
expected_urls.clear();
expected_urls.push_back(ExpectedURLAndAllowedToBeDefault(expected_url, true));
@@ -362,34 +362,34 @@
// of these with-trailing-space cases, we actually get an
// inline_autocompletion, though it's never used because the match is
// prohibited from being default.
- text = ASCIIToUTF16("trailing1");
+ text = u"trailing1";
expected_url = "http://trailing1.com/";
expected_urls.clear();
expected_urls.push_back(ExpectedURLAndAllowedToBeDefault(expected_url, true));
RunShortcutsProviderTest(provider_, text, false, expected_urls, expected_url,
- ASCIIToUTF16(".com"));
- text = ASCIIToUTF16("trailing1 ");
+ u".com");
+ text = u"trailing1 ";
expected_urls.clear();
expected_urls.push_back(
ExpectedURLAndAllowedToBeDefault(expected_url, false));
RunShortcutsProviderTest(provider_, text, false, expected_urls, expected_url,
- ASCIIToUTF16(".com"));
- text = ASCIIToUTF16("about:trailing2");
+ u".com");
+ text = u"about:trailing2";
expected_url = "chrome://trailing2blah/";
expected_urls.clear();
expected_urls.push_back(ExpectedURLAndAllowedToBeDefault(expected_url, true));
RunShortcutsProviderTest(provider_, text, false, expected_urls, expected_url,
- ASCIIToUTF16("blah"));
- text = ASCIIToUTF16("about:trailing2 ");
+ u"blah");
+ text = u"about:trailing2 ";
expected_urls.clear();
expected_urls.push_back(
ExpectedURLAndAllowedToBeDefault(expected_url, false));
RunShortcutsProviderTest(provider_, text, false, expected_urls, expected_url,
- ASCIIToUTF16("blah"));
+ u"blah");
}
TEST_F(ShortcutsProviderTest, MultiMatch) {
- std::u16string text(ASCIIToUTF16("NEWS"));
+ std::u16string text(u"NEWS");
ExpectedURLs expected_urls;
// Scores high because of completion length.
expected_urls.push_back(
@@ -406,17 +406,17 @@
}
TEST_F(ShortcutsProviderTest, RemoveDuplicates) {
- std::u16string text(ASCIIToUTF16("dupl"));
+ std::u16string text(u"dupl");
ExpectedURLs expected_urls;
expected_urls.push_back(
ExpectedURLAndAllowedToBeDefault("http://duplicate.com/", true));
// Make sure the URL only appears once in the output list.
RunShortcutsProviderTest(provider_, text, false, expected_urls,
- "http://duplicate.com/", ASCIIToUTF16("icate.com"));
+ "http://duplicate.com/", u"icate.com");
}
TEST_F(ShortcutsProviderTest, TypedCountMatches) {
- std::u16string text(ASCIIToUTF16("just"));
+ std::u16string text(u"just");
ExpectedURLs expected_urls;
expected_urls.push_back(ExpectedURLAndAllowedToBeDefault(
"http://www.testsite.com/b.html", false));
@@ -429,7 +429,7 @@
}
TEST_F(ShortcutsProviderTest, FragmentLengthMatches) {
- std::u16string text(ASCIIToUTF16("just a"));
+ std::u16string text(u"just a");
ExpectedURLs expected_urls;
expected_urls.push_back(ExpectedURLAndAllowedToBeDefault(
"http://www.testsite.com/d.html", false));
@@ -442,7 +442,7 @@
}
TEST_F(ShortcutsProviderTest, DaysAgoMatches) {
- std::u16string text(ASCIIToUTF16("ago"));
+ std::u16string text(u"ago");
ExpectedURLs expected_urls;
expected_urls.push_back(ExpectedURLAndAllowedToBeDefault(
"http://www.daysagotest.com/a.html", false));
@@ -457,13 +457,12 @@
TEST_F(ShortcutsProviderTest, CalculateScore) {
ShortcutsDatabase::Shortcut shortcut(
- std::string(), ASCIIToUTF16("test"),
+ std::string(), u"test",
ShortcutsDatabase::Shortcut::MatchCore(
- ASCIIToUTF16("www.test.com"), GURL("http://www.test.com"),
- AutocompleteMatch::DocumentType::NONE, ASCIIToUTF16("www.test.com"),
- "0,1,4,3,8,1", ASCIIToUTF16("A test"), "0,0,2,2",
- ui::PAGE_TRANSITION_TYPED, AutocompleteMatchType::HISTORY_URL,
- std::u16string()),
+ u"www.test.com", GURL("http://www.test.com"),
+ AutocompleteMatch::DocumentType::NONE, u"www.test.com", "0,1,4,3,8,1",
+ u"A test", "0,0,2,2", ui::PAGE_TRANSITION_TYPED,
+ AutocompleteMatchType::HISTORY_URL, std::u16string()),
base::Time::Now(), 1);
// Maximal score.
@@ -539,9 +538,9 @@
EXPECT_EQ(original_shortcuts_count + 4, backend->shortcuts_map().size());
EXPECT_FALSE(backend->shortcuts_map().end() ==
- backend->shortcuts_map().find(ASCIIToUTF16("delete")));
+ backend->shortcuts_map().find(u"delete"));
EXPECT_FALSE(backend->shortcuts_map().end() ==
- backend->shortcuts_map().find(ASCIIToUTF16("erase")));
+ backend->shortcuts_map().find(u"erase"));
AutocompleteMatch match(provider_.get(), 1200, true,
AutocompleteMatchType::HISTORY_TITLE);
@@ -557,9 +556,9 @@
// shortcuts_to_test_delete[3], which have different URLs.
EXPECT_EQ(original_shortcuts_count + 2, backend->shortcuts_map().size());
EXPECT_FALSE(backend->shortcuts_map().end() ==
- backend->shortcuts_map().find(ASCIIToUTF16("delete")));
+ backend->shortcuts_map().find(u"delete"));
EXPECT_TRUE(backend->shortcuts_map().end() ==
- backend->shortcuts_map().find(ASCIIToUTF16("erase")));
+ backend->shortcuts_map().find(u"erase"));
match.destination_url = GURL(shortcuts_to_test_delete[3].destination_url);
match.contents = ASCIIToUTF16(shortcuts_to_test_delete[3].contents);
@@ -568,12 +567,11 @@
provider_->DeleteMatch(match);
EXPECT_EQ(original_shortcuts_count + 1, backend->shortcuts_map().size());
EXPECT_TRUE(backend->shortcuts_map().end() ==
- backend->shortcuts_map().find(ASCIIToUTF16("delete")));
+ backend->shortcuts_map().find(u"delete"));
}
TEST_F(ShortcutsProviderTest, DoesNotProvideOnFocus) {
- AutocompleteInput input(ASCIIToUTF16("about:o"),
- metrics::OmniboxEventProto::OTHER,
+ AutocompleteInput input(u"about:o", metrics::OmniboxEventProto::OTHER,
TestSchemeClassifier());
input.set_focus_type(OmniboxFocusType::ON_FOCUS);
provider_->Start(input, false);
diff --git a/components/omnibox/browser/titled_url_match_utils_unittest.cc b/components/omnibox/browser/titled_url_match_utils_unittest.cc
index acfc927..3473d929 100644
--- a/components/omnibox/browser/titled_url_match_utils_unittest.cc
+++ b/components/omnibox/browser/titled_url_match_utils_unittest.cc
@@ -79,8 +79,8 @@
} // namespace
TEST(TitledUrlMatchUtilsTest, TitledUrlMatchToAutocompleteMatch) {
- std::u16string input_text(base::ASCIIToUTF16("goo"));
- std::u16string match_title(base::ASCIIToUTF16("Google Search"));
+ std::u16string input_text(u"goo");
+ std::u16string match_title(u"Google Search");
GURL match_url("https://www.google.com/");
AutocompleteMatchType::Type type = AutocompleteMatchType::BOOKMARK_TITLE;
int relevance = 123;
@@ -109,13 +109,13 @@
ACMatchClassifications expected_description_class = {
{0, ACMatchClassification::MATCH}, {3, ACMatchClassification::NONE},
};
- std::u16string expected_inline_autocompletion(base::ASCIIToUTF16("gle.com"));
+ std::u16string expected_inline_autocompletion(u"gle.com");
EXPECT_EQ(provider.get(), autocomplete_match.provider);
EXPECT_EQ(type, autocomplete_match.type);
EXPECT_EQ(relevance, autocomplete_match.relevance);
EXPECT_EQ(match_url, autocomplete_match.destination_url);
- EXPECT_EQ(base::ASCIIToUTF16("google.com"), autocomplete_match.contents);
+ EXPECT_EQ(u"google.com", autocomplete_match.contents);
EXPECT_TRUE(std::equal(expected_contents_class.begin(),
expected_contents_class.end(),
autocomplete_match.contents_class.begin()))
@@ -126,8 +126,7 @@
EXPECT_TRUE(std::equal(expected_description_class.begin(),
expected_description_class.end(),
autocomplete_match.description_class.begin()));
- EXPECT_EQ(base::ASCIIToUTF16("https://www.google.com"),
- autocomplete_match.fill_into_edit);
+ EXPECT_EQ(u"https://www.google.com", autocomplete_match.fill_into_edit);
EXPECT_TRUE(autocomplete_match.allowed_to_be_default_match);
EXPECT_EQ(expected_inline_autocompletion,
autocomplete_match.inline_autocompletion);
@@ -138,7 +137,7 @@
const GURL& match_url,
const bookmarks::TitledUrlMatch::MatchPositions& match_positions) {
std::u16string input_text(base::ASCIIToUTF16(input_text_s));
- std::u16string match_title(base::ASCIIToUTF16("The Facebook"));
+ std::u16string match_title(u"The Facebook");
AutocompleteMatchType::Type type = AutocompleteMatchType::BOOKMARK_TITLE;
int relevance = 123;
@@ -170,7 +169,7 @@
{0, ACMatchClassification::URL | ACMatchClassification::MATCH},
{4, ACMatchClassification::URL},
};
- std::u16string expected_contents(base::ASCIIToUTF16("facebook.com"));
+ std::u16string expected_contents(u"facebook.com");
EXPECT_EQ(match_url, autocomplete_match.destination_url);
EXPECT_EQ(expected_contents, autocomplete_match.contents);
@@ -192,7 +191,7 @@
{0, ACMatchClassification::URL | ACMatchClassification::MATCH},
{11, ACMatchClassification::URL},
};
- std::u16string expected_contents(base::ASCIIToUTF16("http://facebook.com"));
+ std::u16string expected_contents(u"http://facebook.com");
EXPECT_EQ(match_url, autocomplete_match.destination_url);
EXPECT_EQ(expected_contents, autocomplete_match.contents);
@@ -214,7 +213,7 @@
{0, ACMatchClassification::URL | ACMatchClassification::MATCH},
{4, ACMatchClassification::URL},
};
- std::u16string expected_contents(base::ASCIIToUTF16("facebook.com"));
+ std::u16string expected_contents(u"facebook.com");
EXPECT_EQ(match_url, autocomplete_match.destination_url);
EXPECT_EQ(expected_contents, autocomplete_match.contents);
@@ -236,7 +235,7 @@
{0, ACMatchClassification::URL | ACMatchClassification::MATCH},
{12, ACMatchClassification::URL},
};
- std::u16string expected_contents(base::ASCIIToUTF16("https://facebook.com"));
+ std::u16string expected_contents(u"https://facebook.com");
EXPECT_EQ(match_url, autocomplete_match.destination_url);
EXPECT_EQ(expected_contents, autocomplete_match.contents);
@@ -252,8 +251,8 @@
TEST(TitledUrlMatchUtilsTest, EmptyInlineAutocompletion) {
// The search term matches the title but not the URL. Since there is no URL
// match, the inline autocompletion string will be empty.
- std::u16string input_text(base::ASCIIToUTF16("goo"));
- std::u16string match_title(base::ASCIIToUTF16("Email by Google"));
+ std::u16string input_text(u"goo");
+ std::u16string match_title(u"Email by Google");
GURL match_url("http://www.gmail.com/");
AutocompleteMatchType::Type type = AutocompleteMatchType::BOOKMARK_TITLE;
int relevance = 123;
@@ -288,7 +287,7 @@
EXPECT_EQ(type, autocomplete_match.type);
EXPECT_EQ(relevance, autocomplete_match.relevance);
EXPECT_EQ(match_url, autocomplete_match.destination_url);
- EXPECT_EQ(base::ASCIIToUTF16("gmail.com"), autocomplete_match.contents);
+ EXPECT_EQ(u"gmail.com", autocomplete_match.contents);
EXPECT_TRUE(std::equal(expected_contents_class.begin(),
expected_contents_class.end(),
autocomplete_match.contents_class.begin()))
@@ -299,8 +298,7 @@
EXPECT_TRUE(std::equal(expected_description_class.begin(),
expected_description_class.end(),
autocomplete_match.description_class.begin()));
- EXPECT_EQ(base::ASCIIToUTF16("www.gmail.com"),
- autocomplete_match.fill_into_edit);
+ EXPECT_EQ(u"www.gmail.com", autocomplete_match.fill_into_edit);
EXPECT_FALSE(autocomplete_match.allowed_to_be_default_match);
EXPECT_TRUE(autocomplete_match.inline_autocompletion.empty());
}
diff --git a/components/omnibox/browser/url_index_private_data.cc b/components/omnibox/browser/url_index_private_data.cc
index 7fa9a96..6584ebb 100644
--- a/components/omnibox/browser/url_index_private_data.cc
+++ b/components/omnibox/browser/url_index_private_data.cc
@@ -174,7 +174,7 @@
// case because the searching code below prevents running duplicate
// searches.
std::u16string transformed_search_string(original_search_string);
- transformed_search_string.insert(cursor_position, base::ASCIIToUTF16(" "));
+ transformed_search_string.insert(cursor_position, u" ");
search_strings.push_back(transformed_search_string);
}
diff --git a/components/omnibox/browser/url_prefix.cc b/components/omnibox/browser/url_prefix.cc
index 8370f6a9..1f0135f4 100644
--- a/components/omnibox/browser/url_prefix.cc
+++ b/components/omnibox/browser/url_prefix.cc
@@ -31,8 +31,7 @@
const URLPrefix* BestURLPrefixWithWWWCase(
const std::u16string& lower_text,
const std::u16string& lower_prefix_suffix) {
- static base::NoDestructor<URLPrefix> www_prefix(base::ASCIIToUTF16("www."),
- 1);
+ static base::NoDestructor<URLPrefix> www_prefix(u"www.", 1);
const URLPrefix* best_prefix =
BestURLPrefixInternal(lower_text, lower_prefix_suffix);
if ((best_prefix == nullptr ||
@@ -57,12 +56,12 @@
URLPrefixes prefixes;
// Keep this list in descending number of components.
- prefixes.push_back(URLPrefix(base::ASCIIToUTF16("http://www."), 2));
- prefixes.push_back(URLPrefix(base::ASCIIToUTF16("https://www."), 2));
- prefixes.push_back(URLPrefix(base::ASCIIToUTF16("ftp://www."), 2));
- prefixes.push_back(URLPrefix(base::ASCIIToUTF16("http://"), 1));
- prefixes.push_back(URLPrefix(base::ASCIIToUTF16("https://"), 1));
- prefixes.push_back(URLPrefix(base::ASCIIToUTF16("ftp://"), 1));
+ prefixes.push_back(URLPrefix(u"http://www.", 2));
+ prefixes.push_back(URLPrefix(u"https://www.", 2));
+ prefixes.push_back(URLPrefix(u"ftp://www.", 2));
+ prefixes.push_back(URLPrefix(u"http://", 1));
+ prefixes.push_back(URLPrefix(u"https://", 1));
+ prefixes.push_back(URLPrefix(u"ftp://", 1));
prefixes.push_back(URLPrefix(std::u16string(), 0));
return prefixes;
diff --git a/components/omnibox/browser/voice_suggest_provider_unittest.cc b/components/omnibox/browser/voice_suggest_provider_unittest.cc
index 691b878..cd38131 100644
--- a/components/omnibox/browser/voice_suggest_provider_unittest.cc
+++ b/components/omnibox/browser/voice_suggest_provider_unittest.cc
@@ -52,34 +52,34 @@
}
TEST_F(VoiceSuggestProviderTest, ServesSuppliedVoiceSuggestions) {
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Alice"), 0.6f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Bob"), 0.5f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Carol"), 0.4f);
+ provider_->AddVoiceSuggestion(u"Alice", 0.6f);
+ provider_->AddVoiceSuggestion(u"Bob", 0.5f);
+ provider_->AddVoiceSuggestion(u"Carol", 0.4f);
provider_->Start(*input_, false);
ASSERT_EQ(3U, provider_->matches().size());
- EXPECT_EQ(base::ASCIIToUTF16("Alice"), provider_->matches()[0].contents);
- EXPECT_EQ(base::ASCIIToUTF16("Bob"), provider_->matches()[1].contents);
- EXPECT_EQ(base::ASCIIToUTF16("Carol"), provider_->matches()[2].contents);
+ EXPECT_EQ(u"Alice", provider_->matches()[0].contents);
+ EXPECT_EQ(u"Bob", provider_->matches()[1].contents);
+ EXPECT_EQ(u"Carol", provider_->matches()[2].contents);
}
TEST_F(VoiceSuggestProviderTest, ConfidenceScoreImpliesOrdering) {
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Carol"), 0.4f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Bob"), 0.5f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Alice"), 0.6f);
+ provider_->AddVoiceSuggestion(u"Carol", 0.4f);
+ provider_->AddVoiceSuggestion(u"Bob", 0.5f);
+ provider_->AddVoiceSuggestion(u"Alice", 0.6f);
provider_->Start(*input_, false);
ASSERT_EQ(3U, provider_->matches().size());
- EXPECT_EQ(base::ASCIIToUTF16("Alice"), provider_->matches()[0].contents);
- EXPECT_EQ(base::ASCIIToUTF16("Bob"), provider_->matches()[1].contents);
- EXPECT_EQ(base::ASCIIToUTF16("Carol"), provider_->matches()[2].contents);
+ EXPECT_EQ(u"Alice", provider_->matches()[0].contents);
+ EXPECT_EQ(u"Bob", provider_->matches()[1].contents);
+ EXPECT_EQ(u"Carol", provider_->matches()[2].contents);
}
TEST_F(VoiceSuggestProviderTest,
VoiceSuggestionsAreNotReusedInSubsequentRequests) {
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Alice"), 0.6f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Bob"), 0.5f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Carol"), 0.4f);
+ provider_->AddVoiceSuggestion(u"Alice", 0.6f);
+ provider_->AddVoiceSuggestion(u"Bob", 0.5f);
+ provider_->AddVoiceSuggestion(u"Carol", 0.4f);
provider_->Start(*input_, false);
provider_->Stop(true, false);
provider_->Start(*input_, false);
@@ -88,9 +88,9 @@
}
TEST_F(VoiceSuggestProviderTest, ClearCachePurgesAvailableVoiceSuggestions) {
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Alice"), 0.6f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Bob"), 0.5f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Carol"), 0.4f);
+ provider_->AddVoiceSuggestion(u"Alice", 0.6f);
+ provider_->AddVoiceSuggestion(u"Bob", 0.5f);
+ provider_->AddVoiceSuggestion(u"Carol", 0.4f);
provider_->ClearCache();
provider_->Start(*input_, false);
@@ -98,58 +98,58 @@
}
TEST_F(VoiceSuggestProviderTest, MatchesWithSameScoresAreNotDropped) {
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Alice"), 0.6f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Bob"), 0.6f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Carol"), 0.6f);
+ provider_->AddVoiceSuggestion(u"Alice", 0.6f);
+ provider_->AddVoiceSuggestion(u"Bob", 0.6f);
+ provider_->AddVoiceSuggestion(u"Carol", 0.6f);
provider_->Start(*input_, false);
ASSERT_EQ(3U, provider_->matches().size());
- EXPECT_EQ(base::ASCIIToUTF16("Alice"), provider_->matches()[0].contents);
- EXPECT_EQ(base::ASCIIToUTF16("Bob"), provider_->matches()[1].contents);
- EXPECT_EQ(base::ASCIIToUTF16("Carol"), provider_->matches()[2].contents);
+ EXPECT_EQ(u"Alice", provider_->matches()[0].contents);
+ EXPECT_EQ(u"Bob", provider_->matches()[1].contents);
+ EXPECT_EQ(u"Carol", provider_->matches()[2].contents);
}
TEST_F(VoiceSuggestProviderTest, DuplicateMatchesAreMerged) {
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Alice"), 0.6f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Bob"), 0.5f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Bob"), 0.4f);
+ provider_->AddVoiceSuggestion(u"Alice", 0.6f);
+ provider_->AddVoiceSuggestion(u"Bob", 0.5f);
+ provider_->AddVoiceSuggestion(u"Bob", 0.4f);
provider_->Start(*input_, false);
ASSERT_EQ(2U, provider_->matches().size());
- EXPECT_EQ(base::ASCIIToUTF16("Alice"), provider_->matches()[0].contents);
- EXPECT_EQ(base::ASCIIToUTF16("Bob"), provider_->matches()[1].contents);
+ EXPECT_EQ(u"Alice", provider_->matches()[0].contents);
+ EXPECT_EQ(u"Bob", provider_->matches()[1].contents);
}
TEST_F(VoiceSuggestProviderTest, HighConfidenceScoreDropsAlternatives) {
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Alice"), 0.9f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Bob"), 0.5f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Carol"), 0.4f);
+ provider_->AddVoiceSuggestion(u"Alice", 0.9f);
+ provider_->AddVoiceSuggestion(u"Bob", 0.5f);
+ provider_->AddVoiceSuggestion(u"Carol", 0.4f);
provider_->Start(*input_, false);
ASSERT_EQ(1U, provider_->matches().size());
- EXPECT_EQ(base::ASCIIToUTF16("Alice"), provider_->matches()[0].contents);
+ EXPECT_EQ(u"Alice", provider_->matches()[0].contents);
}
TEST_F(VoiceSuggestProviderTest, LowConfidenceScoresAreRejected) {
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Alice"), 0.35f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Bob"), 0.25f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Carol"), 0.2f);
+ provider_->AddVoiceSuggestion(u"Alice", 0.35f);
+ provider_->AddVoiceSuggestion(u"Bob", 0.25f);
+ provider_->AddVoiceSuggestion(u"Carol", 0.2f);
provider_->Start(*input_, false);
ASSERT_EQ(1U, provider_->matches().size());
- EXPECT_EQ(base::ASCIIToUTF16("Alice"), provider_->matches()[0].contents);
+ EXPECT_EQ(u"Alice", provider_->matches()[0].contents);
}
TEST_F(VoiceSuggestProviderTest, VoiceSuggestionResultsCanBeLimited) {
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Alice"), 0.75f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Bob"), 0.65f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Carol"), 0.55f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Dave"), 0.45f);
- provider_->AddVoiceSuggestion(base::ASCIIToUTF16("Eve"), 0.35f);
+ provider_->AddVoiceSuggestion(u"Alice", 0.75f);
+ provider_->AddVoiceSuggestion(u"Bob", 0.65f);
+ provider_->AddVoiceSuggestion(u"Carol", 0.55f);
+ provider_->AddVoiceSuggestion(u"Dave", 0.45f);
+ provider_->AddVoiceSuggestion(u"Eve", 0.35f);
provider_->Start(*input_, false);
ASSERT_EQ(3U, provider_->matches().size());
- EXPECT_EQ(base::ASCIIToUTF16("Alice"), provider_->matches()[0].contents);
- EXPECT_EQ(base::ASCIIToUTF16("Bob"), provider_->matches()[1].contents);
- EXPECT_EQ(base::ASCIIToUTF16("Carol"), provider_->matches()[2].contents);
+ EXPECT_EQ(u"Alice", provider_->matches()[0].contents);
+ EXPECT_EQ(u"Bob", provider_->matches()[1].contents);
+ EXPECT_EQ(u"Carol", provider_->matches()[2].contents);
}
diff --git a/components/omnibox/browser/zero_suggest_provider_unittest.cc b/components/omnibox/browser/zero_suggest_provider_unittest.cc
index ed2287d..474e7c74 100644
--- a/components/omnibox/browser/zero_suggest_provider_unittest.cc
+++ b/components/omnibox/browser/zero_suggest_provider_unittest.cc
@@ -340,7 +340,7 @@
TEST_F(ZeroSuggestProviderTest, TestDoesNotReturnMatchesForPrefix) {
// Use NTP because REMOTE_NO_URL is enabled by default for NTP.
AutocompleteInput prefix_input(
- base::ASCIIToUTF16("foobar input"),
+ u"foobar input",
metrics::OmniboxEventProto::INSTANT_NTP_WITH_OMNIBOX_AS_STARTING_FOCUS,
TestSchemeClassifier());
@@ -436,9 +436,9 @@
if (base::FeatureList::IsEnabled(omnibox::kOmniboxZeroSuggestCaching)) {
// Expect that matches get populated synchronously out of the cache.
ASSERT_EQ(3U, provider_->matches().size()); // 3 results, no verbatim match
- EXPECT_EQ(base::ASCIIToUTF16("search1"), provider_->matches()[0].contents);
- EXPECT_EQ(base::ASCIIToUTF16("search2"), provider_->matches()[1].contents);
- EXPECT_EQ(base::ASCIIToUTF16("search3"), provider_->matches()[2].contents);
+ EXPECT_EQ(u"search1", provider_->matches()[0].contents);
+ EXPECT_EQ(u"search2", provider_->matches()[1].contents);
+ EXPECT_EQ(u"search3", provider_->matches()[2].contents);
}
GURL suggest_url = GetSuggestURL(
@@ -454,9 +454,9 @@
if (base::FeatureList::IsEnabled(omnibox::kOmniboxZeroSuggestCaching)) {
// Expect the same results after the response has been handled.
ASSERT_EQ(3U, provider_->matches().size()); // 3 results, no verbatim match
- EXPECT_EQ(base::ASCIIToUTF16("search1"), provider_->matches()[0].contents);
- EXPECT_EQ(base::ASCIIToUTF16("search2"), provider_->matches()[1].contents);
- EXPECT_EQ(base::ASCIIToUTF16("search3"), provider_->matches()[2].contents);
+ EXPECT_EQ(u"search1", provider_->matches()[0].contents);
+ EXPECT_EQ(u"search2", provider_->matches()[1].contents);
+ EXPECT_EQ(u"search3", provider_->matches()[2].contents);
// Expect the new results have been stored.
EXPECT_EQ(json_response2,
@@ -464,9 +464,9 @@
} else {
// Expect fresh results after the response has been handled.
ASSERT_EQ(3U, provider_->matches().size()); // 3 results, no verbatim match
- EXPECT_EQ(base::ASCIIToUTF16("search4"), provider_->matches()[0].contents);
- EXPECT_EQ(base::ASCIIToUTF16("search5"), provider_->matches()[1].contents);
- EXPECT_EQ(base::ASCIIToUTF16("search6"), provider_->matches()[2].contents);
+ EXPECT_EQ(u"search4", provider_->matches()[0].contents);
+ EXPECT_EQ(u"search5", provider_->matches()[1].contents);
+ EXPECT_EQ(u"search6", provider_->matches()[2].contents);
}
}
@@ -489,9 +489,9 @@
if (base::FeatureList::IsEnabled(omnibox::kOmniboxZeroSuggestCaching)) {
// Expect that matches get populated synchronously out of the cache.
ASSERT_EQ(3U, provider_->matches().size()); // 3 results, no verbatim match
- EXPECT_EQ(base::ASCIIToUTF16("search1"), provider_->matches()[0].contents);
- EXPECT_EQ(base::ASCIIToUTF16("search2"), provider_->matches()[1].contents);
- EXPECT_EQ(base::ASCIIToUTF16("search3"), provider_->matches()[2].contents);
+ EXPECT_EQ(u"search1", provider_->matches()[0].contents);
+ EXPECT_EQ(u"search2", provider_->matches()[1].contents);
+ EXPECT_EQ(u"search3", provider_->matches()[2].contents);
} else {
ASSERT_TRUE(provider_->matches().empty());
}