| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 67   protected: | 67   protected: | 
| 68     TestFileSystem* fileSystem; | 68     TestFileSystem* fileSystem; | 
| 69     AdblockPlus::FileSystemPtr fileSystemPtr; | 69     AdblockPlus::FileSystemPtr fileSystemPtr; | 
| 70     AdblockPlus::JsEnginePtr jsEngine; | 70     AdblockPlus::JsEnginePtr jsEngine; | 
| 71     FilterEnginePtr filterEngine; | 71     FilterEnginePtr filterEngine; | 
| 72 | 72 | 
| 73     void SetUp() | 73     void SetUp() | 
| 74     { | 74     { | 
| 75       fileSystem = new TestFileSystem(); | 75       fileSystem = new TestFileSystem(); | 
| 76       fileSystemPtr.reset(fileSystem); | 76       fileSystemPtr.reset(fileSystem); | 
|  | 77       jsEngine = CreateJsEngine(); | 
| 77 | 78 | 
| 78       Reset(); | 79       Reset(); | 
| 79     } | 80     } | 
| 80 | 81 | 
| 81     void Reset(const AdblockPlus::FilterEngine::Prefs& preconfiguredPrefs = | 82     void Reset(const AdblockPlus::FilterEngine::Prefs& preconfiguredPrefs = | 
| 82                AdblockPlus::FilterEngine::Prefs()) | 83                AdblockPlus::FilterEngine::Prefs()) | 
| 83     { | 84     { | 
| 84       jsEngine = CreateJsEngine(); | 85       if (!jsEngine) | 
|  | 86         jsEngine = CreateJsEngine(); | 
| 85       jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LazyLogSystem)); | 87       jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LazyLogSystem)); | 
| 86       jsEngine->SetFileSystem(fileSystemPtr); | 88       jsEngine->SetFileSystem(fileSystemPtr); | 
| 87       jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new LazyWebRequest)); | 89       jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new LazyWebRequest)); | 
| 88       AdblockPlus::FilterEngine::CreationParameters createParams; | 90       AdblockPlus::FilterEngine::CreationParameters createParams; | 
| 89       createParams.preconfiguredPrefs = preconfiguredPrefs; | 91       createParams.preconfiguredPrefs = preconfiguredPrefs; | 
| 90       filterEngine = AdblockPlus::FilterEngine::Create(jsEngine, createParams); | 92       filterEngine = AdblockPlus::FilterEngine::Create(jsEngine, createParams); | 
| 91     } | 93     } | 
| 92   }; | 94   }; | 
| 93 } | 95 } | 
| 94 | 96 | 
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 190   Reset(preconfiguredPrefs); | 192   Reset(preconfiguredPrefs); | 
| 191 | 193 | 
| 192   ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page")->IsBool()); | 194   ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page")->IsBool()); | 
| 193   ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page")->AsBool()); | 195   ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page")->AsBool()); | 
| 194   filterEngine->SetPref("suppress_first_run_page", jsEngine->NewValue(false)); | 196   filterEngine->SetPref("suppress_first_run_page", jsEngine->NewValue(false)); | 
| 195 | 197 | 
| 196   AdblockPlus::Sleep(100); | 198   AdblockPlus::Sleep(100); | 
| 197 | 199 | 
| 198   ASSERT_FALSE(fileSystem->prefsContents.empty()); | 200   ASSERT_FALSE(fileSystem->prefsContents.empty()); | 
| 199 | 201 | 
|  | 202   jsEngine.reset(); | 
| 200   Reset(preconfiguredPrefs); | 203   Reset(preconfiguredPrefs); | 
| 201 | 204 | 
| 202   ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page")->IsBool()); | 205   ASSERT_TRUE(filterEngine->GetPref("suppress_first_run_page")->IsBool()); | 
| 203   ASSERT_FALSE(filterEngine->GetPref("suppress_first_run_page")->AsBool()); | 206   ASSERT_FALSE(filterEngine->GetPref("suppress_first_run_page")->AsBool()); | 
| 204 } | 207 } | 
| OLD | NEW | 
|---|