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

Unified Diff: test/UpdateCheck.cpp

Issue 29417605: Issue 5034 - Part 3: Create plain JsValue instead of JsValuePtr (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Pass JsEngine by ref Created April 20, 2017, 1:01 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/Prefs.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/UpdateCheck.cpp
===================================================================
--- a/test/UpdateCheck.cpp
+++ b/test/UpdateCheck.cpp
@@ -49,17 +49,17 @@
protected:
AdblockPlus::AppInfo appInfo;
TestWebRequest* webRequest;
AdblockPlus::WebRequestPtr webRequestPtr;
AdblockPlus::JsEnginePtr jsEngine;
FilterEnginePtr filterEngine;
bool eventCallbackCalled;
- AdblockPlus::JsConstValueList eventCallbackParams;
+ AdblockPlus::JsValueList eventCallbackParams;
bool updateCallbackCalled;
std::string updateError;
void SetUp()
{
webRequest = new TestWebRequest();
webRequestPtr.reset(webRequest);
@@ -81,17 +81,17 @@
}
void ForceUpdateCheck()
{
filterEngine->ForceUpdateCheck(
std::bind(&UpdateCheckTest::UpdateCallback, this, std::placeholders::_1));
}
- void EventCallback(const AdblockPlus::JsConstValueList& params)
+ void EventCallback(const AdblockPlus::JsValueList& params)
{
eventCallbackCalled = true;
eventCallbackParams = params;
}
void UpdateCallback(const std::string& error)
{
updateCallbackCalled = true;
@@ -114,17 +114,17 @@
ForceUpdateCheck();
AdblockPlus::Sleep(100);
ASSERT_FALSE(eventCallbackCalled);
ASSERT_TRUE(updateCallbackCalled);
ASSERT_FALSE(updateError.empty());
- std::string expectedUrl(filterEngine->GetPref("update_url_release")->AsString());
+ std::string expectedUrl(filterEngine->GetPref("update_url_release").AsString());
std::string platform = jsEngine->Evaluate("require('info').platform")->AsString();
std::string platformVersion = jsEngine->Evaluate("require('info').platformVersion")->AsString();
FindAndReplace(expectedUrl, "%NAME%", appInfo.name);
FindAndReplace(expectedUrl, "%TYPE%", "1"); // manual update
expectedUrl += "&addonName=" + appInfo.name +
"&addonVersion=" + appInfo.version +
"&application=" + appInfo.application +
@@ -149,21 +149,21 @@
Reset();
ForceUpdateCheck();
AdblockPlus::Sleep(100);
ASSERT_TRUE(eventCallbackCalled);
ASSERT_EQ(1u, eventCallbackParams.size());
- ASSERT_EQ("https://foo.bar/", eventCallbackParams[0]->AsString());
+ ASSERT_EQ("https://foo.bar/", eventCallbackParams[0].AsString());
ASSERT_TRUE(updateCallbackCalled);
ASSERT_TRUE(updateError.empty());
- std::string expectedUrl(filterEngine->GetPref("update_url_devbuild")->AsString());
+ std::string expectedUrl(filterEngine->GetPref("update_url_devbuild").AsString());
std::string platform = jsEngine->Evaluate("require('info').platform")->AsString();
std::string platformVersion = jsEngine->Evaluate("require('info').platformVersion")->AsString();
FindAndReplace(expectedUrl, "%NAME%", appInfo.name);
FindAndReplace(expectedUrl, "%TYPE%", "1"); // manual update
expectedUrl += "&addonName=" + appInfo.name +
"&addonVersion=" + appInfo.version +
"&application=" + appInfo.application +
@@ -188,17 +188,17 @@
Reset();
ForceUpdateCheck();
AdblockPlus::Sleep(100);
ASSERT_TRUE(eventCallbackCalled);
ASSERT_EQ(1u, eventCallbackParams.size());
- ASSERT_EQ("https://foo.bar/", eventCallbackParams[0]->AsString());
+ ASSERT_EQ("https://foo.bar/", eventCallbackParams[0].AsString());
ASSERT_TRUE(updateCallbackCalled);
ASSERT_TRUE(updateError.empty());
}
TEST_F(UpdateCheckTest, WrongApplication)
{
webRequest->response.status = AdblockPlus::WebRequest::NS_OK;
webRequest->response.responseStatus = 200;
« no previous file with comments | « test/Prefs.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld