OLD | NEW |
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
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 |
| 167 patterns.clear(); |
| 168 patterns.push_back(&pattern_1); |
| 169 patterns.push_back(&pattern_3); |
| 170 matcher.UnregisterPatterns(patterns); |
| 171 EXPECT_TRUE(matcher.IsEmpty()); |
166 } | 172 } |
167 | 173 |
168 TEST(SubstringSetMatcherTest, TestEmptyMatcher) { | 174 TEST(SubstringSetMatcherTest, TestEmptyMatcher) { |
169 SubstringSetMatcher matcher; | 175 SubstringSetMatcher matcher; |
170 std::set<int> matches; | 176 std::set<int> matches; |
171 matcher.Match("abd", &matches); | 177 matcher.Match("abd", &matches); |
172 EXPECT_TRUE(matches.empty()); | 178 EXPECT_TRUE(matches.empty()); |
173 } | 179 } |
OLD | NEW |