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

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

Issue 16972007: Fix test case table in HistoryURLProviderTest for C++11 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autocomplete/history_url_provider_unittest.cc
diff --git a/chrome/browser/autocomplete/history_url_provider_unittest.cc b/chrome/browser/autocomplete/history_url_provider_unittest.cc
index 245eab2317e8f41bcb7c4391be372316667bf1d1..f76771ec0a123d894de3c7e7d7848197cd477ed4 100644
--- a/chrome/browser/autocomplete/history_url_provider_unittest.cc
+++ b/chrome/browser/autocomplete/history_url_provider_unittest.cc
@@ -800,10 +800,10 @@ TEST_F(HistoryURLProviderTest, SuggestExactInput) {
// Expected Outputs:
const char* contents;
// Offsets of the ACMatchClassifications, terminated by -1s.
- size_t offsets[3];
+ ssize_t offsets[3];
Peter Kasting 2013/06/17 18:43:43 Do not use ssize_t, use size_t. To avoid having t
cmarcelo 2013/06/17 18:48:52 Would be OK to (re-)use std::string::npos?
Peter Kasting 2013/06/17 18:53:12 Yes, in fact, that's what _should_ be used, since
// The index of the ACMatchClassification that should have the MATCH bit
// set, -1 if there no ACMatchClassification should have the MATCH bit set.
- size_t match_classification_index;
+ ssize_t match_classification_index;
} test_cases[] = {
{ "http://www.somesite.com", false,
"http://www.somesite.com", {0, -1, -1}, 0 },
@@ -858,16 +858,19 @@ TEST_F(HistoryURLProviderTest, SuggestExactInput) {
HistoryURLProvider::SuggestExactInput(autocomplete_, input,
test_cases[i].trim_http);
EXPECT_EQ(ASCIIToUTF16(test_cases[i].contents), match.contents);
+ ssize_t match_classification_index =
+ test_cases[i].match_classification_index;
for (size_t match_index = 0; match_index < match.contents_class.size();
++match_index) {
- EXPECT_EQ(test_cases[i].offsets[match_index],
- match.contents_class[match_index].offset);
+ ssize_t offset = test_cases[i].offsets[match_index];
+ EXPECT_NE(-1, offset);
+ EXPECT_EQ(size_t(offset), match.contents_class[match_index].offset);
+ bool should_match = match_classification_index >= 0 &&
+ match_index == size_t(match_classification_index);
EXPECT_EQ(ACMatchClassification::URL |
- (match_index == test_cases[i].match_classification_index ?
- ACMatchClassification::MATCH : 0),
+ (should_match ? ACMatchClassification::MATCH : 0),
match.contents_class[match_index].style);
}
- EXPECT_EQ(std::string::npos,
- test_cases[i].offsets[match.contents_class.size()]);
+ EXPECT_EQ(-1, test_cases[i].offsets[match.contents_class.size()]);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698