Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Unified Diff: utils_unittest.cc

Issue 2868105: Disable automatic update checks if booting from a removable device. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils_unittest.cc
diff --git a/utils_unittest.cc b/utils_unittest.cc
index b67114a9df8472056be784f46c1bf205154c8880..575d91fbb99bee3a244b3c2fe4f3fdd5a6e2e0f3 100644
--- a/utils_unittest.cc
+++ b/utils_unittest.cc
@@ -133,6 +133,23 @@ TEST(UtilsTest, TempFilenameTest) {
TEST(UtilsTest, RootDeviceTest) {
EXPECT_EQ("/dev/sda", utils::RootDevice("/dev/sda3"));
EXPECT_EQ("/dev/mmc0", utils::RootDevice("/dev/mmc0p3"));
+ EXPECT_EQ("", utils::RootDevice("/dev/foo/bar"));
+ EXPECT_EQ("", utils::RootDevice("/"));
+ EXPECT_EQ("", utils::RootDevice(""));
+}
+
+TEST(UtilsTest, SysfsBlockDeviceTest) {
+ EXPECT_EQ("/sys/block/sda", utils::SysfsBlockDevice("/dev/sda"));
+ EXPECT_EQ("", utils::SysfsBlockDevice("/foo/sda"));
+ EXPECT_EQ("", utils::SysfsBlockDevice("/dev/foo/bar"));
+ EXPECT_EQ("", utils::SysfsBlockDevice("/"));
+ EXPECT_EQ("", utils::SysfsBlockDevice("./"));
+ EXPECT_EQ("", utils::SysfsBlockDevice(""));
+}
+
+TEST(UtilsTest, IsRemovableDeviceTest) {
+ EXPECT_FALSE(utils::IsRemovableDevice(""));
+ EXPECT_FALSE(utils::IsRemovableDevice("/dev/non-existent-device"));
}
TEST(UtilsTest, PartitionNumberTest) {
« no previous file with comments | « utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698