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

Side by Side Diff: chrome/browser/extensions/api/declarative/substring_set_matcher_unittest.cc

Issue 9830001: Initialize SubstringSetMatcher on construction (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
« no previous file with comments | « chrome/browser/extensions/api/declarative/substring_set_matcher.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/extensions/api/declarative/substring_set_matcher.h" 5 #include "chrome/browser/extensions/api/declarative/substring_set_matcher.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 patterns.clear(); 157 patterns.clear();
158 patterns.push_back(&pattern_2); 158 patterns.push_back(&pattern_2);
159 matcher.UnregisterPatterns(patterns); 159 matcher.UnregisterPatterns(patterns);
160 160
161 matches.clear(); 161 matches.clear();
162 matcher.Match("abd", &matches); 162 matcher.Match("abd", &matches);
163 EXPECT_EQ(1u, matches.size()); 163 EXPECT_EQ(1u, matches.size());
164 EXPECT_TRUE(matches.end() != matches.find(1)); 164 EXPECT_TRUE(matches.end() != matches.find(1));
165 EXPECT_TRUE(matches.end() == matches.find(2)); 165 EXPECT_TRUE(matches.end() == matches.find(2));
166 } 166 }
167
168 TEST(SubstringSetMatcherTest, TestEmptyMatcher) {
169 SubstringSetMatcher matcher;
170 std::set<int> matches;
171 matcher.Match("abd", &matches);
172 EXPECT_TRUE(matches.empty());
173 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/declarative/substring_set_matcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698