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

Side by Side Diff: trunk/src/components/url_matcher/url_matcher_unittest.cc

Issue 198163004: Revert 257524 "Move IsStringASCII/UTF8 to base namespace." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/url_matcher/url_matcher.h" 5 #include "components/url_matcher/url_matcher.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "url/gurl.h" 9 #include "url/gurl.h"
10 10
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 std::string::npos; 152 std::string::npos;
153 } 153 }
154 154
155 } // namespace 155 } // namespace
156 156
157 TEST(URLMatcherConditionFactoryTest, GURLCharacterSet) { 157 TEST(URLMatcherConditionFactoryTest, GURLCharacterSet) {
158 // GURL guarantees that neither domain, nor path, nor query may contain 158 // GURL guarantees that neither domain, nor path, nor query may contain
159 // non ASCII-7 characters. We test this here, because a change to this 159 // non ASCII-7 characters. We test this here, because a change to this
160 // guarantee breaks this implementation horribly. 160 // guarantee breaks this implementation horribly.
161 GURL url("http://www.föö.com/föö?föö#föö"); 161 GURL url("http://www.föö.com/föö?föö#föö");
162 EXPECT_TRUE(base::IsStringASCII(url.host())); 162 EXPECT_TRUE(IsStringASCII(url.host()));
163 EXPECT_TRUE(base::IsStringASCII(url.path())); 163 EXPECT_TRUE(IsStringASCII(url.path()));
164 EXPECT_TRUE(base::IsStringASCII(url.query())); 164 EXPECT_TRUE(IsStringASCII(url.query()));
165 EXPECT_FALSE(base::IsStringASCII(url.ref())); 165 EXPECT_FALSE(IsStringASCII(url.ref()));
166 } 166 }
167 167
168 TEST(URLMatcherConditionFactoryTest, Criteria) { 168 TEST(URLMatcherConditionFactoryTest, Criteria) {
169 URLMatcherConditionFactory factory; 169 URLMatcherConditionFactory factory;
170 EXPECT_EQ(URLMatcherCondition::HOST_PREFIX, 170 EXPECT_EQ(URLMatcherCondition::HOST_PREFIX,
171 factory.CreateHostPrefixCondition("foo").criterion()); 171 factory.CreateHostPrefixCondition("foo").criterion());
172 EXPECT_EQ(URLMatcherCondition::HOST_SUFFIX, 172 EXPECT_EQ(URLMatcherCondition::HOST_SUFFIX,
173 factory.CreateHostSuffixCondition("foo").criterion()); 173 factory.CreateHostSuffixCondition("foo").criterion());
174 EXPECT_EQ(URLMatcherCondition::HOST_CONTAINS, 174 EXPECT_EQ(URLMatcherCondition::HOST_CONTAINS,
175 factory.CreateHostContainsCondition("foo").criterion()); 175 factory.CreateHostContainsCondition("foo").criterion());
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 conditions.insert(factory->CreateOriginAndPathMatchesCondition("val")); 673 conditions.insert(factory->CreateOriginAndPathMatchesCondition("val"));
674 const int kConditionSetId = 1; 674 const int kConditionSetId = 1;
675 URLMatcherConditionSet::Vector insert; 675 URLMatcherConditionSet::Vector insert;
676 insert.push_back(make_scoped_refptr( 676 insert.push_back(make_scoped_refptr(
677 new URLMatcherConditionSet(kConditionSetId, conditions))); 677 new URLMatcherConditionSet(kConditionSetId, conditions)));
678 matcher.AddConditionSets(insert); 678 matcher.AddConditionSets(insert);
679 EXPECT_EQ(0u, matcher.MatchURL(url).size()); 679 EXPECT_EQ(0u, matcher.MatchURL(url).size());
680 } 680 }
681 681
682 } // namespace url_matcher 682 } // namespace url_matcher
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698