shill: Add Profile and Manager UpdateDevice support.
UpdateDevice persists Devices into profiles. It's similar to UpdateService,
however, only the topmost DefaultProfile handles UpdateDevice. Use UpdateDevice
to persist Device's Enabled and Cellular's AllowRoaming properties. Remove now
unused Manager::SaveActiveProfile method to avoid confusion.
BUG=chrome-os-partner:10178,chromium-os:32230
TEST=unit tests
Change-Id: I1d293fa84e0bce3156943e8e9d313fc98facbde1
Reviewed-on: https://gerrit.chromium.org/gerrit/26405
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Ready: Ben Chan <benchan@chromium.org>
diff --git a/default_profile_unittest.cc b/default_profile_unittest.cc
index d3319f1..9fb583e 100644
--- a/default_profile_unittest.cc
+++ b/default_profile_unittest.cc
@@ -265,4 +265,15 @@
EXPECT_TRUE(profile_->ConfigureService(ethernet_service));
}
+TEST_F(DefaultProfileTest, UpdateDevice) {
+ scoped_ptr<MockStore> storage(new MockStore());
+ EXPECT_CALL(*storage, Flush()).WillOnce(Return(true));
+ EXPECT_CALL(*device_, Save(storage.get()))
+ .WillOnce(Return(true))
+ .WillOnce(Return(false));
+ profile_->set_storage(storage.release());
+ EXPECT_TRUE(profile_->UpdateDevice(device_));
+ EXPECT_FALSE(profile_->UpdateDevice(device_));
+}
+
} // namespace shill