Skip invalid DefaultService object path values.

If shill sends an invalid DefaultService object path value, we need to
explicitly treat since otherwise the DBus library will abort the
program when trying to send a message to the invalid object path.

Bug: chromium:526446
Change-Id: Id91787916b62cd94dab38532b98be0f0a8b6d4c4
Test: Added unittests
diff --git a/connection_manager.cc b/connection_manager.cc
index 99dbcb1..58e2292 100644
--- a/connection_manager.cc
+++ b/connection_manager.cc
@@ -164,16 +164,16 @@
 bool ConnectionManager::GetConnectionProperties(
     NetworkConnectionType* out_type,
     NetworkTethering* out_tethering) {
-  string default_service_path;
+  dbus::ObjectPath default_service_path;
   TEST_AND_RETURN_FALSE(GetDefaultServicePath(&default_service_path));
-  if (default_service_path.empty())
+  if (!default_service_path.IsValid())
     return false;
   TEST_AND_RETURN_FALSE(
       GetServicePathProperties(default_service_path, out_type, out_tethering));
   return true;
 }
 
-bool ConnectionManager::GetDefaultServicePath(string* out_path) {
+bool ConnectionManager::GetDefaultServicePath(dbus::ObjectPath* out_path) {
   chromeos::VariantDictionary properties;
   chromeos::ErrorPtr error;
   ManagerProxyInterface* manager_proxy = shill_proxy_->GetManagerProxy();
@@ -186,12 +186,12 @@
   if (prop_default_service == properties.end())
     return false;
 
-  *out_path = prop_default_service->second.TryGet<dbus::ObjectPath>().value();
-  return !out_path->empty();
+  *out_path = prop_default_service->second.TryGet<dbus::ObjectPath>();
+  return out_path->IsValid();
 }
 
 bool ConnectionManager::GetServicePathProperties(
-    const string& path,
+    const dbus::ObjectPath& path,
     NetworkConnectionType* out_type,
     NetworkTethering* out_tethering) {
   // We create and dispose the ServiceProxyInterface on every request.
@@ -227,8 +227,8 @@
         properties.find(shill::kPhysicalTechnologyProperty);
     if (prop_physical == properties.end()) {
       LOG(ERROR) << "No PhysicalTechnology property found for a VPN"
-                 << " connection (service: " << path << "). Returning default"
-                 << " kUnknown value.";
+                    " connection (service: "
+                 << path.value() << "). Returning default kUnknown value.";
       *out_type = NetworkConnectionType::kUnknown;
     } else {
       *out_type = ParseConnectionType(prop_physical->second.TryGet<string>());