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

Side by Side Diff: test/AppInfoJsObject.cpp

Issue 29417624: Issue 5034 - Part 4: JsEngine::Evaluate() return a JsValue (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Rebased again Created April 20, 2017, 1:02 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/Notification.cpp ('k') | test/FileSystemJsObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 10 matching lines...) Expand all
21 TEST(AppInfoJsObjectTest, AllProperties) 21 TEST(AppInfoJsObjectTest, AllProperties)
22 { 22 {
23 AdblockPlus::AppInfo appInfo; 23 AdblockPlus::AppInfo appInfo;
24 appInfo.version = "1"; 24 appInfo.version = "1";
25 appInfo.name = "3"; 25 appInfo.name = "3";
26 appInfo.application = "4"; 26 appInfo.application = "4";
27 appInfo.applicationVersion = "5"; 27 appInfo.applicationVersion = "5";
28 appInfo.locale = "2"; 28 appInfo.locale = "2";
29 appInfo.developmentBuild = true; 29 appInfo.developmentBuild = true;
30 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New(appInfo)); 30 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New(appInfo));
31 ASSERT_EQ("1", jsEngine->Evaluate("_appInfo.version")->AsString()); 31 ASSERT_EQ("1", jsEngine->Evaluate("_appInfo.version").AsString());
32 ASSERT_EQ("3", jsEngine->Evaluate("_appInfo.name")->AsString()); 32 ASSERT_EQ("3", jsEngine->Evaluate("_appInfo.name").AsString());
33 ASSERT_EQ("4", jsEngine->Evaluate("_appInfo.application")->AsString()); 33 ASSERT_EQ("4", jsEngine->Evaluate("_appInfo.application").AsString());
34 ASSERT_EQ("5", jsEngine->Evaluate("_appInfo.applicationVersion")->AsString()); 34 ASSERT_EQ("5", jsEngine->Evaluate("_appInfo.applicationVersion").AsString());
35 ASSERT_EQ("2", jsEngine->Evaluate("_appInfo.locale")->AsString()); 35 ASSERT_EQ("2", jsEngine->Evaluate("_appInfo.locale").AsString());
36 ASSERT_TRUE(jsEngine->Evaluate("_appInfo.developmentBuild")->AsBool()); 36 ASSERT_TRUE(jsEngine->Evaluate("_appInfo.developmentBuild").AsBool());
37 } 37 }
38 38
39 TEST(AppInfoJsObjectTest, DefaultPropertyValues) 39 TEST(AppInfoJsObjectTest, DefaultPropertyValues)
40 { 40 {
41 AdblockPlus::AppInfo appInfo; 41 AdblockPlus::AppInfo appInfo;
42 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New(appInfo)); 42 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New(appInfo));
43 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.version")->AsString()); 43 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.version").AsString());
44 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.name")->AsString()); 44 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.name").AsString());
45 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.application")->AsString()); 45 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.application").AsString());
46 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.applicationVersion")->AsString()); 46 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.applicationVersion").AsString());
47 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.locale")->AsString()); 47 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.locale").AsString());
48 ASSERT_FALSE(jsEngine->Evaluate("_appInfo.developmentBuild")->AsBool()); 48 ASSERT_FALSE(jsEngine->Evaluate("_appInfo.developmentBuild").AsBool());
49 } 49 }
OLDNEW
« no previous file with comments | « src/Notification.cpp ('k') | test/FileSystemJsObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld