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

Unified Diff: test/FilterEngine.cpp

Issue 29428624: Issue 5180 - stop using of WebRequestPtr in tests (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created May 3, 2017, 2:07 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/BaseJsTest.h ('k') | test/JsEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/FilterEngine.cpp
diff --git a/test/FilterEngine.cpp b/test/FilterEngine.cpp
index 390f967b1ca9897dc4625ed8d00e17676b0add1c..7791054f840376335cfb3f950ba56003b94b12cb 100644
--- a/test/FilterEngine.cpp
+++ b/test/FilterEngine.cpp
@@ -53,7 +53,7 @@ namespace
{
BaseJsTest::SetUp();
jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new FileSystem));
- jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new LazyWebRequest));
+ jsEngine->SetWebRequest(std::make_shared<LazyWebRequest>());
jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LogSystem));
filterEngine = AdblockPlus::FilterEngine::Create(jsEngine);
}
@@ -82,7 +82,7 @@ namespace
}
};
- MockWebRequest* mockWebRequest;
+ std::shared_ptr<MockWebRequest> mockWebRequest;
FilterEnginePtr filterEngine;
void SetUp()
@@ -92,8 +92,7 @@ namespace
appInfo.version = "1.0.1";
AdblockPlus::JsEnginePtr jsEngine = CreateJsEngine(appInfo);
jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new LazyFileSystem));
- mockWebRequest = new MockWebRequest;
- jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(mockWebRequest));
+ jsEngine->SetWebRequest(mockWebRequest = std::make_shared<MockWebRequest>());
filterEngine = AdblockPlus::FilterEngine::Create(jsEngine);
}
};
@@ -117,7 +116,7 @@ namespace
auto jsEngine = JsEngine::New(appInfo);
weakJsEngine = jsEngine;
jsEngine->SetFileSystem(fileSystem);
- jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new LazyWebRequest()));
+ jsEngine->SetWebRequest(std::make_shared<LazyWebRequest>());
jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LazyLogSystem()));
return jsEngine;
}
@@ -193,7 +192,7 @@ namespace
std::vector<std::pair<bool, std::string>> strings;
};
protected:
- MockWebRequest* webRequest;
+ std::shared_ptr<MockWebRequest> webRequest;
std::string subscriptionUrlPrefix;
FilterEngine::CreationParameters createParams;
// HACK: it's a shared pointer to keep it available in
@@ -217,7 +216,7 @@ namespace
data = std::make_shared<SharedData>();
BaseJsTest::SetUp();
jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new LazyFileSystem()));
- jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(webRequest = new MockWebRequest()));
+ jsEngine->SetWebRequest(webRequest = std::make_shared<MockWebRequest>());
jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LazyLogSystem()));
subscriptionUrlPrefix = "http://example";
« no previous file with comments | « test/BaseJsTest.h ('k') | test/JsEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld