| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 #include <AdblockPlus.h> | 18 #include <AdblockPlus.h> |
| 19 #include <gtest/gtest.h> | 19 #include <gtest/gtest.h> |
| 20 | 20 |
| 21 TEST(AppInfoJsObjectTest, AllProperties) | 21 TEST(AppInfoJsObjectTest, AllProperties) |
| 22 { | 22 { |
| 23 AdblockPlus::AppInfo appInfo; | 23 AdblockPlus::AppInfo appInfo; |
| 24 appInfo.id = "1"; | 24 appInfo.id = "1"; |
| 25 appInfo.version = "2"; | 25 appInfo.version = "2"; |
| 26 appInfo.name = "4"; | 26 appInfo.name = "4"; |
| 27 appInfo.platform = "5"; | 27 appInfo.platform = "5"; |
| 28 appInfo.locale = "3"; | 28 appInfo.locale = "3"; |
| 29 appInfo.developmentBuild = true; |
| 29 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New(appInfo)); | 30 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New(appInfo)); |
| 30 ASSERT_EQ("1", jsEngine->Evaluate("_appInfo.id")->AsString()); | 31 ASSERT_EQ("1", jsEngine->Evaluate("_appInfo.id")->AsString()); |
| 31 ASSERT_EQ("2", jsEngine->Evaluate("_appInfo.version")->AsString()); | 32 ASSERT_EQ("2", jsEngine->Evaluate("_appInfo.version")->AsString()); |
| 32 ASSERT_EQ("4", jsEngine->Evaluate("_appInfo.name")->AsString()); | 33 ASSERT_EQ("4", jsEngine->Evaluate("_appInfo.name")->AsString()); |
| 33 ASSERT_EQ("5", jsEngine->Evaluate("_appInfo.platform")->AsString()); | 34 ASSERT_EQ("5", jsEngine->Evaluate("_appInfo.platform")->AsString()); |
| 34 ASSERT_EQ("3", jsEngine->Evaluate("_appInfo.locale")->AsString()); | 35 ASSERT_EQ("3", jsEngine->Evaluate("_appInfo.locale")->AsString()); |
| 36 ASSERT_TRUE(jsEngine->Evaluate("_appInfo.developmentBuild")->AsBool()); |
| 35 } | 37 } |
| 38 |
| 39 TEST(AppInfoJsObjectTest, DefaultPropertyValues) |
| 40 { |
| 41 AdblockPlus::AppInfo appInfo; |
| 42 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New(appInfo)); |
| 43 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.id")->AsString()); |
| 44 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.version")->AsString()); |
| 45 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.name")->AsString()); |
| 46 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.platform")->AsString()); |
| 47 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.locale")->AsString()); |
| 48 ASSERT_FALSE(jsEngine->Evaluate("_appInfo.developmentBuild")->AsBool()); |
| 49 } |
| OLD | NEW |