| 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-2016 Eyeo GmbH | 3 * Copyright (C) 2006-2016 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 18 matching lines...) Expand all Loading... |
| 29 public: | 29 public: |
| 30 StatResult Stat(const std::string& path) const | 30 StatResult Stat(const std::string& path) const |
| 31 { | 31 { |
| 32 return StatResult(); | 32 return StatResult(); |
| 33 } | 33 } |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 template<class FileSystem, class LogSystem> | 36 template<class FileSystem, class LogSystem> |
| 37 class FilterEngineTestGeneric : public BaseJsTest | 37 class FilterEngineTestGeneric : public BaseJsTest |
| 38 { | 38 { |
| 39 |
| 39 protected: | 40 protected: |
| 40 FilterEnginePtr filterEngine; | 41 FilterEnginePtr filterEngine; |
| 42 std::shared_ptr<LazyWebRequest> webRequest; |
| 41 | 43 |
| 42 void SetUp() | 44 void SetUp() |
| 43 { | 45 { |
| 44 BaseJsTest::SetUp(); | 46 BaseJsTest::SetUp(); |
| 45 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new FileSystem)); | 47 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new FileSystem)); |
| 46 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new LazyWebRequest)); | 48 webRequest = std::make_shared<LazyWebRequest>(); |
| 49 jsEngine->SetWebRequest(webRequest); |
| 47 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LogSystem)); | 50 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LogSystem)); |
| 48 filterEngine = FilterEnginePtr(new AdblockPlus::FilterEngine(jsEngine)); | 51 filterEngine = FilterEnginePtr(new AdblockPlus::FilterEngine(jsEngine)); |
| 49 } | 52 } |
| 53 |
| 54 void TearDown() |
| 55 { |
| 56 if (webRequest) |
| 57 { |
| 58 webRequest->Cancel(); |
| 59 } |
| 60 } |
| 50 }; | 61 }; |
| 51 | 62 |
| 52 typedef FilterEngineTestGeneric<LazyFileSystem, AdblockPlus::DefaultLogSystem>
FilterEngineTest; | 63 typedef FilterEngineTestGeneric<LazyFileSystem, AdblockPlus::DefaultLogSystem>
FilterEngineTest; |
| 53 typedef FilterEngineTestGeneric<VeryLazyFileSystem, LazyLogSystem> FilterEngin
eTestNoData; | 64 typedef FilterEngineTestGeneric<VeryLazyFileSystem, LazyLogSystem> FilterEngin
eTestNoData; |
| 54 | 65 |
| 55 struct MockFilterChangeCallback | 66 struct MockFilterChangeCallback |
| 56 { | 67 { |
| 57 MockFilterChangeCallback(int& timesCalled) : timesCalled(timesCalled) {} | 68 MockFilterChangeCallback(int& timesCalled) : timesCalled(timesCalled) {} |
| 58 | 69 |
| 59 void operator()(const std::string&, const AdblockPlus::JsValuePtr) | 70 void operator()(const std::string&, const AdblockPlus::JsValuePtr) |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 | 630 |
| 620 TEST_F(FilterEngineWithFreshFolder, DisableSubscriptionsAutoSelectOnFirstRun) | 631 TEST_F(FilterEngineWithFreshFolder, DisableSubscriptionsAutoSelectOnFirstRun) |
| 621 { | 632 { |
| 622 auto jsEngine = createJsEngine(); | 633 auto jsEngine = createJsEngine(); |
| 623 FilterEngine::Prefs preSettings; | 634 FilterEngine::Prefs preSettings; |
| 624 preSettings["first_run_subscription_auto_select"] = jsEngine->NewValue(false); | 635 preSettings["first_run_subscription_auto_select"] = jsEngine->NewValue(false); |
| 625 auto filterEngine = FilterEnginePtr(new AdblockPlus::FilterEngine(jsEngine, pr
eSettings)); | 636 auto filterEngine = FilterEnginePtr(new AdblockPlus::FilterEngine(jsEngine, pr
eSettings)); |
| 626 const auto subscriptions = filterEngine->GetListedSubscriptions(); | 637 const auto subscriptions = filterEngine->GetListedSubscriptions(); |
| 627 EXPECT_EQ(0u, subscriptions.size()); | 638 EXPECT_EQ(0u, subscriptions.size()); |
| 628 } | 639 } |
| OLD | NEW |