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

Unified Diff: test/JsEngine.cpp

Issue 10274013: Simplified JsEngine API, Call() and GetVariable() aren`t reallynecessary if Evaluate() returns a v… (Closed)
Patch Set: Slight improvement Created April 11, 2013, 5:44 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/GlobalJsObject.cpp ('k') | 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
@@ -45,27 +45,27 @@ public:
TEST(JsEngineTest, EvaluateAndCall)
{
ThrowingFileReader fileReader;
ThrowingErrorCallback errorCallback;
AdblockPlus::JsEngine jsEngine(&fileReader, 0, &errorCallback);
const std::string source = "function hello() { return 'Hello'; }";
jsEngine.Evaluate(source);
- const std::string result = jsEngine.Call("hello");
+ const std::string result = jsEngine.Evaluate("hello()");
ASSERT_EQ("Hello", result);
}
TEST(JsEngineTest, LoadAndCall)
{
StubFileReader fileReader;
ThrowingErrorCallback errorCallback;
AdblockPlus::JsEngine jsEngine(&fileReader, 0, &errorCallback);
jsEngine.Load("hello.js");
- const std::string result = jsEngine.Call("hello");
+ const std::string result = jsEngine.Evaluate("hello()");
ASSERT_EQ("Hello", result);
}
TEST(JsEngineTest, LoadBadStreamFails)
{
BadFileReader fileReader;
ThrowingErrorCallback errorCallback;
AdblockPlus::JsEngine jsEngine(&fileReader, 0, &errorCallback);
« no previous file with comments | « test/GlobalJsObject.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld