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/dbus_wrapper_interface.h b/dbus_wrapper_interface.h
index 0978c3b..9341174 100644
--- a/dbus_wrapper_interface.h
+++ b/dbus_wrapper_interface.h
@@ -53,6 +53,23 @@
                                  const char* in2,
                                  const char* in3) = 0;
 
+  // Wrappers for dbus_g_proxy_add_signal() (variadic).
+  virtual void ProxyAddSignal_2(DBusGProxy* proxy,
+                                const char* signal_name,
+                                GType type1,
+                                GType type2) = 0;
+
+  // Wrapper for dbus_g_proxy_{connect,disconnect}_signal().
+  virtual void ProxyConnectSignal(DBusGProxy* proxy,
+                                  const char* signal_name,
+                                  GCallback handler,
+                                  void* data,
+                                  GClosureNotify free_data_func) = 0;
+  virtual void ProxyDisconnectSignal(DBusGProxy* proxy,
+                                     const char* signal_name,
+                                     GCallback handler,
+                                     void* data) = 0;
+
   // Wraps dbus_g_connection_get_connection().
   virtual DBusConnection* ConnectionGetConnection(DBusGConnection* gbus) = 0;