PM: Shift to signal-based inference of network connection.
Instead of making DBus calls to shill on-demand, and estimating the time
a connection has changed, the RealShillProvider now listens to the
appropriate DBus signal and update its internal state accordingly. Note
that checking for the connection type still requires a DBus call, if the
connection has changed since its type was last checked.
In order to pass all unit tests (including those of PolicyManager and
RealState), there's a substantial portion of DBus mock set up code that
was added. This code will be removed very soon, once we begin injecting
providers into RealState, instead of low-level DBus and/or clock
interfaces.
BUG=chromium:338585
TEST=Unit tests.
Change-Id: Ia7a2f9db18f905f1b7a2cc1234acb31eaa60009e
Reviewed-on: https://chromium-review.googlesource.com/189692
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
diff --git a/mock_dbus_wrapper.h b/mock_dbus_wrapper.h
index 9fc9a8f..569e289 100644
--- a/mock_dbus_wrapper.h
+++ b/mock_dbus_wrapper.h
@@ -33,6 +33,22 @@
const char* in2,
const char* in3));
+ MOCK_METHOD4(ProxyAddSignal_2, void(DBusGProxy* proxy,
+ const char* signal_name,
+ GType type1,
+ GType type2));
+
+ MOCK_METHOD5(ProxyConnectSignal, void(DBusGProxy* proxy,
+ const char* signal_name,
+ GCallback handler,
+ void* data,
+ GClosureNotify free_data_func));
+
+ MOCK_METHOD4(ProxyDisconnectSignal, void(DBusGProxy* proxy,
+ const char* signal_name,
+ GCallback handler,
+ void* data));
+
MOCK_METHOD1(ConnectionGetConnection, DBusConnection*(DBusGConnection* gbus));
MOCK_METHOD3(DBusBusAddMatch, void(DBusConnection* connection,