OLD | NEW |
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 platformParams.logSystem.reset(new LazyLogSystem()); | 94 platformParams.logSystem.reset(new LazyLogSystem()); |
95 platformParams.timer.reset(new NoopTimer()); | 95 platformParams.timer.reset(new NoopTimer()); |
96 platform.reset(new Platform(std::move(platformParams))); | 96 platform.reset(new Platform(std::move(platformParams))); |
97 } | 97 } |
98 | 98 |
99 FilterEnginePtr CreateFilterEngine(const AdblockPlus::FilterEngine::Prefs& p
reconfiguredPrefs = | 99 FilterEnginePtr CreateFilterEngine(const AdblockPlus::FilterEngine::Prefs& p
reconfiguredPrefs = |
100 AdblockPlus::FilterEngine::Prefs()) | 100 AdblockPlus::FilterEngine::Prefs()) |
101 { | 101 { |
102 AdblockPlus::FilterEngine::CreationParameters createParams; | 102 AdblockPlus::FilterEngine::CreationParameters createParams; |
103 createParams.preconfiguredPrefs = preconfiguredPrefs; | 103 createParams.preconfiguredPrefs = preconfiguredPrefs; |
104 return ::CreateFilterEngine(*fileSystem, platform->GetJsEngine(), createPa
rams); | 104 return ::CreateFilterEngine(*fileSystem, *platform, createParams); |
105 } | 105 } |
106 }; | 106 }; |
107 } | 107 } |
108 | 108 |
109 TEST_F(PrefsTest, PrefsGetSet) | 109 TEST_F(PrefsTest, PrefsGetSet) |
110 { | 110 { |
111 auto filterEngine = CreateFilterEngine(); | 111 auto filterEngine = CreateFilterEngine(); |
112 ASSERT_EQ("patterns.ini", filterEngine->GetPref("patternsfile").AsString()); | 112 ASSERT_EQ("patterns.ini", filterEngine->GetPref("patternsfile").AsString()); |
113 ASSERT_EQ(24, filterEngine->GetPref("patternsbackupinterval").AsInt()); | 113 ASSERT_EQ(24, filterEngine->GetPref("patternsbackupinterval").AsInt()); |
114 ASSERT_TRUE(filterEngine->GetPref("subscriptions_autoupdate").AsBool()); | 114 ASSERT_TRUE(filterEngine->GetPref("subscriptions_autoupdate").AsBool()); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 { | 219 { |
220 ResetPlatform(); | 220 ResetPlatform(); |
221 AdblockPlus::FilterEngine::Prefs preconfiguredPrefs; | 221 AdblockPlus::FilterEngine::Prefs preconfiguredPrefs; |
222 preconfiguredPrefs.emplace("suppress_first_run_page", platform->GetJsEngine(
)->NewValue(true)); | 222 preconfiguredPrefs.emplace("suppress_first_run_page", platform->GetJsEngine(
)->NewValue(true)); |
223 auto filterEngine = CreateFilterEngine(preconfiguredPrefs); | 223 auto filterEngine = CreateFilterEngine(preconfiguredPrefs); |
224 | 224 |
225 ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page").IsBool()); | 225 ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page").IsBool()); |
226 ASSERT_FALSE(filterEngine->GetPref("suppress_first_run_page").AsBool()); | 226 ASSERT_FALSE(filterEngine->GetPref("suppress_first_run_page").AsBool()); |
227 } | 227 } |
228 } | 228 } |
OLD | NEW |