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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/values.h" | 6 #include "base/values.h" |
7 #include "chrome/common/extensions/event_filter.h" | 7 #include "extensions/common/event_filter.h" |
8 #include "chrome/common/extensions/event_filtering_info.h" | 8 #include "extensions/common/event_filtering_info.h" |
9 #include "chrome/common/extensions/event_matcher.h" | 9 #include "extensions/common/event_matcher.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 namespace extensions { | 12 namespace extensions { |
13 | 13 |
14 class EventFilterUnittest : public testing::Test { | 14 class EventFilterUnittest : public testing::Test { |
15 public: | 15 public: |
16 EventFilterUnittest() { | 16 EventFilterUnittest() { |
17 google_event_.SetURL(GURL("http://google.com")); | 17 google_event_.SetURL(GURL("http://google.com")); |
18 yahoo_event_.SetURL(GURL("http://yahoo.com")); | 18 yahoo_event_.SetURL(GURL("http://yahoo.com")); |
19 random_url_event_.SetURL(GURL("http://www.something-else.com")); | 19 random_url_event_.SetURL(GURL("http://www.something-else.com")); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 EmptyURLsShouldBeMatchedByEmptyURLFiltersWithAnEmptyItem) { | 235 EmptyURLsShouldBeMatchedByEmptyURLFiltersWithAnEmptyItem) { |
236 scoped_ptr<EventMatcher> matcher(MatcherFromURLFilterList(ValueAsList( | 236 scoped_ptr<EventMatcher> matcher(MatcherFromURLFilterList(ValueAsList( |
237 scoped_ptr<Value>(new DictionaryValue())))); | 237 scoped_ptr<Value>(new DictionaryValue())))); |
238 int id = event_filter_.AddEventMatcher("event1", matcher.Pass()); | 238 int id = event_filter_.AddEventMatcher("event1", matcher.Pass()); |
239 std::set<int> matches = event_filter_.MatchEvent("event1", empty_url_event_); | 239 std::set<int> matches = event_filter_.MatchEvent("event1", empty_url_event_); |
240 ASSERT_EQ(1u, matches.size()); | 240 ASSERT_EQ(1u, matches.size()); |
241 ASSERT_EQ(1u, matches.count(id)); | 241 ASSERT_EQ(1u, matches.count(id)); |
242 } | 242 } |
243 | 243 |
244 } // namespace extensions | 244 } // namespace extensions |
OLD | NEW |