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

Delta Between Two Patch Sets: test/AppInfoJsObject.cpp

Issue 29371607: Issue #3593 - Make isolate a fully internal member of the engine
Left Patch Set: Created Jan. 12, 2017, 2:46 p.m.
Right Patch Set: improve unit tests to go with isolate change Created Jan. 16, 2017, 3:53 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/JsEngineInternal.h ('k') | test/BaseJsTest.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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.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 auto 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 ASSERT_EQ(1, jsEngine.use_count());
38 jsEngine.reset();
37 } 39 }
38 40
39 TEST(AppInfoJsObjectTest, DefaultPropertyValues) 41 TEST(AppInfoJsObjectTest, DefaultPropertyValues)
40 { 42 {
41 AdblockPlus::AppInfo appInfo; 43 AdblockPlus::AppInfo appInfo;
42 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New(appInfo)); 44 auto jsEngine = AdblockPlus::JsEngine::New(appInfo);
43 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.version")->AsString()); 45 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.version")->AsString());
44 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.name")->AsString()); 46 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.name")->AsString());
45 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.application")->AsString()); 47 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.application")->AsString());
46 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.applicationVersion")->AsString()); 48 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.applicationVersion")->AsString());
47 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.locale")->AsString()); 49 ASSERT_EQ("", jsEngine->Evaluate("_appInfo.locale")->AsString());
48 ASSERT_FALSE(jsEngine->Evaluate("_appInfo.developmentBuild")->AsBool()); 50 ASSERT_FALSE(jsEngine->Evaluate("_appInfo.developmentBuild")->AsBool());
51 ASSERT_EQ(1, jsEngine.use_count());
52 jsEngine.reset();
49 } 53 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld