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

Unified Diff: chrome/browser/search_engines/template_url_unittest.cc

Issue 126052: Fixes bug where keyword editor would end up prefixing all keyword urls... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search_engines/template_url_unittest.cc
===================================================================
--- chrome/browser/search_engines/template_url_unittest.cc (revision 18266)
+++ chrome/browser/search_engines/template_url_unittest.cc (working copy)
@@ -43,8 +43,8 @@
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = ref.ReplaceSearchTerms(t_url, L"search",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring());
+ GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"search",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ("http://foosearch/", result.spec());
}
@@ -54,8 +54,8 @@
TemplateURLRef ref(L"http://foo{searchTerms}{count?}", 0, 0);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = ref.ReplaceSearchTerms(t_url, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring());
+ GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ("http://foox/", result.spec());
}
@@ -65,8 +65,8 @@
TemplateURLRef ref(L"http://foo{searchTerms}{count}", 0, 0);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = ref.ReplaceSearchTerms(t_url, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring());
+ GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ("http://foox10/", result.spec());
}
@@ -77,8 +77,8 @@
1, 2);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = ref.ReplaceSearchTerms(t_url, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring());
+ GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ("http://fooxxy/", result.spec());
}
@@ -88,8 +88,8 @@
TemplateURLRef ref(L"http://foo{searchTerms}x{startIndex}y{startPage}", 1, 2);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = ref.ReplaceSearchTerms(t_url, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring());
+ GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ("http://fooxx1y2/", result.spec());
}
@@ -100,8 +100,8 @@
L"http://foo{searchTerms}x{inputEncoding?}y{outputEncoding?}a", 1, 2);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = ref.ReplaceSearchTerms(t_url, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring());
+ GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ("http://fooxxutf-8ya/", result.spec());
}
@@ -112,8 +112,8 @@
L"http://foox{inputEncoding?}a{searchTerms}y{outputEncoding?}b", 1, 2);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = ref.ReplaceSearchTerms(t_url, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring());
+ GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ("http://fooxutf-8axyb/", result.spec());
}
@@ -124,8 +124,8 @@
L"http://foo{searchTerms}x{inputEncoding}y{outputEncoding}a", 1, 2);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = ref.ReplaceSearchTerms(t_url, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring());
+ GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
ASSERT_TRUE(result.is_valid());
ASSERT_EQ("http://fooxxutf-8yutf-8a/", result.spec());
}
@@ -239,8 +239,8 @@
std::string expected_result = data[i].expected_result;
ReplaceSubstringsAfterOffset(&expected_result, 0, "{language}",
WideToASCII(g_browser_process->GetApplicationLocale()));
- GURL result = ref.ReplaceSearchTerms(turl, L"X",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring());
+ GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(turl, L"X",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
EXPECT_TRUE(result.is_valid());
EXPECT_EQ(expected_result, result.spec());
}
@@ -265,8 +265,9 @@
TemplateURL turl;
turl.add_input_encoding(data[i].encoding);
TemplateURLRef ref(data[i].url, 1, 2);
- GURL result = ref.ReplaceSearchTerms(turl, data[i].search_term,
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring());
+ GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(turl,
+ data[i].search_term, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
+ std::wstring())));
EXPECT_TRUE(result.is_valid());
EXPECT_EQ(data[i].expected_result, result.spec());
}
@@ -296,8 +297,8 @@
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(data); ++i) {
- GURL result = ref.ReplaceSearchTerms(turl, L"foobar",
- data[i].accepted_suggestion, data[i].original_query_for_suggestion);
+ GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(turl, L"foobar",
+ data[i].accepted_suggestion, data[i].original_query_for_suggestion)));
EXPECT_TRUE(result.is_valid());
EXPECT_EQ(data[i].expected_result, result.spec());
}
@@ -314,8 +315,8 @@
TemplateURLRef ref(L"http://bar/?{google:RLZ}{searchTerms}", 1, 2);
ASSERT_TRUE(ref.IsValid());
ASSERT_TRUE(ref.SupportsReplacement());
- GURL result = ref.ReplaceSearchTerms(t_url, L"x",
- TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring());
+ GURL result = GURL(WideToUTF8(ref.ReplaceSearchTerms(t_url, L"x",
+ TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, std::wstring())));
ASSERT_TRUE(result.is_valid());
std::string expected_url = "http://bar/?";
if (!rlz_string.empty()) {

Powered by Google App Engine
This is Rietveld 408576698