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

Unified Diff: test/UpdateCheck.cpp

Issue 29500602: Issue 5450 - introduce the Platform class (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created July 28, 2017, 12:40 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
Index: test/UpdateCheck.cpp
diff --git a/test/UpdateCheck.cpp b/test/UpdateCheck.cpp
index b984daa4d5a4c229ae330eb0404af9c9235f9361..7a30d8c0a5689f0352f37aa9d8b13c5f84c1e79f 100644
--- a/test/UpdateCheck.cpp
+++ b/test/UpdateCheck.cpp
@@ -38,6 +38,7 @@ namespace
AdblockPlus::ServerResponse webRequestResponse;
DelayedWebRequest::SharedTasks webRequestTasks;
DelayedTimer::SharedTasks timerTasks;
+ std::unique_ptr<Platform> platform;
FilterEnginePtr filterEngine;
bool eventCallbackCalled;
@@ -53,21 +54,21 @@ namespace
void CreateFilterEngine()
{
- JsEngineCreationParameters jsEngineParams;
- jsEngineParams.appInfo = appInfo;
LazyFileSystem* fileSystem;
- jsEngineParams.logSystem.reset(new LazyLogSystem());
- jsEngineParams.fileSystem.reset(fileSystem = new LazyFileSystem());
- jsEngineParams.timer = DelayedTimer::New(timerTasks);
- jsEngineParams.webRequest = DelayedWebRequest::New(webRequestTasks);
- auto jsEngine = CreateJsEngine(std::move(jsEngineParams));
- jsEngine->SetEventCallback("updateAvailable", [this](JsValueList&& params)
+ ThrowingPlatformCreationParameters platformParams;
+ platformParams.logSystem.reset(new LazyLogSystem());
+ platformParams.timer = DelayedTimer::New(timerTasks);
+ platformParams.fileSystem.reset(fileSystem = new LazyFileSystem());
+ platformParams.webRequest = DelayedWebRequest::New(webRequestTasks);
+ platform.reset(new Platform(std::move(platformParams)));
+ platform->SetUpJsEngine(appInfo);
+ platform->GetJsEngine()->SetEventCallback("updateAvailable", [this](JsValueList&& params)
{
eventCallbackCalled = true;
eventCallbackParams = std::move(params);
});
- filterEngine = ::CreateFilterEngine(*fileSystem, jsEngine);
+ filterEngine = ::CreateFilterEngine(*fileSystem, platform->GetJsEngine());
}
// Returns a URL or the empty string if there is no such request.
@@ -306,4 +307,4 @@ TEST_F(UpdateCheckTest, SetRemoveUpdateAvailableCallback)
// previous handler is not restored
EXPECT_FALSE(eventCallbackCalled);
-}
+}
« include/AdblockPlus/JsEngine.h ('K') | « test/Prefs.cpp ('k') | test/WebRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld