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

Unified Diff: test/Notification.cpp

Issue 29371607: Issue #3593 - Make isolate a fully internal member of the engine
Patch Set: improve unit tests to go with isolate change Created Jan. 16, 2017, 3: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
« no previous file with comments | « test/JsEngine.cpp ('k') | test/Prefs.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « test/JsEngine.cpp ('k') | test/Prefs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld