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

Side by Side Diff: test/AppInfoJsObject.cpp

Issue 29508569: Issue 5450 - don't expose std::shared_ptr<JsEngine> (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created Aug. 7, 2017, 8:39 a.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/Platform.cpp ('k') | test/BaseJsTest.h » ('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 12 matching lines...) Expand all
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 }
OLDNEW
« no previous file with comments | « src/Platform.cpp ('k') | test/BaseJsTest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld