Fixing Linux syntax errors and tests for Events 2.0

This commit is contained in:
Teddy Reed 2014-12-15 16:47:09 -08:00
parent 6de14466db
commit dd2eaf248a
5 changed files with 11 additions and 11 deletions

View File

@ -97,7 +97,7 @@ Status INotifyEventPublisher::run() {
// A file was moved to replace the watched path.
removeMonitor(event->wd, false);
} else {
auto ec = createEventContext(event);
auto ec = createEventContextFrom(event);
fire(ec);
}
// Continue to iterate
@ -108,7 +108,7 @@ Status INotifyEventPublisher::run() {
return Status(0, "Continue");
}
INotifyEventContextRef INotifyEventPublisher::createEventContext(
INotifyEventContextRef INotifyEventPublisher::createEventContextFrom(
struct inotify_event* event) {
auto shared_event = std::make_shared<struct inotify_event>(*event);
auto ec = createEventContext();

View File

@ -104,7 +104,7 @@ class INotifyEventPublisher
bool isHandleOpen() { return inotify_handle_ > 0; }
private:
INotifyEventContextRef createEventContext(struct inotify_event* event);
INotifyEventContextRef createEventContextFrom(struct inotify_event* event);
/// Check all added Subscription%s for a path.
bool isPathMonitored(const std::string& path);
/// Add an INotify watch (monitor) on this path.

View File

@ -196,7 +196,7 @@ class TestINotifyEventSubscriber
void WaitForEvents(int max, int num_events = 1) {
int delay = 0;
while (delay < max * 1000) {
if (getInstance()->callback_count_ >= num_events) {
if (callback_count_ >= num_events) {
return;
}
::usleep(50);
@ -206,7 +206,7 @@ class TestINotifyEventSubscriber
std::vector<std::string> actions() { return actions_; }
int count() { return getInstance()->callback_count_; }
int count() { return callback_count_; }
public:
int callback_count_;
@ -221,10 +221,9 @@ TEST_F(INotifyTests, test_inotify_fire_event) {
// Create a subscriptioning context, note the added Event to the symbol
auto sc = sub->GetSubscription(kRealTestPath, 0);
sc->subscribe(&TestINotifyEventSubscriber::SimpleCallback, sc);
sub->subscribe(&TestINotifyEventSubscriber::SimpleCallback, sc);
TriggerEvent(kRealTestPath);
sub->WaitForEvents(kMaxEventLatency);
// Make sure our expected event fired (aka subscription callback was called).
@ -241,8 +240,9 @@ TEST_F(INotifyTests, test_inotify_event_action) {
sub->init();
auto sc = sub->GetSubscription(kRealTestPath, 0);
sc->subscribe(&TestINotifyEventSubscriber::Callback, sc);
sub->subscribe(&TestINotifyEventSubscriber::Callback, sc);
TriggerEvent(kRealTestPath);
sub->WaitForEvents(kMaxEventLatency, 4);
// Make sure the inotify action was expected.

View File

@ -59,7 +59,7 @@ Status UdevEventPublisher::run() {
return Status(1, "udev monitor failed.");
}
auto ec = createEventContext(device);
auto ec = createEventContextFrom(device);
fire(ec);
udev_device_unref(device);
@ -86,7 +86,7 @@ std::string UdevEventPublisher::getAttr(struct udev_device* device,
return "";
}
UdevEventContextRef UdevEventPublisher::createEventContext(
UdevEventContextRef UdevEventPublisher::createEventContextFrom(
struct udev_device* device) {
auto ec = createEventContext();
ec->device = device;

View File

@ -107,6 +107,6 @@ class UdevEventPublisher
bool shouldFire(const UdevSubscriptionContextRef& mc,
const UdevEventContextRef& ec);
/// Helper function to create an EventContext using a udev_device pointer.
UdevEventContextRef createEventContext(struct udev_device* device);
UdevEventContextRef createEventContextFrom(struct udev_device* device);
};
}