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

Unified Diff: test/AppInfoJsObject.cpp

Issue 29500602: Issue 5450 - introduce the Platform class (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created July 28, 2017, 12:40 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/AppInfoJsObject.cpp
diff --git a/test/AppInfoJsObject.cpp b/test/AppInfoJsObject.cpp
index 603dde5478410a0f6683d4d0bfc6f6fdb2bab8f9..563264c0577c94c833fc5e8d290fecd0abd4ef80 100644
--- a/test/AppInfoJsObject.cpp
+++ b/test/AppInfoJsObject.cpp
@@ -17,6 +17,7 @@
#include <AdblockPlus.h>
#include <gtest/gtest.h>
+#include "BaseJsTest.h"
TEST(AppInfoJsObjectTest, AllProperties)
{
@@ -27,23 +28,24 @@ TEST(AppInfoJsObjectTest, AllProperties)
appInfo.applicationVersion = "5";
appInfo.locale = "2";
appInfo.developmentBuild = true;
- AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New(appInfo));
- ASSERT_EQ("1", jsEngine->Evaluate("_appInfo.version").AsString());
- ASSERT_EQ("3", jsEngine->Evaluate("_appInfo.name").AsString());
- ASSERT_EQ("4", jsEngine->Evaluate("_appInfo.application").AsString());
- ASSERT_EQ("5", jsEngine->Evaluate("_appInfo.applicationVersion").AsString());
- ASSERT_EQ("2", jsEngine->Evaluate("_appInfo.locale").AsString());
- ASSERT_TRUE(jsEngine->Evaluate("_appInfo.developmentBuild").AsBool());
+ AdblockPlus::Platform platform{ThrowingPlatformCreationParameters()};
+ platform.SetUpJsEngine(appInfo);
+ ASSERT_EQ("1", platform.GetJsEngine()->Evaluate("_appInfo.version").AsString());
+ ASSERT_EQ("3", platform.GetJsEngine()->Evaluate("_appInfo.name").AsString());
+ ASSERT_EQ("4", platform.GetJsEngine()->Evaluate("_appInfo.application").AsString());
+ ASSERT_EQ("5", platform.GetJsEngine()->Evaluate("_appInfo.applicationVersion").AsString());
+ ASSERT_EQ("2", platform.GetJsEngine()->Evaluate("_appInfo.locale").AsString());
+ ASSERT_TRUE(platform.GetJsEngine()->Evaluate("_appInfo.developmentBuild").AsBool());
}
TEST(AppInfoJsObjectTest, DefaultPropertyValues)
{
- AdblockPlus::AppInfo appInfo;
- AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New(appInfo));
- ASSERT_EQ("", jsEngine->Evaluate("_appInfo.version").AsString());
- ASSERT_EQ("", jsEngine->Evaluate("_appInfo.name").AsString());
- ASSERT_EQ("", jsEngine->Evaluate("_appInfo.application").AsString());
- ASSERT_EQ("", jsEngine->Evaluate("_appInfo.applicationVersion").AsString());
- ASSERT_EQ("", jsEngine->Evaluate("_appInfo.locale").AsString());
- ASSERT_FALSE(jsEngine->Evaluate("_appInfo.developmentBuild").AsBool());
+ AdblockPlus::Platform platform{ThrowingPlatformCreationParameters()};
+ platform.SetUpJsEngine();
+ ASSERT_EQ("", platform.GetJsEngine()->Evaluate("_appInfo.version").AsString());
+ ASSERT_EQ("", platform.GetJsEngine()->Evaluate("_appInfo.name").AsString());
+ ASSERT_EQ("", platform.GetJsEngine()->Evaluate("_appInfo.application").AsString());
+ ASSERT_EQ("", platform.GetJsEngine()->Evaluate("_appInfo.applicationVersion").AsString());
+ ASSERT_EQ("", platform.GetJsEngine()->Evaluate("_appInfo.locale").AsString());
+ ASSERT_FALSE(platform.GetJsEngine()->Evaluate("_appInfo.developmentBuild").AsBool());
}

Powered by Google App Engine
This is Rietveld