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

Unified Diff: test/JsEngine.cpp

Issue 29500602: Issue 5450 - introduce the Platform class (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: rebase Created July 31, 2017, 12:53 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/JsEngine.cpp
diff --git a/test/JsEngine.cpp b/test/JsEngine.cpp
index 537b414ee4582361c54eb5b72bc810e2d4f365ce..affe5d53de0c5e2cae76d223d0fc74e94c9733ea 100644
--- a/test/JsEngine.cpp
+++ b/test/JsEngine.cpp
@@ -24,6 +24,13 @@ namespace
{
class JsEngineTest : public BaseJsTest
{
+ protected:
+ JsEnginePtr jsEngine;
+ void SetUp() override
+ {
+ BaseJsTest::SetUp();
+ jsEngine = platform->GetJsEngine();
+ }
};
}
@@ -164,7 +171,8 @@ TEST_F(JsEngineTest, EventCallbacks)
TEST(NewJsEngineTest, GlobalPropertyTest)
{
- AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New());
+ Platform platform{ThrowingPlatformCreationParameters()};
+ auto jsEngine = platform.GetJsEngine();
jsEngine->SetGlobalProperty("foo", jsEngine->NewValue("bar"));
auto foo = jsEngine->Evaluate("foo");
ASSERT_TRUE(foo.IsString());
@@ -175,7 +183,7 @@ TEST(NewJsEngineTest, MemoryLeak_NoCircularReferences)
{
std::weak_ptr<AdblockPlus::JsEngine> weakJsEngine;
{
- weakJsEngine = AdblockPlus::JsEngine::New();
+ weakJsEngine = Platform{ThrowingPlatformCreationParameters()}.GetJsEngine();
}
EXPECT_FALSE(weakJsEngine.lock());
}
@@ -194,6 +202,6 @@ TEST(NewJsEngineTest, DISABLED_32bitsOnly_MemoryLeak_NoLeak)
// makes sense.
for (int i = 0; i < 1000; ++i)
{
- AdblockPlus::JsEngine::New();
+ Platform{ThrowingPlatformCreationParameters()}.GetJsEngine();
}
}
« include/AdblockPlus/Platform.h ('K') | « test/GlobalJsObject.cpp ('k') | test/JsValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld