OLD | NEW |
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 12 matching lines...) Expand all Loading... |
23 { | 23 { |
24 AdblockPlus::AppInfo appInfo; | 24 AdblockPlus::AppInfo appInfo; |
25 appInfo.version = "1"; | 25 appInfo.version = "1"; |
26 appInfo.name = "3"; | 26 appInfo.name = "3"; |
27 appInfo.application = "4"; | 27 appInfo.application = "4"; |
28 appInfo.applicationVersion = "5"; | 28 appInfo.applicationVersion = "5"; |
29 appInfo.locale = "2"; | 29 appInfo.locale = "2"; |
30 appInfo.developmentBuild = true; | 30 appInfo.developmentBuild = true; |
31 AdblockPlus::Platform platform{ThrowingPlatformCreationParameters()}; | 31 AdblockPlus::Platform platform{ThrowingPlatformCreationParameters()}; |
32 platform.SetUpJsEngine(appInfo); | 32 platform.SetUpJsEngine(appInfo); |
33 ASSERT_EQ("1", platform.GetJsEngine()->Evaluate("_appInfo.version").AsString()
); | 33 ASSERT_EQ("1", platform.GetJsEngine().Evaluate("_appInfo.version").AsString())
; |
34 ASSERT_EQ("3", platform.GetJsEngine()->Evaluate("_appInfo.name").AsString()); | 34 ASSERT_EQ("3", platform.GetJsEngine().Evaluate("_appInfo.name").AsString()); |
35 ASSERT_EQ("4", platform.GetJsEngine()->Evaluate("_appInfo.application").AsStri
ng()); | 35 ASSERT_EQ("4", platform.GetJsEngine().Evaluate("_appInfo.application").AsStrin
g()); |
36 ASSERT_EQ("5", platform.GetJsEngine()->Evaluate("_appInfo.applicationVersion")
.AsString()); | 36 ASSERT_EQ("5", platform.GetJsEngine().Evaluate("_appInfo.applicationVersion").
AsString()); |
37 ASSERT_EQ("2", platform.GetJsEngine()->Evaluate("_appInfo.locale").AsString())
; | 37 ASSERT_EQ("2", platform.GetJsEngine().Evaluate("_appInfo.locale").AsString()); |
38 ASSERT_TRUE(platform.GetJsEngine()->Evaluate("_appInfo.developmentBuild").AsBo
ol()); | 38 ASSERT_TRUE(platform.GetJsEngine().Evaluate("_appInfo.developmentBuild").AsBoo
l()); |
39 } | 39 } |
40 | 40 |
41 TEST(AppInfoJsObjectTest, DefaultPropertyValues) | 41 TEST(AppInfoJsObjectTest, DefaultPropertyValues) |
42 { | 42 { |
43 AdblockPlus::Platform platform{ThrowingPlatformCreationParameters()}; | 43 AdblockPlus::Platform platform{ThrowingPlatformCreationParameters()}; |
44 platform.SetUpJsEngine(); | 44 ASSERT_EQ("", platform.GetJsEngine().Evaluate("_appInfo.version").AsString()); |
45 ASSERT_EQ("", platform.GetJsEngine()->Evaluate("_appInfo.version").AsString())
; | 45 ASSERT_EQ("", platform.GetJsEngine().Evaluate("_appInfo.name").AsString()); |
46 ASSERT_EQ("", platform.GetJsEngine()->Evaluate("_appInfo.name").AsString()); | 46 ASSERT_EQ("", platform.GetJsEngine().Evaluate("_appInfo.application").AsString
()); |
47 ASSERT_EQ("", platform.GetJsEngine()->Evaluate("_appInfo.application").AsStrin
g()); | 47 ASSERT_EQ("", platform.GetJsEngine().Evaluate("_appInfo.applicationVersion").A
sString()); |
48 ASSERT_EQ("", platform.GetJsEngine()->Evaluate("_appInfo.applicationVersion").
AsString()); | 48 ASSERT_EQ("", platform.GetJsEngine().Evaluate("_appInfo.locale").AsString()); |
49 ASSERT_EQ("", platform.GetJsEngine()->Evaluate("_appInfo.locale").AsString()); | 49 ASSERT_FALSE(platform.GetJsEngine().Evaluate("_appInfo.developmentBuild").AsBo
ol()); |
50 ASSERT_FALSE(platform.GetJsEngine()->Evaluate("_appInfo.developmentBuild").AsB
ool()); | |
51 } | 50 } |
OLD | NEW |