Index: test/Notification.cpp |
=================================================================== |
--- a/test/Notification.cpp |
+++ b/test/Notification.cpp |
@@ -34,10 +34,16 @@ |
void SetUp() |
{ |
BaseJsTest::SetUp(); |
- jsEngine->SetFileSystem(FileSystemPtr(new LazyFileSystem())); |
- jsEngine->SetWebRequest(WebRequestPtr(new LazyWebRequest())); |
- jsEngine->SetLogSystem(LogSystemPtr(new DefaultLogSystem())); |
- filterEngine.reset(new FilterEngine(jsEngine)); |
+ jsEngine->SetFileSystem(std::make_shared<LazyFileSystem>()); |
+ jsEngine->SetWebRequest(std::make_shared<LazyWebRequest>()); |
+ jsEngine->SetLogSystem(std::make_shared<DefaultLogSystem>()); |
+ filterEngine = std::make_shared<FilterEngine>(jsEngine); |
+ } |
+ |
+ void TearDown() |
+ { |
+ filterEngine.reset(); |
+ BaseJsTest::TearDown(); |
} |
void AddNotification(const std::string& notification) |
@@ -99,8 +105,7 @@ |
{ |
BaseJsTest::SetUp(); |
isNotificationCallbackCalled = false; |
- jsEngine->SetFileSystem( |
- std::shared_ptr<LazyFileSystem>(new LazyFileSystem())); |
+ jsEngine->SetFileSystem(std::shared_ptr<LazyFileSystem>()); |
const char* responseJsonText = "{" |
"\"notifications\": [{" |
"\"id\": \"some id\"," |
@@ -111,15 +116,20 @@ |
"\"title\": \"Title\"" |
"}]" |
"}"; |
- jsEngine->SetWebRequest(std::shared_ptr<MockWebRequest>( |
- new MockWebRequest(responseJsonText))); |
- jsEngine->SetLogSystem(LogSystemPtr(new DefaultLogSystem())); |
- filterEngine.reset(new FilterEngine(jsEngine)); |
+ jsEngine->SetWebRequest(std::make_shared<MockWebRequest>(responseJsonText)); |
+ jsEngine->SetLogSystem(std::make_shared<DefaultLogSystem>()); |
+ filterEngine = std::make_shared<FilterEngine>(jsEngine); |
filterEngine->SetShowNotificationCallback( |
std::bind(&NotificationMockWebRequestTest::OnNotification, |
this, std::placeholders::_1)); |
} |
+ void TearDown() |
+ { |
+ filterEngine.reset(); |
+ BaseJsTest::TearDown(); |
+ } |
+ |
void OnNotification(const NotificationPtr& notification) |
{ |
isNotificationCallbackCalled = true; |