summaryrefslogtreecommitdiffstats
path: root/test/timertest.cpp
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2017-05-11 10:07:55 -0500
committerPatrick Williams <patrick@stwcx.xyz>2017-05-11 19:58:23 +0000
commite824f985e7e32923d9f76e3ad5baf4909880739f (patch)
tree8a89c8fc65f2611101d04ae9c550d4beb707d69d /test/timertest.cpp
parent14321846e57f483f472590b1c5fe35891511312f (diff)
downloadphosphor-fan-presence-e824f985e7e32923d9f76e3ad5baf4909880739f.tar.gz
phosphor-fan-presence-e824f985e7e32923d9f76e3ad5baf4909880739f.zip
Use unique_ptr for sd_event object wrapper
Convert the sd_event object wrapper from a shared_ptr to a unique_ptr. Requires a new header file. Change-Id: I868a9e88ed93878c2e0bb12e58f8d3a604510da0 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Diffstat (limited to 'test/timertest.cpp')
-rw-r--r--test/timertest.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/test/timertest.cpp b/test/timertest.cpp
index 40b2ddf..9d05e55 100644
--- a/test/timertest.cpp
+++ b/test/timertest.cpp
@@ -16,6 +16,7 @@
#include <iostream>
#include <chrono>
#include <gtest/gtest.h>
+#include "event.hpp"
#include "timer.hpp"
/**
@@ -25,12 +26,6 @@
using namespace phosphor::fan::util;
using namespace std::chrono;
-void EventDeleter(sd_event* events)
-{
- sd_event_unref(events);
-}
-
-using EventPtr = std::shared_ptr<sd_event>;
/**
* Class to ensure sd_events are correctly
@@ -40,7 +35,7 @@ class TimerTest : public ::testing::Test
{
public:
// systemd event handler
- EventPtr events;
+ phosphor::fan::event::EventPtr events;
// Need this so that events can be initialized.
int rc;
@@ -52,7 +47,7 @@ class TimerTest : public ::testing::Test
auto rc = sd_event_default(&event);
EXPECT_GE(rc, 0);
- events.reset(event, EventDeleter);
+ events.reset(event);
}
};
@@ -96,7 +91,7 @@ class CallbackTester
class CallbackTesterWithTimer : public CallbackTester
{
public:
- CallbackTesterWithTimer(EventPtr events) :
+ CallbackTesterWithTimer(phosphor::fan::event::EventPtr& events) :
_timer(events,
std::bind(&CallbackTesterWithTimer::callbackFunction,
this))
OpenPOWER on IntegriCloud