summaryrefslogtreecommitdiff
path: root/key_value_store_unittest.cc
diff options
context:
space:
mode:
authorPaul Stewart <pstew@chromium.org>2012-08-02 20:12:09 -0700
committerGerrit <chrome-bot@google.com>2012-08-08 16:49:55 -0700
commitdef189ec3772bdc440b1c45c2b673122d3e2789e (patch)
treed87e5cc3d11b02797bf1f26e46881ae359da6f0e /key_value_store_unittest.cc
parent5781aa4dce2b9e9f68bf4fd4183a0a61a21b366f (diff)
downloadshill-def189ec3772bdc440b1c45c2b673122d3e2789e.tar.gz
shill: Static IP: Save DHCP-supplied IP parameters
Before Static IP parameters are applied to an IPConfig, save all DHCP-supplied parameters to corresponding "SavedIP.*" values in the service. This way the UI can display: * The current IP address confgured on the interface by showing the IPConfig value. * The current user-supplied static IP parameter by showing the "StaticIP.*" parameter. * The DHCP-supplied IP parameter by first checking for a "SavedIP.*" parameter, failing that, using the IPConfig parameter. BUG=chromium-os:33223 TEST=New unit test + manual (set StaticIP.Address parameter, reconnect, and confirm that both SavedIP.Address and StaticIP.Address parameters are set on the service) Change-Id: I6410b003bbdc63097a193cfb09881c862dcef5bd Reviewed-on: https://gerrit.chromium.org/gerrit/29130 Commit-Ready: Paul Stewart <pstew@chromium.org> Reviewed-by: Paul Stewart <pstew@chromium.org> Tested-by: Paul Stewart <pstew@chromium.org>
Diffstat (limited to 'key_value_store_unittest.cc')
-rw-r--r--key_value_store_unittest.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/key_value_store_unittest.cc b/key_value_store_unittest.cc
index e11cff81..3bcde8bb 100644
--- a/key_value_store_unittest.cc
+++ b/key_value_store_unittest.cc
@@ -59,7 +59,7 @@ TEST_F(KeyValueStoreTest, String) {
TEST_F(KeyValueStoreTest, Uint) {
const string kKey("foo");
- const int32 kValue = 456;
+ const uint32 kValue = 456;
EXPECT_FALSE(store_.ContainsUint(kKey));
store_.SetUint(kKey, kValue);
EXPECT_TRUE(store_.ContainsUint(kKey));
@@ -76,4 +76,29 @@ TEST_F(KeyValueStoreTest, DoubleRemove) {
store_.RemoveString(kKey);
}
+TEST_F(KeyValueStoreTest, Clear) {
+ const string kBoolKey("foo");
+ const bool kBoolValue = true;
+ store_.SetBool(kBoolKey, kBoolValue);
+ const string kIntKey("bar");
+ const int kIntValue = 123;
+ store_.SetInt(kIntKey, kIntValue);
+ const string kStringKey("baz");
+ const string kStringValue("string");
+ store_.SetString(kStringKey, kStringValue);
+ const string kUintKey("bun");
+ const uint32 kUintValue = 456;
+ store_.SetUint(kUintKey, kUintValue);
+
+ EXPECT_TRUE(store_.ContainsBool(kBoolKey));
+ EXPECT_TRUE(store_.ContainsInt(kIntKey));
+ EXPECT_TRUE(store_.ContainsString(kStringKey));
+ EXPECT_TRUE(store_.ContainsUint(kUintKey));
+ store_.Clear();
+ EXPECT_FALSE(store_.ContainsBool(kBoolKey));
+ EXPECT_FALSE(store_.ContainsInt(kIntKey));
+ EXPECT_FALSE(store_.ContainsString(kStringKey));
+ EXPECT_FALSE(store_.ContainsUint(kUintKey));
+}
+
} // namespace shill