Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/Notification.cpp

Issue 29508591: Issue 5450 - don't expose std::shared_ptr<FilterEngine> (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: rebase Created Aug. 7, 2017, 1:08 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/FilterEngine.cpp ('k') | test/Prefs.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/Notification.cpp
diff --git a/test/Notification.cpp b/test/Notification.cpp
index 4c4ec8d3afcb5294e7cab7cdd7c133d1512dd49d..5daa7bd69f397761183c6e8c2da7545db40dc1c6 100644
--- a/test/Notification.cpp
+++ b/test/Notification.cpp
@@ -25,12 +25,9 @@ using namespace AdblockPlus;
namespace
{
- typedef std::shared_ptr<FilterEngine> FilterEnginePtr;
-
class NotificationTest : public BaseJsTest
{
protected:
- FilterEnginePtr filterEngine;
void SetUp()
{
LazyFileSystem* fileSystem;
@@ -39,7 +36,7 @@ namespace
platformParams.fileSystem.reset(fileSystem = new LazyFileSystem());
platformParams.webRequest.reset(new NoopWebRequest());
platform.reset(new Platform(std::move(platformParams)));
- filterEngine = CreateFilterEngine(*fileSystem, *platform);
+ CreateFilterEngine(*fileSystem, *platform);
}
void AddNotification(const std::string& notification)
@@ -53,12 +50,13 @@ namespace
std::unique_ptr<Notification> PeekNotification(const std::string& url = std::string())
{
std::unique_ptr<Notification> retValue;
- filterEngine->SetShowNotificationCallback(
+ auto& filterEngine = platform->GetFilterEngine();
+ filterEngine.SetShowNotificationCallback(
[&retValue](Notification&& notification) {
retValue.reset(new Notification(std::move(notification)));
});
- filterEngine->ShowNextNotification(url);
- filterEngine->RemoveShowNotificationCallback();
+ filterEngine.ShowNextNotification(url);
+ filterEngine.RemoveShowNotificationCallback();
return retValue;
}
};
@@ -90,7 +88,6 @@ namespace
class NotificationMockWebRequestTest : public BaseJsTest
{
protected:
- FilterEnginePtr filterEngine;
bool isNotificationCallbackCalled;
void SetUp()
{
« no previous file with comments | « test/FilterEngine.cpp ('k') | test/Prefs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld