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

Unified Diff: test/JsEngine.cpp

Issue 5139568831496192: Issue 1551 - Move global callbackParams and stuff around it into the scope of particular test (Closed)
Patch Set: Created Nov. 10, 2014, 9:28 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/JsEngine.cpp
===================================================================
--- a/test/JsEngine.cpp
+++ b/test/JsEngine.cpp
@@ -23,14 +23,6 @@
class JsEngineTest : public BaseJsTest
{
};
-
- bool callbackCalled = false;
- AdblockPlus::JsValueList callbackParams;
- void Callback(AdblockPlus::JsValueList& params)
- {
- callbackCalled = true;
- callbackParams = params;
- }
}
TEST_F(JsEngineTest, Evaluate)
@@ -74,6 +66,15 @@
TEST_F(JsEngineTest, EventCallbacks)
{
+ bool callbackCalled = false;
+ AdblockPlus::JsValueList callbackParams;
+ auto Callback = [&callbackCalled, & callbackParams](
+ const AdblockPlus::JsValueList& params)
+ {
+ callbackCalled = true;
+ callbackParams = params;
+ };
+
// Trigger event without a callback
callbackCalled = false;
jsEngine->Evaluate("_triggerEvent('foobar')");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld