LEFT | RIGHT |
1 #include <AdblockPlus.h> | 1 #include <AdblockPlus.h> |
2 #include <gtest/gtest.h> | 2 #include <gtest/gtest.h> |
3 | 3 |
4 TEST(FilterEngineStubsTest, FilterCreation) | 4 TEST(FilterEngineStubsTest, FilterCreation) |
5 { | 5 { |
6 AdblockPlus::JsEngine jsEngine(0, 0); | 6 AdblockPlus::JsEngine jsEngine(0, 0); |
7 AdblockPlus::FilterEngine filterEngine(jsEngine); | 7 AdblockPlus::FilterEngine filterEngine(jsEngine); |
8 | 8 |
9 AdblockPlus::Filter& filter1 = filterEngine.GetFilter("foo"); | 9 AdblockPlus::Filter& filter1 = filterEngine.GetFilter("foo"); |
10 ASSERT_EQ(filter1.GetProperty("type", -1), AdblockPlus::BLOCKING_RULE); | 10 ASSERT_EQ(filter1.GetProperty("type", -1), AdblockPlus::Filter::TYPE_BLOCKING)
; |
11 AdblockPlus::Filter& filter2 = filterEngine.GetFilter("@@foo"); | 11 AdblockPlus::Filter& filter2 = filterEngine.GetFilter("@@foo"); |
12 ASSERT_EQ(filter2.GetProperty("type", -1), AdblockPlus::EXCEPTION_RULE); | 12 ASSERT_EQ(filter2.GetProperty("type", -1), AdblockPlus::Filter::TYPE_EXCEPTION
); |
13 AdblockPlus::Filter& filter3 = filterEngine.GetFilter("example.com##foo"); | 13 AdblockPlus::Filter& filter3 = filterEngine.GetFilter("example.com##foo"); |
14 ASSERT_EQ(filter3.GetProperty("type", -1), AdblockPlus::ELEMHIDE_RULE); | 14 ASSERT_EQ(filter3.GetProperty("type", -1), AdblockPlus::Filter::TYPE_ELEMHIDE)
; |
15 AdblockPlus::Filter& filter4 = filterEngine.GetFilter("example.com#@#foo"); | 15 AdblockPlus::Filter& filter4 = filterEngine.GetFilter("example.com#@#foo"); |
16 ASSERT_EQ(filter4.GetProperty("type", -1), AdblockPlus::ELEMHIDE_EXCEPTION_RUL
E); | 16 ASSERT_EQ(filter4.GetProperty("type", -1), AdblockPlus::Filter::TYPE_ELEMHIDE_
EXCEPTION); |
17 AdblockPlus::Filter& filter5 = filterEngine.GetFilter(" foo "); | 17 AdblockPlus::Filter& filter5 = filterEngine.GetFilter(" foo "); |
18 ASSERT_EQ(&filter5, &filter1); | 18 ASSERT_EQ(&filter5, &filter1); |
19 } | 19 } |
20 | 20 |
21 TEST(FilterEngineStubsTest, FilterProperties) | 21 TEST(FilterEngineStubsTest, FilterProperties) |
22 { | 22 { |
23 AdblockPlus::JsEngine jsEngine(0, 0); | 23 AdblockPlus::JsEngine jsEngine(0, 0); |
24 AdblockPlus::FilterEngine filterEngine(jsEngine); | 24 AdblockPlus::FilterEngine filterEngine(jsEngine); |
25 AdblockPlus::Filter& filter = filterEngine.GetFilter("foo"); | 25 AdblockPlus::Filter& filter = filterEngine.GetFilter("foo"); |
26 | 26 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 AdblockPlus::JsEngine jsEngine(0, 0); | 97 AdblockPlus::JsEngine jsEngine(0, 0); |
98 AdblockPlus::FilterEngine filterEngine(jsEngine); | 98 AdblockPlus::FilterEngine filterEngine(jsEngine); |
99 AdblockPlus::Subscription& subscription = filterEngine.GetSubscription("foo"); | 99 AdblockPlus::Subscription& subscription = filterEngine.GetSubscription("foo"); |
100 subscription.AddToList(); | 100 subscription.AddToList(); |
101 | 101 |
102 AdblockPlus::FilterPtr match1 = filterEngine.Matches("http://example.org", "",
""); | 102 AdblockPlus::FilterPtr match1 = filterEngine.Matches("http://example.org", "",
""); |
103 ASSERT_FALSE(match1); | 103 ASSERT_FALSE(match1); |
104 | 104 |
105 AdblockPlus::FilterPtr match2 = filterEngine.Matches("http://example.org/adban
ner.gif", "", ""); | 105 AdblockPlus::FilterPtr match2 = filterEngine.Matches("http://example.org/adban
ner.gif", "", ""); |
106 ASSERT_TRUE(match2); | 106 ASSERT_TRUE(match2); |
107 ASSERT_EQ(match2->GetProperty("type", -1), AdblockPlus::BLOCKING_RULE); | 107 ASSERT_EQ(match2->GetProperty("type", -1), AdblockPlus::Filter::TYPE_BLOCKING)
; |
108 | 108 |
109 AdblockPlus::FilterPtr match3 = filterEngine.Matches("http://example.org/notba
nner.gif", "", ""); | 109 AdblockPlus::FilterPtr match3 = filterEngine.Matches("http://example.org/notba
nner.gif", "", ""); |
110 ASSERT_TRUE(match3); | 110 ASSERT_TRUE(match3); |
111 ASSERT_EQ(match3->GetProperty("type", -1), AdblockPlus::EXCEPTION_RULE); | 111 ASSERT_EQ(match3->GetProperty("type", -1), AdblockPlus::Filter::TYPE_EXCEPTION
); |
112 | 112 |
113 AdblockPlus::FilterPtr match4 = filterEngine.Matches("http://example.org/notba
nner.gif", "", ""); | 113 AdblockPlus::FilterPtr match4 = filterEngine.Matches("http://example.org/notba
nner.gif", "", ""); |
114 ASSERT_TRUE(match4); | 114 ASSERT_TRUE(match4); |
115 ASSERT_EQ(match4->GetProperty("type", -1), AdblockPlus::EXCEPTION_RULE); | 115 ASSERT_EQ(match4->GetProperty("type", -1), AdblockPlus::Filter::TYPE_EXCEPTION
); |
116 } | 116 } |
LEFT | RIGHT |