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

Unified Diff: extensions/common/matcher/url_matcher_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 | « extensions/common/matcher/url_matcher_factory.cc ('k') | google_apis/gaia/gaia_auth_fetcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/matcher/url_matcher_unittest.cc
diff --git a/extensions/common/matcher/url_matcher_unittest.cc b/extensions/common/matcher/url_matcher_unittest.cc
index 09fc562c17229ba582172ee1fa2853f57cc5d3cd..b17c13c3f014c4070916f2b3a21728a83be83645 100644
--- a/extensions/common/matcher/url_matcher_unittest.cc
+++ b/extensions/common/matcher/url_matcher_unittest.cc
@@ -247,7 +247,7 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) {
std::string url = factory.CanonicalizeURLForComponentSearches(gurl);
// Test host component.
- EXPECT_TRUE(Matches(factory.CreateHostPrefixCondition(""), url));
+ EXPECT_TRUE(Matches(factory.CreateHostPrefixCondition(std::string()), url));
EXPECT_TRUE(Matches(factory.CreateHostPrefixCondition("www.goog"), url));
EXPECT_TRUE(
Matches(factory.CreateHostPrefixCondition("www.google.com"), url));
@@ -258,7 +258,7 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) {
Matches(factory.CreateHostPrefixCondition("www.google.com/"), url));
EXPECT_FALSE(Matches(factory.CreateHostPrefixCondition("webhp"), url));
- EXPECT_TRUE(Matches(factory.CreateHostSuffixCondition(""), url));
+ EXPECT_TRUE(Matches(factory.CreateHostSuffixCondition(std::string()), url));
EXPECT_TRUE(Matches(factory.CreateHostSuffixCondition("com"), url));
EXPECT_TRUE(Matches(factory.CreateHostSuffixCondition(".com"), url));
EXPECT_TRUE(
@@ -270,7 +270,7 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) {
Matches(factory.CreateHostSuffixCondition("www.google.com/"), url));
EXPECT_FALSE(Matches(factory.CreateHostSuffixCondition("webhp"), url));
- EXPECT_FALSE(Matches(factory.CreateHostEqualsCondition(""), url));
+ EXPECT_FALSE(Matches(factory.CreateHostEqualsCondition(std::string()), url));
EXPECT_FALSE(Matches(factory.CreateHostEqualsCondition("www"), url));
EXPECT_TRUE(
Matches(factory.CreateHostEqualsCondition("www.google.com"), url));
@@ -279,14 +279,14 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) {
// Test path component.
- EXPECT_TRUE(Matches(factory.CreatePathPrefixCondition(""), url));
+ EXPECT_TRUE(Matches(factory.CreatePathPrefixCondition(std::string()), url));
EXPECT_TRUE(Matches(factory.CreatePathPrefixCondition("/web"), url));
EXPECT_TRUE(Matches(factory.CreatePathPrefixCondition("/webhp"), url));
EXPECT_FALSE(Matches(factory.CreatePathPrefixCondition("webhp"), url));
EXPECT_FALSE(Matches(factory.CreatePathPrefixCondition("/webhp?"), url));
EXPECT_FALSE(Matches(factory.CreatePathPrefixCondition("?sourceid"), url));
- EXPECT_TRUE(Matches(factory.CreatePathSuffixCondition(""), url));
+ EXPECT_TRUE(Matches(factory.CreatePathSuffixCondition(std::string()), url));
EXPECT_TRUE(Matches(factory.CreatePathSuffixCondition("webhp"), url));
EXPECT_TRUE(Matches(factory.CreatePathSuffixCondition("/webhp"), url));
EXPECT_FALSE(Matches(factory.CreatePathSuffixCondition("/web"), url));
@@ -300,12 +300,12 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) {
// Test query component.
- EXPECT_TRUE(Matches(factory.CreateQueryPrefixCondition(""), url));
+ EXPECT_TRUE(Matches(factory.CreateQueryPrefixCondition(std::string()), url));
EXPECT_TRUE(Matches(factory.CreateQueryPrefixCondition("sourceid"), url));
// The '?' at the beginning is just ignored.
EXPECT_TRUE(Matches(factory.CreateQueryPrefixCondition("?sourceid"), url));
- EXPECT_TRUE(Matches(factory.CreateQuerySuffixCondition(""), url));
+ EXPECT_TRUE(Matches(factory.CreateQuerySuffixCondition(std::string()), url));
EXPECT_TRUE(Matches(factory.CreateQuerySuffixCondition("ion=1"), url));
EXPECT_FALSE(Matches(factory.CreateQuerySuffixCondition("www"), url));
// "Suffix" condition + pattern starting with '?' = "equals" condition.
@@ -330,21 +330,26 @@ TEST(URLMatcherConditionFactoryTest, TestComponentSearches) {
// Test adjacent components
EXPECT_TRUE(Matches(factory.CreateHostSuffixPathPrefixCondition(
"google.com", "/webhp"), url));
- EXPECT_TRUE(Matches(factory.CreateHostSuffixPathPrefixCondition(
- "", "/webhp"), url));
- EXPECT_TRUE(Matches(factory.CreateHostSuffixPathPrefixCondition(
- "google.com", ""), url));
- EXPECT_FALSE(Matches(factory.CreateHostSuffixPathPrefixCondition(
- "www", ""), url));
+ EXPECT_TRUE(Matches(
+ factory.CreateHostSuffixPathPrefixCondition(std::string(), "/webhp"),
+ url));
+ EXPECT_TRUE(Matches(
+ factory.CreateHostSuffixPathPrefixCondition("google.com", std::string()),
+ url));
+ EXPECT_FALSE(Matches(
+ factory.CreateHostSuffixPathPrefixCondition("www", std::string()), url));
EXPECT_TRUE(Matches(factory.CreateHostEqualsPathPrefixCondition(
"www.google.com", "/webhp"), url));
- EXPECT_FALSE(Matches(factory.CreateHostEqualsPathPrefixCondition(
- "", "/webhp"), url));
+ EXPECT_FALSE(Matches(
+ factory.CreateHostEqualsPathPrefixCondition(std::string(), "/webhp"),
+ url));
EXPECT_TRUE(Matches(factory.CreateHostEqualsPathPrefixCondition(
- "www.google.com", ""), url));
- EXPECT_FALSE(Matches(factory.CreateHostEqualsPathPrefixCondition(
- "google.com", ""), url));
+ "www.google.com", std::string()),
+ url));
+ EXPECT_FALSE(Matches(
+ factory.CreateHostEqualsPathPrefixCondition("google.com", std::string()),
+ url));
}
TEST(URLMatcherConditionFactoryTest, TestFullSearches) {
@@ -354,9 +359,9 @@ TEST(URLMatcherConditionFactoryTest, TestFullSearches) {
URLMatcherConditionFactory factory;
std::string url = factory.CanonicalizeURLForFullSearches(gurl);
- EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition(""), url));
- EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition(
- "https://www.goog"), url));
+ EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition(std::string()), url));
+ EXPECT_TRUE(
+ Matches(factory.CreateURLPrefixCondition("https://www.goog"), url));
EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition(
"https://www.google.com"), url));
EXPECT_TRUE(Matches(factory.CreateURLPrefixCondition(
@@ -365,11 +370,11 @@ TEST(URLMatcherConditionFactoryTest, TestFullSearches) {
"http://www.google.com"), url));
EXPECT_FALSE(Matches(factory.CreateURLPrefixCondition("webhp"), url));
- EXPECT_TRUE(Matches(factory.CreateURLSuffixCondition(""), url));
+ EXPECT_TRUE(Matches(factory.CreateURLSuffixCondition(std::string()), url));
EXPECT_TRUE(Matches(factory.CreateURLSuffixCondition("ion=1"), url));
EXPECT_FALSE(Matches(factory.CreateURLSuffixCondition("www"), url));
- EXPECT_TRUE(Matches(factory.CreateURLContainsCondition(""), url));
+ EXPECT_TRUE(Matches(factory.CreateURLContainsCondition(std::string()), url));
EXPECT_TRUE(Matches(factory.CreateURLContainsCondition("www.goog"), url));
EXPECT_TRUE(Matches(factory.CreateURLContainsCondition("webhp"), url));
EXPECT_TRUE(Matches(factory.CreateURLContainsCondition("?"), url));
« no previous file with comments | « extensions/common/matcher/url_matcher_factory.cc ('k') | google_apis/gaia/gaia_auth_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698