shill: Pass a parameter to dhcp client to request a hostname

This will enable dynamic DNS, or at the very least allow DHCP
requests to be identified and distinguished at the server side.

BUG=chromium-os:23741
TEST=New unit tests monitor hostname arg passed to dhcpcd,
and to assure values are being loaded/saved.  Also double
checked on real system by doing a dbus-send to set manager.HostName
and checked that the name was persisted, and that the next
DHCP server we connected to stored this hostname.
CQ-DEPEND=Ic807a2235e0cdcb32a08f9c2c760a86c3579431c

Change-Id: Ic127b65d8563b15e55549a0f029385d0632eaf6c
Reviewed-on: https://gerrit.chromium.org/gerrit/14045
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
diff --git a/default_profile_unittest.cc b/default_profile_unittest.cc
index e6a0c59..695e092 100644
--- a/default_profile_unittest.cc
+++ b/default_profile_unittest.cc
@@ -104,13 +104,17 @@
                                         DefaultProfile::kDefaultId))
       .WillOnce(Return(true));
   EXPECT_CALL(*storage.get(), SetString(DefaultProfile::kStorageId,
-                                        DefaultProfile::kStorageCheckPortalList,
+                                        DefaultProfile::kStorageHostName,
                                         ""))
       .WillOnce(Return(true));
   EXPECT_CALL(*storage.get(), SetBool(DefaultProfile::kStorageId,
                                       DefaultProfile::kStorageOfflineMode,
                                       false))
       .WillOnce(Return(true));
+  EXPECT_CALL(*storage.get(), SetString(DefaultProfile::kStorageId,
+                                        DefaultProfile::kStorageCheckPortalList,
+                                        ""))
+      .WillOnce(Return(true));
   EXPECT_CALL(*storage.get(), Flush()).WillOnce(Return(true));
 
   EXPECT_CALL(*device_.get(), Save(storage.get())).WillOnce(Return(true));
@@ -123,6 +127,11 @@
 
 TEST_F(DefaultProfileTest, LoadManagerProperties) {
   scoped_ptr<MockStore> storage(new MockStore);
+  const string host_name("hostname");
+  EXPECT_CALL(*storage.get(), GetString(DefaultProfile::kStorageId,
+                                        DefaultProfile::kStorageHostName,
+                                        _))
+      .WillOnce(DoAll(SetArgumentPointee<2>(host_name), Return(true)));
   EXPECT_CALL(*storage.get(), GetBool(DefaultProfile::kStorageId,
                                       DefaultProfile::kStorageOfflineMode,
                                       _))
@@ -136,6 +145,7 @@
 
   Manager::Properties manager_props;
   ASSERT_TRUE(profile_->LoadManagerProperties(&manager_props));
+  EXPECT_EQ(host_name, manager_props.host_name);
   EXPECT_TRUE(manager_props.offline_mode);
   EXPECT_EQ(portal_list, manager_props.check_portal_list);
 }