summaryrefslogtreecommitdiff
path: root/payload_generator/ext2_filesystem_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'payload_generator/ext2_filesystem_unittest.cc')
-rw-r--r--payload_generator/ext2_filesystem_unittest.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/payload_generator/ext2_filesystem_unittest.cc b/payload_generator/ext2_filesystem_unittest.cc
index 122ba02c..d2ea2b30 100644
--- a/payload_generator/ext2_filesystem_unittest.cc
+++ b/payload_generator/ext2_filesystem_unittest.cc
@@ -177,4 +177,26 @@ TEST_F(Ext2FilesystemTest, ParseGeneratedImages) {
}
}
+TEST_F(Ext2FilesystemTest, LoadSettingsFailsTest) {
+ base::FilePath path = test_utils::GetBuildArtifactsPath().Append(
+ "gen/disk_ext2_1k.img");
+ unique_ptr<Ext2Filesystem> fs = Ext2Filesystem::CreateFromFile(path.value());
+
+ chromeos::KeyValueStore store;
+ // disk_ext2_1k.img doesn't have the /etc/update_engine.conf file.
+ EXPECT_FALSE(fs->LoadSettings(&store));
+}
+
+TEST_F(Ext2FilesystemTest, LoadSettingsWorksTest) {
+ base::FilePath path = test_utils::GetBuildArtifactsPath().Append(
+ "gen/disk_ext2_ue_settings.img");
+ unique_ptr<Ext2Filesystem> fs = Ext2Filesystem::CreateFromFile(path.value());
+
+ chromeos::KeyValueStore store;
+ EXPECT_TRUE(fs->LoadSettings(&store));
+ string minor_version;
+ EXPECT_TRUE(store.GetString("PAYLOAD_MINOR_VERSION", &minor_version));
+ EXPECT_EQ("1234", minor_version);
+}
+
} // namespace chromeos_update_engine