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

Unified Diff: test/JsEngine.cpp

Issue 29410664: Issue 5013 - Use const JsValue and pass reference where applicable (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created April 12, 2017, 3:24 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/JsEngine.cpp
===================================================================
--- a/test/JsEngine.cpp
+++ b/test/JsEngine.cpp
@@ -62,19 +62,19 @@
value = jsEngine->NewObject();
ASSERT_TRUE(value->IsObject());
ASSERT_EQ(0u, value->GetOwnPropertyNames().size());
}
TEST_F(JsEngineTest, EventCallbacks)
{
bool callbackCalled = false;
- AdblockPlus::JsValueList callbackParams;
+ AdblockPlus::JsConstValueList callbackParams;
auto Callback = [&callbackCalled, & callbackParams](
- const AdblockPlus::JsValueList& params)
+ const AdblockPlus::JsConstValueList& params)
{
callbackCalled = true;
callbackParams = params;
};
// Trigger event without a callback
callbackCalled = false;
jsEngine->Evaluate("_triggerEvent('foobar')");
@@ -123,14 +123,14 @@
AdblockPlus::WebRequestPtr webRequest(new AdblockPlus::DefaultWebRequest());
jsEngine->SetWebRequest(webRequest);
ASSERT_EQ(webRequest, jsEngine->GetWebRequest());
}
TEST(NewJsEngineTest, GlobalPropertyTest)
{
AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New());
- jsEngine->SetGlobalProperty("foo", jsEngine->NewValue("bar"));
+ jsEngine->SetGlobalProperty("foo", *jsEngine->NewValue("bar"));
AdblockPlus::JsValuePtr foo = jsEngine->Evaluate("foo");
ASSERT_TRUE(foo->IsString());
ASSERT_EQ(foo->AsString(), "bar");
}
« src/FilterEngine.cpp ('K') | « test/FilterEngine.cpp ('k') | test/JsValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld