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

Unified Diff: test/WebRequest.cpp

Issue 29498576: Issue 4832 - remove API allowing changing of LogSystem after Initialization of JsEngine (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: address comment Created July 26, 2017, 4:48 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/JsEngine.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/WebRequest.cpp
diff --git a/test/WebRequest.cpp b/test/WebRequest.cpp
index 2a6267552f5525d19044bab8cc3c785d10621128..5037feb001b59ea675a57a3a693469740119f824 100644
--- a/test/WebRequest.cpp
+++ b/test/WebRequest.cpp
@@ -31,6 +31,7 @@ namespace
void SetUp()
{
JsEngineCreationParameters jsEngineParams;
+ jsEngineParams.logSystem = CreateLogSystem();
jsEngineParams.timer.reset(new NoopTimer());
jsEngineParams.fileSystem.reset(new LazyFileSystem());
jsEngineParams.webRequest = CreateWebRequest();
@@ -42,6 +43,11 @@ namespace
return CreateDefaultWebRequest();
}
+ virtual LogSystemPtr CreateLogSystem()
+ {
+ return LogSystemPtr(new ThrowingLogSystem());
+ }
+
JsEnginePtr jsEngine;
};
@@ -245,14 +251,19 @@ namespace
}
};
- typedef std::shared_ptr<CatchLogSystem> CatchLogSystemPtr;
+ class MockWebRequestAndLogSystemTest : public MockWebRequestTest
+ {
+ LogSystemPtr CreateLogSystem() override
+ {
+ return LogSystemPtr(catchLogSystem = new CatchLogSystem());
+ }
+ protected:
+ CatchLogSystem* catchLogSystem;
+ };
}
-TEST_F(MockWebRequestTest, RequestHeaderValidation)
+TEST_F(MockWebRequestAndLogSystemTest, RequestHeaderValidation)
{
- auto catchLogSystem = CatchLogSystemPtr(new CatchLogSystem());
- jsEngine->SetLogSystem(catchLogSystem);
-
auto filterEngine = AdblockPlus::FilterEngine::Create(jsEngine);
const std::string msg = "Attempt to set a forbidden header was denied: ";
« no previous file with comments | « test/JsEngine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld