[shill] Add getting/setting for ipconfig properties
BUG=chromium-os:17261
TEST=unit tests
Change-Id: I96aed7c979c7913c568d00ce408a662898969d76
Reviewed-on: http://gerrit.chromium.org/gerrit/3583
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
diff --git a/dhcp_config_unittest.cc b/dhcp_config_unittest.cc
index 44d638d..4d736f6 100644
--- a/dhcp_config_unittest.cc
+++ b/dhcp_config_unittest.cc
@@ -5,11 +5,14 @@
#include <base/file_util.h>
#include <base/memory/scoped_temp_dir.h>
#include <base/stringprintf.h>
+#include <chromeos/dbus/service_constants.h>
+#include "shill/dbus_adaptor.h"
#include "shill/dhcp_config.h"
#include "shill/dhcp_provider.h"
#include "shill/mock_dhcp_proxy.h"
#include "shill/mock_glib.h"
+#include "shill/property_store_unittest.h"
using std::string;
using std::vector;
@@ -24,7 +27,7 @@
const char kDeviceName[] = "testdevicename";
} // namespace {}
-class DHCPConfigTest : public Test {
+class DHCPConfigTest : public PropertyStoreTest {
public:
DHCPConfigTest()
: proxy_(new MockDHCPProxy()),
@@ -282,4 +285,18 @@
EXPECT_CALL(glib_, SpawnClosePID(kPID)).Times(1); // Invoked by destuctor.
}
+TEST_F(DHCPConfigTest, Dispatch) {
+ EXPECT_TRUE(DBusAdaptor::DispatchOnType(config_.get(),
+ flimflam::kMtuProperty,
+ PropertyStoreTest::kInt32V,
+ NULL));
+ ::DBus::Error error;
+ // Ensure that an attempt to write a R/O property returns InvalidArgs error.
+ EXPECT_FALSE(DBusAdaptor::DispatchOnType(config_.get(),
+ flimflam::kAddressProperty,
+ PropertyStoreTest::kStringV,
+ &error));
+ EXPECT_EQ(invalid_args_, error.name());
+}
+
} // namespace shill