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

Unified Diff: test/UpdateCheck.cpp

Issue 29508569: Issue 5450 - don't expose std::shared_ptr<JsEngine> (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created Aug. 7, 2017, 8:39 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
« no previous file with comments | « test/Prefs.cpp ('k') | test/WebRequest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/UpdateCheck.cpp
diff --git a/test/UpdateCheck.cpp b/test/UpdateCheck.cpp
index f8322ff1d70ad73335fd756debd38fa3f0b5d083..fca55eb3831d66092d2083541bfdd629e71e6461 100644
--- a/test/UpdateCheck.cpp
+++ b/test/UpdateCheck.cpp
@@ -31,14 +31,13 @@ namespace
source.replace(pos, find.size(), replace);
}
- class UpdateCheckTest : public ::testing::Test
+ class UpdateCheckTest : public BaseJsTest
{
protected:
AdblockPlus::AppInfo appInfo;
AdblockPlus::ServerResponse webRequestResponse;
DelayedWebRequest::SharedTasks webRequestTasks;
DelayedTimer::SharedTasks timerTasks;
- std::unique_ptr<Platform> platform;
FilterEnginePtr filterEngine;
bool eventCallbackCalled;
@@ -62,7 +61,7 @@ namespace
platformParams.webRequest = DelayedWebRequest::New(webRequestTasks);
platform.reset(new Platform(std::move(platformParams)));
platform->SetUpJsEngine(appInfo);
- platform->GetJsEngine()->SetEventCallback("updateAvailable", [this](JsValueList&& params)
+ GetJsEngine().SetEventCallback("updateAvailable", [this](JsValueList&& params)
{
eventCallbackCalled = true;
eventCallbackParams = std::move(params);
@@ -121,8 +120,8 @@ TEST_F(UpdateCheckTest, RequestFailure)
ASSERT_FALSE(updateError.empty());
std::string expectedUrl(filterEngine->GetPref("update_url_release").AsString());
- std::string platform = filterEngine->GetJsEngine()->Evaluate("require('info').platform").AsString();
- std::string platformVersion = filterEngine->GetJsEngine()->Evaluate("require('info').platformVersion").AsString();
+ std::string platform = GetJsEngine().Evaluate("require('info').platform").AsString();
+ std::string platformVersion = GetJsEngine().Evaluate("require('info').platformVersion").AsString();
FindAndReplace(expectedUrl, "%NAME%", appInfo.name);
FindAndReplace(expectedUrl, "%TYPE%", "1"); // manual update
@@ -160,8 +159,8 @@ TEST_F(UpdateCheckTest, UpdateAvailable)
ASSERT_TRUE(updateError.empty());
std::string expectedUrl(filterEngine->GetPref("update_url_devbuild").AsString());
- std::string platform = filterEngine->GetJsEngine()->Evaluate("require('info').platform").AsString();
- std::string platformVersion = filterEngine->GetJsEngine()->Evaluate("require('info').platformVersion").AsString();
+ std::string platform = GetJsEngine().Evaluate("require('info').platform").AsString();
+ std::string platformVersion = GetJsEngine().Evaluate("require('info').platformVersion").AsString();
FindAndReplace(expectedUrl, "%NAME%", appInfo.name);
FindAndReplace(expectedUrl, "%TYPE%", "1"); // manual update
« no previous file with comments | « test/Prefs.cpp ('k') | test/WebRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld