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

Unified Diff: chrome/browser/autocomplete/search_provider_unittest.cc

Issue 109013006: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 years 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
« no previous file with comments | « chrome/browser/autocomplete/search_provider.cc ('k') | chrome/browser/autocomplete/shortcuts_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/search_provider_unittest.cc
diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc
index 94964e7cb32fd341731926c654b267b509e6a7fe..9d96424d6cd7539b0887248d3d93448d5bc5b019 100644
--- a/chrome/browser/autocomplete/search_provider_unittest.cc
+++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -45,6 +45,8 @@
#include "net/url_request/url_request_status.h"
#include "testing/gtest/include/gtest/gtest.h"
+using base::ASCIIToUTF16;
+
namespace {
// Returns the first match in |matches| with |allowed_to_be_default_match|
@@ -291,13 +293,16 @@ void SearchProviderTest::RunTest(TestData* cases,
bool prefer_keyword) {
ACMatches matches;
for (int i = 0; i < num_cases; ++i) {
- AutocompleteInput input(cases[i].input, base::string16::npos, base::string16(), GURL(),
+ AutocompleteInput input(cases[i].input, base::string16::npos,
+ base::string16(), GURL(),
AutocompleteInput::INVALID_SPEC, false,
prefer_keyword, true,
AutocompleteInput::ALL_MATCHES);
provider_->Start(input, false);
matches = provider_->matches();
- base::string16 diagnostic_details = ASCIIToUTF16("Input was: ") + cases[i].input +
+ base::string16 diagnostic_details =
+ ASCIIToUTF16("Input was: ") +
+ cases[i].input +
ASCIIToUTF16("; prefer_keyword was: ") +
(prefer_keyword ? ASCIIToUTF16("true") : ASCIIToUTF16("false"));
EXPECT_EQ(cases[i].num_results, matches.size()) << diagnostic_details;
@@ -3216,8 +3221,8 @@ TEST_F(SearchProviderTest, NavigationInlineDomainClassify) {
QueryForInput(ASCIIToUTF16("w"), false, false);
AutocompleteMatch match(
provider_->NavigationToMatch(SearchProvider::NavigationResult(
- *provider_.get(), GURL("http://www.wow.com"), base::string16(), false, 0,
- false)));
+ *provider_.get(), GURL("http://www.wow.com"), base::string16(), false,
+ 0, false)));
EXPECT_EQ(ASCIIToUTF16("ow.com"), match.inline_autocompletion);
EXPECT_TRUE(match.allowed_to_be_default_match);
EXPECT_EQ(ASCIIToUTF16("www.wow.com"), match.fill_into_edit);
@@ -3392,9 +3397,9 @@ TEST_F(SearchProviderTest, RemoveStaleResultsTest) {
}
provider_->input_ = AutocompleteInput(
- ASCIIToUTF16(cases[i].omnibox_input), base::string16::npos, base::string16(),
- GURL(), AutocompleteInput::INVALID_SPEC, false, false, true,
- AutocompleteInput::ALL_MATCHES);
+ ASCIIToUTF16(cases[i].omnibox_input), base::string16::npos,
+ base::string16(), GURL(), AutocompleteInput::INVALID_SPEC, false, false,
+ true, AutocompleteInput::ALL_MATCHES);
provider_->RemoveAllStaleResults();
// Check cached results.
@@ -3501,13 +3506,13 @@ TEST_F(SearchProviderTest, ParseEntitySuggestion) {
const Match& match = cases[i].matches[j];
SCOPED_TRACE(" and match index: " + base::IntToString(j));
EXPECT_EQ(match.contents,
- UTF16ToUTF8(matches[j].contents));
+ base::UTF16ToUTF8(matches[j].contents));
EXPECT_EQ(match.description,
- UTF16ToUTF8(matches[j].description));
+ base::UTF16ToUTF8(matches[j].description));
EXPECT_EQ(match.query_params,
matches[j].search_terms_args->suggest_query_params);
EXPECT_EQ(match.fill_into_edit,
- UTF16ToUTF8(matches[j].fill_into_edit));
+ base::UTF16ToUTF8(matches[j].fill_into_edit));
EXPECT_EQ(match.type, matches[j].type);
}
// Ensure that no expected matches are missing.
@@ -3649,7 +3654,8 @@ TEST_F(SearchProviderTest, PrefetchMetadataParsing) {
// Ensure that the returned matches equal the expectations.
for (size_t j = 0; j < matches.size(); ++j) {
SCOPED_TRACE(description);
- EXPECT_EQ(cases[i].matches[j].contents, UTF16ToUTF8(matches[j].contents));
+ EXPECT_EQ(cases[i].matches[j].contents,
+ base::UTF16ToUTF8(matches[j].contents));
EXPECT_EQ(cases[i].matches[j].allowed_to_be_prefetched,
SearchProvider::ShouldPrefetch(matches[j]));
EXPECT_EQ(cases[i].matches[j].type, matches[j].type);
@@ -3680,7 +3686,7 @@ TEST_F(SearchProviderTest, XSSIGuardedJSONParsing_InvalidResponse) {
// Should have exactly one "search what you typed" match
ASSERT_TRUE(matches.size() == 1);
- EXPECT_EQ(input_str, UTF16ToUTF8(matches[0].contents));
+ EXPECT_EQ(input_str, base::UTF16ToUTF8(matches[0].contents));
EXPECT_EQ(AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
matches[0].type);
}
@@ -3762,7 +3768,8 @@ TEST_F(SearchProviderTest, XSSIGuardedJSONParsing_ValidResponses) {
// Ensure that the returned matches equal the expectations.
for (; j < matches.size(); ++j) {
SCOPED_TRACE("and match: " + base::IntToString(j));
- EXPECT_EQ(cases[i].matches[j].contents, UTF16ToUTF8(matches[j].contents));
+ EXPECT_EQ(cases[i].matches[j].contents,
+ base::UTF16ToUTF8(matches[j].contents));
EXPECT_EQ(cases[i].matches[j].type, matches[j].type);
}
for (; j < ARRAYSIZE_UNSAFE(cases[i].matches); ++j) {
@@ -3843,7 +3850,7 @@ TEST_F(SearchProviderTest, ParseDeletionUrl) {
for (size_t j = 0; j < matches.size(); ++j) {
const Match& match = cases[i].matches[j];
SCOPED_TRACE(" and match index: " + base::IntToString(j));
- EXPECT_EQ(match.contents, UTF16ToUTF8(matches[j].contents));
+ EXPECT_EQ(match.contents, base::UTF16ToUTF8(matches[j].contents));
EXPECT_EQ(match.deletion_url, matches[j].GetAdditionalInfo(
"deletion_url"));
}
« no previous file with comments | « chrome/browser/autocomplete/search_provider.cc ('k') | chrome/browser/autocomplete/shortcuts_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698