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

Side by Side 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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 documentUrls1.push_back("http://example.de"); 526 documentUrls1.push_back("http://example.de");
527 527
528 ASSERT_TRUE(filterEngine->IsElemhideWhitelisted( 528 ASSERT_TRUE(filterEngine->IsElemhideWhitelisted(
529 "http://example.com", 529 "http://example.com",
530 documentUrls1)); 530 documentUrls1));
531 531
532 ASSERT_FALSE(filterEngine->IsElemhideWhitelisted( 532 ASSERT_FALSE(filterEngine->IsElemhideWhitelisted(
533 "http://example.co.uk", 533 "http://example.co.uk",
534 documentUrls1)); 534 documentUrls1));
535 } 535 }
536
537 TEST(NewFilterEngineTest, MemoryLeak_NoCircularReferences)
538 {
539 std::weak_ptr<AdblockPlus::JsEngine> weakJsEngine;
540 {
541 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))
542 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new LazyFileSystem()));
543 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new LazyWebRequest()));
544 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LazyLogSystem()));
545 auto filterEngine = FilterEnginePtr(new AdblockPlus::FilterEngine(jsEngine)) ;
546 }
547 EXPECT_FALSE(weakJsEngine.lock());
548 }
OLDNEW

Powered by Google App Engine
This is Rietveld