LEFT | RIGHT |
(no file at all) | |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 ResetJsEngine(); | 133 ResetJsEngine(); |
134 auto filterEngine = CreateFilterEngine(); | 134 auto filterEngine = CreateFilterEngine(); |
135 ASSERT_EQ("filters.ini", filterEngine->GetPref("patternsfile").AsString()); | 135 ASSERT_EQ("filters.ini", filterEngine->GetPref("patternsfile").AsString()); |
136 ASSERT_EQ(48, filterEngine->GetPref("patternsbackupinterval").AsInt()); | 136 ASSERT_EQ(48, filterEngine->GetPref("patternsbackupinterval").AsInt()); |
137 ASSERT_FALSE(filterEngine->GetPref("subscriptions_autoupdate").AsBool()); | 137 ASSERT_FALSE(filterEngine->GetPref("subscriptions_autoupdate").AsBool()); |
138 } | 138 } |
139 } | 139 } |
140 | 140 |
141 TEST_F(PrefsTest, UnknownPrefs) | 141 TEST_F(PrefsTest, UnknownPrefs) |
142 { | 142 { |
143 using IOBuffer = AdblockPlus::FileSystem::IOBuffer; | 143 using IOBuffer = AdblockPlus::IFileSystem::IOBuffer; |
144 std::string content = "{\"foobar\":2, \"patternsbackupinterval\": 12}"; | 144 std::string content = "{\"foobar\":2, \"patternsbackupinterval\": 12}"; |
145 fileSystem->prefsContents = IOBuffer(content.cbegin(), content.cend()); | 145 fileSystem->prefsContents = IOBuffer(content.cbegin(), content.cend()); |
146 auto filterEngine = CreateFilterEngine(); | 146 auto filterEngine = CreateFilterEngine(); |
147 ASSERT_TRUE(filterEngine->GetPref("foobar").IsUndefined()); | 147 ASSERT_TRUE(filterEngine->GetPref("foobar").IsUndefined()); |
148 ASSERT_EQ(12, filterEngine->GetPref("patternsbackupinterval").AsInt()); | 148 ASSERT_EQ(12, filterEngine->GetPref("patternsbackupinterval").AsInt()); |
149 } | 149 } |
150 | 150 |
151 TEST_F(PrefsTest, SyntaxFailure) | 151 TEST_F(PrefsTest, SyntaxFailure) |
152 { | 152 { |
153 using IOBuffer = AdblockPlus::FileSystem::IOBuffer; | 153 using IOBuffer = AdblockPlus::IFileSystem::IOBuffer; |
154 std::string content = "{\"patternsbackupinterval\": 6, \"foo\"}"; | 154 std::string content = "{\"patternsbackupinterval\": 6, \"foo\"}"; |
155 fileSystem->prefsContents = IOBuffer(content.cbegin(), content.cend()); | 155 fileSystem->prefsContents = IOBuffer(content.cbegin(), content.cend()); |
156 auto filterEngine = CreateFilterEngine(); | 156 auto filterEngine = CreateFilterEngine(); |
157 | 157 |
158 ASSERT_EQ(24, filterEngine->GetPref("patternsbackupinterval").AsInt()); | 158 ASSERT_EQ(24, filterEngine->GetPref("patternsbackupinterval").AsInt()); |
159 } | 159 } |
160 | 160 |
161 TEST_F(PrefsTest, PreconfiguredPrefsPreconfigured) | 161 TEST_F(PrefsTest, PreconfiguredPrefsPreconfigured) |
162 { | 162 { |
163 AdblockPlus::FilterEngine::Prefs preconfiguredPrefs; | 163 AdblockPlus::FilterEngine::Prefs preconfiguredPrefs; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 { | 209 { |
210 ResetJsEngine(); | 210 ResetJsEngine(); |
211 AdblockPlus::FilterEngine::Prefs preconfiguredPrefs; | 211 AdblockPlus::FilterEngine::Prefs preconfiguredPrefs; |
212 preconfiguredPrefs.emplace("suppress_first_run_page", jsEngine->NewValue(tru
e)); | 212 preconfiguredPrefs.emplace("suppress_first_run_page", jsEngine->NewValue(tru
e)); |
213 auto filterEngine = CreateFilterEngine(preconfiguredPrefs); | 213 auto filterEngine = CreateFilterEngine(preconfiguredPrefs); |
214 | 214 |
215 ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page").IsBool()); | 215 ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page").IsBool()); |
216 ASSERT_FALSE(filterEngine->GetPref("suppress_first_run_page").AsBool()); | 216 ASSERT_FALSE(filterEngine->GetPref("suppress_first_run_page").AsBool()); |
217 } | 217 } |
218 } | 218 } |
LEFT | RIGHT |