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

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

Issue 1349783006: Cleanup: Pass std::string as const reference if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert third_party changes Created 5 years, 3 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
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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 << "Test " << i << " of test_equal failed"; 140 << "Test " << i << " of test_equal failed";
141 } 141 }
142 } 142 }
143 143
144 // 144 //
145 // URLMatcherConditionFactory 145 // URLMatcherConditionFactory
146 // 146 //
147 147
148 namespace { 148 namespace {
149 149
150 bool Matches(const URLMatcherCondition& condition, std::string text) { 150 bool Matches(const URLMatcherCondition& condition, const std::string& text) {
151 return text.find(condition.string_pattern()->pattern()) != 151 return text.find(condition.string_pattern()->pattern()) !=
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.
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 conditions.insert(factory->CreateOriginAndPathMatchesCondition("val")); 977 conditions.insert(factory->CreateOriginAndPathMatchesCondition("val"));
978 const int kConditionSetId = 1; 978 const int kConditionSetId = 1;
979 URLMatcherConditionSet::Vector insert; 979 URLMatcherConditionSet::Vector insert;
980 insert.push_back(make_scoped_refptr( 980 insert.push_back(make_scoped_refptr(
981 new URLMatcherConditionSet(kConditionSetId, conditions))); 981 new URLMatcherConditionSet(kConditionSetId, conditions)));
982 matcher.AddConditionSets(insert); 982 matcher.AddConditionSets(insert);
983 EXPECT_EQ(0u, matcher.MatchURL(url).size()); 983 EXPECT_EQ(0u, matcher.MatchURL(url).size());
984 } 984 }
985 985
986 } // namespace url_matcher 986 } // namespace url_matcher
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698