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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 fileSystemPtr.reset(fileSystem); | 75 fileSystemPtr.reset(fileSystem); |
76 | 76 |
77 ResetJsEngine(); | 77 ResetJsEngine(); |
78 } | 78 } |
79 | 79 |
80 void ResetJsEngine() | 80 void ResetJsEngine() |
81 { | 81 { |
82 jsEngine = CreateJsEngine(); | 82 jsEngine = CreateJsEngine(); |
83 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LazyLogSystem)); | 83 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LazyLogSystem)); |
84 jsEngine->SetFileSystem(fileSystemPtr); | 84 jsEngine->SetFileSystem(fileSystemPtr); |
85 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new LazyWebRequest)); | 85 jsEngine->SetWebRequest(std::make_shared<LazyWebRequest>()); |
86 } | 86 } |
87 | 87 |
88 FilterEnginePtr CreateFilterEngine(const AdblockPlus::FilterEngine::Prefs& p
reconfiguredPrefs = | 88 FilterEnginePtr CreateFilterEngine(const AdblockPlus::FilterEngine::Prefs& p
reconfiguredPrefs = |
89 AdblockPlus::FilterEngine::Prefs()) | 89 AdblockPlus::FilterEngine::Prefs()) |
90 { | 90 { |
91 AdblockPlus::FilterEngine::CreationParameters createParams; | 91 AdblockPlus::FilterEngine::CreationParameters createParams; |
92 createParams.preconfiguredPrefs = preconfiguredPrefs; | 92 createParams.preconfiguredPrefs = preconfiguredPrefs; |
93 return AdblockPlus::FilterEngine::Create(jsEngine, createParams); | 93 return AdblockPlus::FilterEngine::Create(jsEngine, createParams); |
94 } | 94 } |
95 }; | 95 }; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 { | 208 { |
209 ResetJsEngine(); | 209 ResetJsEngine(); |
210 AdblockPlus::FilterEngine::Prefs preconfiguredPrefs; | 210 AdblockPlus::FilterEngine::Prefs preconfiguredPrefs; |
211 preconfiguredPrefs.emplace("suppress_first_run_page", jsEngine->NewValue(tru
e)); | 211 preconfiguredPrefs.emplace("suppress_first_run_page", jsEngine->NewValue(tru
e)); |
212 auto filterEngine = CreateFilterEngine(preconfiguredPrefs); | 212 auto filterEngine = CreateFilterEngine(preconfiguredPrefs); |
213 | 213 |
214 ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page").IsBool()); | 214 ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page").IsBool()); |
215 ASSERT_FALSE(filterEngine->GetPref("suppress_first_run_page").AsBool()); | 215 ASSERT_FALSE(filterEngine->GetPref("suppress_first_run_page").AsBool()); |
216 } | 216 } |
217 } | 217 } |
OLD | NEW |