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 |
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 <stdexcept> | 18 #include <stdexcept> |
19 #include "BaseJsTest.h" | 19 #include "BaseJsTest.h" |
20 #include "../src/JsContext.h" | |
21 | 20 |
22 namespace | 21 namespace |
23 { | 22 { |
24 class JsEngineTest : public BaseJsTest | 23 class JsEngineTest : public BaseJsTest |
25 { | 24 { |
26 }; | 25 }; |
27 } | 26 } |
28 | 27 |
29 TEST_F(JsEngineTest, Evaluate) | 28 TEST_F(JsEngineTest, Evaluate) |
30 { | 29 { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 186 |
188 TEST(NewJsEngineTest, GlobalPropertyTest) | 187 TEST(NewJsEngineTest, GlobalPropertyTest) |
189 { | 188 { |
190 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New()); | 189 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New()); |
191 jsEngine->SetGlobalProperty("foo", jsEngine->NewValue("bar")); | 190 jsEngine->SetGlobalProperty("foo", jsEngine->NewValue("bar")); |
192 auto foo = jsEngine->Evaluate("foo"); | 191 auto foo = jsEngine->Evaluate("foo"); |
193 ASSERT_TRUE(foo.IsString()); | 192 ASSERT_TRUE(foo.IsString()); |
194 ASSERT_EQ(foo.AsString(), "bar"); | 193 ASSERT_EQ(foo.AsString(), "bar"); |
195 } | 194 } |
196 | 195 |
OLD | NEW |