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

Unified Diff: test/FilterEngine.cpp

Issue 29361562: Issue 3594 - remove circular references JsEngine-JsValue-JsEngine (Closed)
Patch Set: Created Nov. 3, 2016, 11:26 a.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
Index: test/FilterEngine.cpp
diff --git a/test/FilterEngine.cpp b/test/FilterEngine.cpp
index 177c0c7f2147850c3d846786858b9817c14155b3..05cecfa71a4a2422204edf3dfeb0e0a12de905b6 100644
--- a/test/FilterEngine.cpp
+++ b/test/FilterEngine.cpp
@@ -533,3 +533,16 @@ TEST_F(FilterEngineTest, ElemhideWhitelisting)
"http://example.co.uk",
documentUrls1));
}
+
+TEST(NewFilterEngineTest, MemoryLeak_NoCircularReferences)
+{
+ std::weak_ptr<AdblockPlus::JsEngine> weakJsEngine;
+ {
+ auto jsEngine = AdblockPlus::JsEngine::New();
Oleksandr 2016/11/25 10:38:04 Did you want to assign weakJsEngine to jsEngine in
sergei 2016/11/25 12:04:46 Of course, cannot believe I have missed it))
+ jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new LazyFileSystem()));
+ jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new LazyWebRequest()));
+ jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LazyLogSystem()));
+ auto filterEngine = FilterEnginePtr(new AdblockPlus::FilterEngine(jsEngine));
+ }
+ EXPECT_FALSE(weakJsEngine.lock());
+}

Powered by Google App Engine
This is Rietveld