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

Unified Diff: test/ConsoleJsObject.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.
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
« no previous file with comments | « test/BaseJsTest.h ('k') | test/FileSystemJsObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/ConsoleJsObject.cpp
diff --git a/test/ConsoleJsObject.cpp b/test/ConsoleJsObject.cpp
index cd54c4c78d1ab27037b994da85270bfcb76ca0d9..36753b7f613f227c963d97658c408ab0921a4259 100644
--- a/test/ConsoleJsObject.cpp
+++ b/test/ConsoleJsObject.cpp
@@ -37,26 +37,23 @@ namespace
}
};
- class ConsoleJsObjectTest : public ::testing::Test
+ class ConsoleJsObjectTest : public BaseJsTest
{
protected:
- std::unique_ptr<Platform> platform;
MockLogSystem* mockLogSystem;
- JsEnginePtr jsEngine;
void SetUp() override
{
ThrowingPlatformCreationParameters platformParams;
platformParams.logSystem.reset(mockLogSystem = new MockLogSystem());
platform.reset(new Platform(std::move(platformParams)));
- jsEngine = platform->GetJsEngine();
}
};
}
TEST_F(ConsoleJsObjectTest, ConsoleLogCall)
{
- jsEngine->Evaluate("\n\nconsole.log('foo', 'bar');\n\n", "eval");
+ GetJsEngine().Evaluate("\n\nconsole.log('foo', 'bar');\n\n", "eval");
ASSERT_EQ(AdblockPlus::LogSystem::LOG_LEVEL_LOG, mockLogSystem->lastLogLevel);
ASSERT_EQ("foo bar", mockLogSystem->lastMessage);
ASSERT_EQ("eval:3", mockLogSystem->lastSource);
@@ -64,7 +61,7 @@ TEST_F(ConsoleJsObjectTest, ConsoleLogCall)
TEST_F(ConsoleJsObjectTest, ConsoleDebugCall)
{
- jsEngine->Evaluate("console.debug('foo', 'bar')");
+ GetJsEngine().Evaluate("console.debug('foo', 'bar')");
ASSERT_EQ(AdblockPlus::LogSystem::LOG_LEVEL_LOG, mockLogSystem->lastLogLevel);
ASSERT_EQ("foo bar", mockLogSystem->lastMessage);
ASSERT_EQ(":1", mockLogSystem->lastSource);
@@ -72,7 +69,7 @@ TEST_F(ConsoleJsObjectTest, ConsoleDebugCall)
TEST_F(ConsoleJsObjectTest, ConsoleInfoCall)
{
- jsEngine->Evaluate("console.info('foo', 'bar')");
+ GetJsEngine().Evaluate("console.info('foo', 'bar')");
ASSERT_EQ(AdblockPlus::LogSystem::LOG_LEVEL_INFO, mockLogSystem->lastLogLevel);
ASSERT_EQ("foo bar", mockLogSystem->lastMessage);
ASSERT_EQ(":1", mockLogSystem->lastSource);
@@ -80,7 +77,7 @@ TEST_F(ConsoleJsObjectTest, ConsoleInfoCall)
TEST_F(ConsoleJsObjectTest, ConsoleWarnCall)
{
- jsEngine->Evaluate("console.warn('foo', 'bar')");
+ GetJsEngine().Evaluate("console.warn('foo', 'bar')");
ASSERT_EQ(AdblockPlus::LogSystem::LOG_LEVEL_WARN, mockLogSystem->lastLogLevel);
ASSERT_EQ("foo bar", mockLogSystem->lastMessage);
ASSERT_EQ(":1", mockLogSystem->lastSource);
@@ -88,7 +85,7 @@ TEST_F(ConsoleJsObjectTest, ConsoleWarnCall)
TEST_F(ConsoleJsObjectTest, ConsoleErrorCall)
{
- jsEngine->Evaluate("console.error('foo', 'bar')");
+ GetJsEngine().Evaluate("console.error('foo', 'bar')");
ASSERT_EQ(AdblockPlus::LogSystem::LOG_LEVEL_ERROR, mockLogSystem->lastLogLevel);
ASSERT_EQ("foo bar", mockLogSystem->lastMessage);
ASSERT_EQ(":1", mockLogSystem->lastSource);
@@ -96,7 +93,7 @@ TEST_F(ConsoleJsObjectTest, ConsoleErrorCall)
TEST_F(ConsoleJsObjectTest, ConsoleTraceCall)
{
- jsEngine->Evaluate("\n\
+ GetJsEngine().Evaluate("\n\
function foo()\n\
{\n\
(function() {\n\
« no previous file with comments | « test/BaseJsTest.h ('k') | test/FileSystemJsObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld